Posted By: edu
plotting Trail - 07/14/21 15:57
Hi all
I have a code that plots the initial Stop Loss level of every trade I open in a simple strategy.
Does anyone have an idea on how I could plot the trailing Stop Loss?
Thanks in advance, here's the code
I have a code that plots the initial Stop Loss level of every trade I open in a simple strategy.
Does anyone have an idea on how I could plot the trailing Stop Loss?
Thanks in advance, here's the code
Code
function run() { set(PLOTNOW); int Days = 5; vars Close=series(priceClose()); Stop=2*ATR(100); Trail=2*ATR(100); if( NumOpenLong < 1 and Close[0] >= Close[Days] ) enterLong(); static var SL ; if(NumOpenLong < 1 and Close[0] >= Close[Days]) {SL = Close[0]-Stop;} //Stop Loss plot("Stop", SL, 0, PURPLE); }