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

[amibroker] Prevent immediate re-entry on backtesting



PureBytes Links

Trading Reference Links


I am backtesting my formulas and am running into a problem. I trade 
end of day, so I set my trades to be the open price of the next day 
(in the settings dialog of AA). My problem is I have a 5% loss stop, 
and there are many occasions where I close and re-enter the same 
symbol on the same day. Now in reality, I would never do this, as the 
loss stop would kick in mid day, and I would not have actually placed 
an order for the opening as I am currently in that position.

Are there any easy ways to prevent opening a position that closes 
that same day. I know it has to do with my delay of one day to place 
my trades, I just don't know how to fix it. Here is my formula in 
case that is of any help:

PositionSize = 5000; 
Filter = 1;

Buy = ADX() >= 25 AND ADX() >= HHV(ADX(),10) AND C >= HHV(C,10);
Short = ADX() >= 25 AND ADX() >= HHV(ADX(),10) AND C <= LLV(C,10);

Sell = Ref(ADX(),-10) > ADX() AND Buy != 1;
Cover = Ref(ADX(),-10) > ADX() AND Short != -1;

Thanks in advance.

Tom





------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/