I was unable to fully grasp this by reading the AFL documentation.
Here's what I have.
Equity( 1, 0 );
InTrade = Flip( Buy, Sell );
SetOption( "EveryBarNullCheck", True );
AtrLength = ATR( 14 ) * 1;
AtrStopSize = H - AtrLength;
AtrStopInTrade = IIf( InTrade, HighestSince( Buy, AtrStopSize ), Null );
Plot( AtrStopInTrade, "AtrStopInTrade", colorRed, styleDots );
I was watching this tutorial where the stop has been setup like this...
ApplyStop( stopTypeTrailing, stopModePoint, AtrLength, 2 );
... which I took to mean that the ApplyStop
function calculates the AtrStopSize
itself, which would mean that the following...
ApplyStop( stopTypeTrailing, stopModePoint, AtrStopSize, 2 );
... is the wrong way to do it.
Basically: I want to be 100% sure that the Plot
on my chart actually reflects the stops executed in the backtester through ApplyStop
.
PS! I apologize if there is an answer somewhere, but I could not find it searching here, or on Google.