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

[amibroker] "AllowSameBarExit" not working



PureBytes Links

Trading Reference Links

I have some backtester code below. Despite setting the 
"AllowSameBarExit" option to True, the position is not being sold on 
the same day.

See this JPG for my explanation:

http://www.chambers-media.com/01.jpg

The black arrow is the setup day
The green arrow is the buy day
The blue line is a trailing stop loss. When the low of the day passes 
through the low, a sell is triggered.

The position should enter and exit on the same day (B).

However, the backtester enters on (B) but exits on (C)!

Can anyone suggest - alex

==============================

SetOption("FuturesMode" , False);
SetBarsRequired(10000,10000); 

SetTradeDelays(0,0,0,0);
SetOption("AllowSameBarExit",True);

SetOption("MarginRequirement",0);
SetOption("MinShares",1);

Buy = Longsetup AND H>StopBuy;
BuyPrice = Max(Open,StopBuy);

LongStop = (Low-1) - 0.0010;   // Trail SL 10 pips behind

Sell =  L < LongStop;
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy ); 
SellPrice = Min(Open,LongStop);




Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.19/663 - Release Date: 2/1/2007 2:28 PM