[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ApplyStop accepts new values in 3.78



PureBytes Links

Trading Reference Links

Hi Tomasz, 

I am trying new ApplyStop feature, but seems to provide slightly 
different results from my previous AFL implementation.

/**old code to exit trade**/
Lentryprice = ValueWhen ( Buy, BuyPrice ); 
Lprofitprice = Lentryprice * ( 1+ptarget/100 );
Lstopprice = Lentryprice * ( 1-stopl/100 );

sell1 = BarsSince ( Buy ) > ldays;
sell2 = High > Lprofitprice;
sell3 = Low < Lstopprice;
Sell = sell1 or sell2 or sell3;

SellPrice = IIf ( sell2, Max ( Open, Lprofitprice ), IIf ( sell3, 
Min ( Open, Lstopprice ), Close ) );

/**NEW code to exit trade**/
ApplyStop ( 1, 1, ptarget, 1 );
ApplyStop ( 0, 1, stopl, 1 );

sell = BarsSince ( Buy ) > ldays;
sellprice = close;

?????
As far as I can tell, the target stop behaves the same, but the 
stoploss seems to be different, can you provide some insight???

Thanks,

Cliff Elion