FX:EURUSD   Euro / U.S. Dollar
//@version=5
strategy("My Strategy", overlay=true, initial_capital=100, currency=currency.USD)

// Define strategy variables
var float last_buy_price = na

// Define strategy parameters
var float take_profit = input.float(1.5, title="Take Profit")
var float stop_loss = input.float(0.9, title="Stop Loss")

// Define strategy entry conditions
entry_condition = // Define your entry conditions here

// Define strategy exit conditions
exit_condition = // Define your exit conditions here

// Execute strategy
if entry_condition
strategy.entry("Buy", strategy.long)
last_buy_price := close

if exit_condition
strategy.close("Buy")

// Define take profit and stop loss
strategy.exit("Take Profit/Stop Loss", "Buy", profit=last_buy_price*take_profit, loss=last_buy_price*stop_loss)
Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.