Hi all,
Have found an ApplyStop alternative from a post on another forum. I have
attached below -
Cheers
TrailATR= 2.5*ATR(15);
Initial=C-TrailATR;
stop[ 0 ] = Close[ 0 ];
for( i = 1 ; i < BarCount; i++)
{
if( Close[ i ] > stop[ i - 1])
{
temp = Close[ i ] - TrailATR[ i ];
if( temp > stop[ i - 1 ] ) stop[ i ] = temp;
else stop[ i ] = stop[ i - 1 ];
}
else
stop[ i ] = Initial[ i ];
}
sell = c < ref( stop, -1);
--- In [email protected], "superboot74" <superboo...@...> wrote:
>
> Hi all,
>
> I am still new to AB and have been walking through my backtest results
> (looking at the charts) and have some odd results using the ApplyStop
> function (it exits positions a lot earlier than it should). The code is
> below, does anything stick out?
>
> I am wondering if there is some more transparent code that performs the same
> function? I am looking to exit on a Close (or Low) below a trailing stop
> 2.5*ATR(15) and sell at the open of the next bar.
>
> SetTradeDelays(0,0,0,0)
> Trail = ATR(15) * 2.5;
> ApplyStop( stopTypeTrailing, stopModePoint, Trail, 2, True);
>
> SellPrice = O;
> Sell = 0;
>
> Many thanks in advance
> Darcy
>