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

[amibroker] Apply Stop Code Not Working



PureBytes Links

Trading Reference Links

I've put together a trading system that backtests reasonable well but 
can't get this last piece of the puzzle despite many hours.

Here's some sample code that should do what I want. The short sale 
should exit if/when the price of any subsequent bar goes above the high 
of the bar preceeding the trade signal bar. Sounds straight forward but 
no luck with results. 

When you run this code on hourly charts ( say STTS for June 9 ) the 
trade remains open at day's end. When I filter the results 
the "StopExit" returns the correct value but the ApplyStop line of code 
doesn't take me out of the trade as intended at that level.  

I've turned off all the stop settings in AA and specified short sales 
only. 

As always any kind help from some AFL brains would be really helpful.


Filter = Cross ( MA(C,9), MA(C,5) );

Short = Cross ( MA(C,9), MA(C,5) );
Cover = Cross ( MA(C,5), MA(C,9) );

StopExit = ValueWhen(Short,Ref(H,-1));

ApplyStop(stopTypeLoss,stopModePoint,StopExit,1,False,1);

AddColumn(C,"Close  ",1.2);
AddColumn(StopExit,"StopExit ",1.2);




------------------------ 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
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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/