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

Re: [amibroker] Best practices on avoiding multiple alerts being triggered on the same bar



PureBytes Links

Trading Reference Links

hi,
 
I believe these type of problems are usually solved using static variables. This example below would avoid two signals to be sent within the same hour and minute. Didn't test it but along these lines it can be done, regards Ed
 
buycondition1=rule1;
buycondition2=rule2;
 
if (buycondition1 and buycondition2) {
 
    myvar = StaticVarGet( hour() + minute() );
 
    if ( myvar != 1 ) {
 
        Alertif   ( buycondition1 and buycondition2);
        StaticVarSet( hour() + minute(), 1);
 
    }
 
} else if ( buycondition1 and NOT buycondition2 ) {
 
    myvar = StaticVarGet( hour() + minute() );
 
    if ( myvar != 1 ) {
 
        Alertif   ( buycondition1 and NOT buycondition2);
        StaticVarSet( hour() + minute(), 1);
 
    }
 
}
 
 
 
----- Original Message -----
From: Padhu
Sent: Wednesday, August 01, 2007 7:27 AM
Subject: [amibroker] Best practices on avoiding multiple alerts being triggered on the same bar

Hello,
 
I see that sometimes when there is a multiple rule match on the same bar, Alertif generates consective Buy signals for rule1 and rule2.
 
For now I have a work around:
buycondition1=rule1;
buycondition2=rule2;
 
Alertif   ( buycondition1 and buycondition2)
Alertif   ( buycondition1 and NOT buycondition2)
 
and so on...Problem is I have 4 buy rules and this method is not scalable...Unless I build so many permutations /combinations.
 
Is there a better way to handle this so that if Alert is triggered, ONLY the first buy alert is sent to the output/email and  then subsequent alerts for the same timestamp on that bar are suppressed?.
 
I see in the doc about
 
Buy = ExRem(Buy,Sell);
 
Can this help here?.
Something like Buy=Exrem(buycondition1,buycondition2);   Will this work?.

 
 Thanks.
 
Cheers,Padhu
 
 

__._,_.___

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___