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

[amibroker] Please Help A Novice With This Dual Triggers Problem



PureBytes Links

Trading Reference Links

Hi friends,
Please help me... I'm a novice user and having a hard time coding 
this Backtest using AFL.

I've been struggling with this, going through the help files, 
searching this forum... this is probably not a complicated problem 
for veteran users, I just simply don't know how to do this.

My trading idea is:

COVER and BUY when StochK(39) crosses above 20, and the RSI and CCI 
are confirming, and SELL and go SHORT when the StochK(39) crosses 
below 80, again with RSI and CCI confirmation.  So this study is 
always be in the market.

My problem is I get multiple trigger signals when the StochK first 
crosses above the 20, but doesn't make it to 80 and reverses back 
below the 20 line only to recross it from below again, triggering 
another buy.  Same problem at the 80 line.  I've changed the settings 
to have only one open position, without effect.

What I really need is a stop and reverse code when the StochK dives 
below the 20 after the BUY trigger, or back above 80 after a SHORT 
trigger.  I can't figure this out.

This is the simple part I've got so far. 

Buy = Cross ( StochK(39), 20 ) AND RSI(5) > 30 AND CCI(20) > -150;
Sell = Cross ( 80, StochK(39) ) AND RSI(5) < 70 AND CCI(20) < 150;
Short = Sell;
Cover = Buy;

I sure would appreciate someone looking at this for me and showing me 
how to add the necessary lines.  Thank you!