Announcement

Collapse
No announcement yet.

Line Drawing

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

  • #16
    Hi Alex, I modified the code so that I get an audio/popup alert after the 2nd high hits the upper BB. I use bar charts and this works okay except it also alerts if two "red bar" highs hit.

    How do I modify the code so that it only looks for "green" bar highs? I've had several botched attempts using
    getBarState() and setBar(). I've attached my modified builtinbbsmart1-alerts but if it doesn't come through your original is hyperlinked on your 10/20 post.

    I'd really appreciate if you could guide me in the right direction.

    Thanks, Steve
    Attached Files

    Comment


    • #17
      Steve
      This is in response to both your messages

      On line 81 it's not necessary for me to keep the prior high < prior Upper BB. Unless that's required for the formula to work and trigger the alerts, it can be deleted.

      It is required for the conditions in my efs but if the conditions are going to be changed it may no longer be necessary.

      Also, if I decide not to use the "low" values I presume the lines 89-95 are to be deleted and also the vBB.getValue(BollStudy.LOWER) on line 98. Is that correct?

      That is correct

      What I need at the .05 pinch is the current high >= current Upper BB (AND) the next high >= next Upper BB (AND) the same alerts. In other words I want the .05 pinch and 2 consecutive highs hitting their corresponding Upper BB, then the alert. How can this be written?

      The first thing you want to do is reverse the logic. Rather than thinking "if the current bar does x and the next bar does y then at the third bar in the future trigger the alert" you need to think that the bar that triggers the alert is the current bar and that the prior bars set up the conditions.
      The next thing you want to do is define "plain language variables" that will simplify the task of laying out the conditions. For example inside main() you would add

      var highcurrent = high(0);
      var high1back = high(-1); //high of the prior bar
      var high3back = high(-3); //high of three bars ago
      var close2back = close(-2); //close of two bars ago
      var UPPER2back = vBB.getValue(BollingerStudy.UPPER,-2); //notice the -2 to define the value of the Upper BB of two bars ago
      var BASIS3back = vBB.getValue(BollingerStudy.BASIS,-3); //same as above for the Basis line of three bars ago
      etc etc


      Once you have defined all the necessary variables just apply your logic along the lines of the example provided in the last efs I posted. So, for example if you want to define the "pinching" of the BB two bars ago you can write it using your own variables as

      if((UPPER2back-BASIS2back) <= 0.05 && etc etc

      followed by all the other conditions you want that set up the trigger for the current bar. By structuring the efs this way you should find it very easy to create all the variations of the study you would like to try out.

      How do I modify the code so that it only looks for "green" bar highs?

      You will need to add the condition that in both the prior bars the close is greater than the open. Using variables such as the ones described earlier you would write

      if(close2back>open2back && close1back>open1back && etc etc)

      Beyond this if you want to have the study worked on for you I would suggest that you contact one of the EFS Consultants
      Alex

      Comment


      • #18
        Alex, thanks for all the info which will help me put the final coding in my study. I appreciate the extra time you've given me and if needed I'll try to use other sources in the forum or eSignal directly. Good trading.

        Steve

        Comment

        Working...
        X