plotting Trail

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


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);
   
}
Posted By: Spirit

Re: plotting Trail - 07/14/21 18:14

I think that can be done in a TMF. Plot TradeStopLimit.
Posted By: edu

Re: plotting Trail - 07/15/21 07:44

Thanks!
© 2024 lite-C Forums