Announcement

Collapse
No announcement yet.

help with efs using cci

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • help with efs using cci

    i have created a formula using cci where if the cci drops below the zero line a sound alert is triggered. The problem with this is that if the cci flip flops above and below the zero line on the the same time bar the alert is triggered . What i want is that the alert is triggered only if the cci closes below or above the zero line. can anybody help with this

  • #2
    Re: help with efs using cci

    balat
    You would need to enclose the condition that checks if the cci has crossed above or below the zero line in a conditional statement that checks for BARSTATE_NEWBAR (see getBarState() in the EFS KnowledgeBase for the description and syntax of this function).
    Enclosed below is a generic example (with comments) of the required logic.
    Alex

    PHP Code:
    var myCCI cci(14);
    if(
    getBarState()==BARSTATE_NEWBAR){//on the first tick of a new bar
        
    if(myCCI.getValue(-2)>&& myCCI.getValue(-1)<0) || //IF myCCI two bars ago is above 0 AND myCCI previous bar is below 0 OR
           
    myCCI.getValue(-2)<&& myCCI.getValue(-1)>0){//myCCI of two bars ago is below 0 AND myCCI previous bar is above 0 THEN
            
    Alert.playSound("ding.wav");//play a sound
        
    }


    Originally posted by balat
    i have created a formula using cci where if the cci drops below the zero line a sound alert is triggered. The problem with this is that if the cci flip flops above and below the zero line on the the same time bar the alert is triggered . What i want is that the alert is triggered only if the cci closes below or above the zero line. can anybody help with this

    Comment

    Working...
    X