Hi, does anyone know how I would stop the TP/SL lines plotting once the trade is closed? Level plots I use below:
// S/L T/P Line Plots
longStop = na
longStop := shortCondition ? na : longCondition and strategy.position_size <=0 ? close - (atrout * stopMult) : longStop[1]
shortStop = na
shortStop := longCondition ? na : shortCondition and strategy.position_size >=0 ? close + (atrout * stopMult) : shortStop[1]
longTP = na
longTP := shortCondition ? na : longCondition and strategy.position_size <=0 ? close + (atrout * profitMult) : longTP[1]
shortTP = na
shortTP := longCondition ? na : shortCondition and strategy.position_size >=0 ? close - (atrout * profitMult) : shortTP[1]
strategy.exit("Long", "Long", stop=longStop, limit=longTP)
strategy.exit("Short", "Short", stop=shortStop, limit=shortTP)
s1 = plot(longStop, style=linebr, color=red, linewidth=1, title='Long ATR Stop')
s2 = plot(shortStop, style=linebr, color=red, linewidth=1, title='Short ATR Stop')
tp1 = plot(longTP, style=linebr, color=green, linewidth=1, title='Long ATR TP')
tp2 = plot(shortTP, style=linebr, color=green, linewidth=1, title='Short ATR TP')
// S/L T/P Line Plots
longStop = na
longStop := shortCondition ? na : longCondition and strategy.position_size <=0 ? close - (atrout * stopMult) : longStop[1]
shortStop = na
shortStop := longCondition ? na : shortCondition and strategy.position_size >=0 ? close + (atrout * stopMult) : shortStop[1]
longTP = na
longTP := shortCondition ? na : longCondition and strategy.position_size <=0 ? close + (atrout * profitMult) : longTP[1]
shortTP = na
shortTP := longCondition ? na : shortCondition and strategy.position_size >=0 ? close - (atrout * profitMult) : shortTP[1]
strategy.exit("Long", "Long", stop=longStop, limit=longTP)
strategy.exit("Short", "Short", stop=shortStop, limit=shortTP)
s1 = plot(longStop, style=linebr, color=red, linewidth=1, title='Long ATR Stop')
s2 = plot(shortStop, style=linebr, color=red, linewidth=1, title='Short ATR Stop')
tp1 = plot(longTP, style=linebr, color=green, linewidth=1, title='Long ATR TP')
tp2 = plot(shortTP, style=linebr, color=green, linewidth=1, title='Short ATR TP')
Feragatname
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.
Feragatname
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.