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

[amibroker] Short signals not triggering.



PureBytes Links

Trading Reference Links

Hi,
I am unable to figure out why by short trades are not executing.  I am
trying to do the following.
-If the price closes TWO consecutive days above the BBand(20), short.
-If the price closes THREE consecutive days below the BBand(20), go long
-Exit when the Middle band (MA(20)) is crossed.  

The code I am using is below.  Also, is there a performance hit if I were to
code this using a For loop instead of the Array based functions?
I find I can think about things more clearly if I can iterate thru the bars.


SHORT_BARS = 2;
LONG_BARS = 3;
PER = 20;
STD_DEV = 2;

vBBTop = BBandTop( C, PER, STD_DEV);
vBBBot = BBandBot( C, PER, STD_DEV);
vBBMid = MA( C, 20 );

shortSig = SUM( C > vBBTop, SHORT_BARS ) == SHORT_BARS ;
longSig = SUM( C < vBBBot, LONG_BARS) == LONG_BARS;
exitSig = iif(shortSig, C < vBBMid, C > vBBMid);

Buy = longSig;
Short = shortSig;
Sell = exitSig ;
Cover = exitSig ;


[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/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/