// Entry Condition: When Short EMA crosses above Long EMA longCondition = ta.crossover(emaShort, emaLong)
// Exit Condition: When Short EMA crosses below Long EMA exitCondition = ta.crossunder(emaShort, emaLong)
// Strategy Logic if (longCondition) // Open a new long position if not already in one strategy.entry("Long", strategy.long)
// If we want to automatically exit the long position via Stop Loss and Take Profit: strategy.exit( "Exit Long", from_entry = "Long", stop_loss = strategy.position_avg_price * (1 - stopLossPerc/100), limit = strategy.position_avg_price * (1 + takeProfitPerc/100) )
// Also, if exit condition is triggered by EMA cross: if (exitCondition) strategy.close("Long")
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.