Hello,

Your formula is wrong. All delays in SetTradeDelays *must be the same*,
otherwise you could change the order of events (which is happening in your formula).

Also for N-bar stop use ApplyStop, not ExRemSpan.

Correct formula looks as follows:

|*Buy* = 1;
*Sell* = *Cover* = *Short* = 0;

*BuyPrice* = *Open*;
*SellPrice* = *Close*;

TradeDays = 3;
ApplyStop( *stopTypeNBar*, *stopModeBars*, TradeDays );|

Best regards,
Tomasz Janeczko
amibroker.com

On 2010-03-08 23:02, mbausys wrote:
>  >  //--- cut here ---
>  >  Buy = Sell = Short = Cover = False;
>  >  BuyPrice = SellPrice = ShortPrice = CoverPrice = 0;
>  >  SetOption("MaxOpenPositions", 1);
>  >  SetPositionSize(100, spsPercentOfEquity);
>  >  SetTradeDelays(1,0,1,0);
>  >  TradeDays = 3;
>  >  BuyPrice = ShortPrice = Open;
>  >  SellPrice = CoverPrice = Close;
>  >  Buy = ExRemSpan(True, TradeDays);
>  >  Sell = Ref(Buy, -TradeDays);
>  >  //--- cut here ---

Reply via email to