Announcement

Collapse
No announcement yet.

3rd bar volatility alert

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

  • #16
    Alex-

    line 30: missing } after function body:
    return;

    Comment


    • #17
      Henry
      That is because you did not include the closing brace } when you copied the script. Just add one after return; on the very last line of the efs.
      Alex

      Comment


      • #18
        Alex- got it! AWESOME as always! many thanks, Henry

        Comment


        • #19
          Alex- your help has been immeasurable and the study has really helped me see more clearly. At the risk of wearing you out, would it be possible to somehow indicate all 3rd bar 2 close reversals without disrupting the color bar indications already in place? Perhaps a green arrow or dot for buy and red for sell? Thanks, Henry

          Comment


          • #20
            Henry
            The enclosed revision replaces the magenta/green colored bars with a red/green dot plotted on the high and low respectively.
            At this point you should have enough examples and information available to you to modify this efs to your liking.
            Alex

            PHP Code:
            function preMain() {
                
            setPriceStudy(true);
                
            setStudyTitle("3bar range");
                
            setShowCursorLabel(false);
                
            setColorPriceBars(true);
                
            setDefaultPriceBarColor(Color.black);
                  
            }

            var 
            lastrawtime 0;
            var 
            BarCount 0;

            function 
            main() {

                if (
            lastrawtime != getValue("rawtime"0)) {
                 
            BarCount += 1;
                 
            lastrawtime getValue("rawtime"0);
                }    

                if(
            close(-2)>open(-2)&&close(-2)>close(-3)&&high(-2)>high(-3)&&
                   
            close(-1)>open(-1)&&close(-1)>close(-2)&&high(-1)>high(-2)&&
                   
            close(0)<open(0)&&close(0)<close(-2)&&high(0)<high(-1)){
                       
            setPriceBarColor(Color.magenta);
                }else if(
            close(-2)<open(-2)&&close(-2)<close(-3)&&low(-2)<low(-3)&&
                   
            close(-1)<open(-1)&&close(-1)<close(-2)&&low(-1)<low(-2)&&
                   
            close(0)>open(0)&&close(0)>close(-2)&&low(0)>low(-1)){
                       
            setPriceBarColor(Color.green);
                }else if((
            high(0)-low(0))<(high(-1)-low(-1))&&(high(-1)-low(-1))<(high(-2)-low(-2))){
                    
            setPriceBarColor(Color.blue);
                }else if(
            high(0)>high(-1)&&low(0)<low(-1)){
                    
            setPriceBarColor(Color.cyan);
                }else if(
            close(0)>open(0)){
                    
            setPriceBarColor(Color.lime);
                }else if(
            close(0)<open(0)){
                    
            setPriceBarColor(Color.red);
                }
                
                if(
            close(-2)>open(-2)&&close(-2)>close(-3)&&high(-2)>high(-3)&&
                   
            close(-1)>open(-1)&&close(-1)>close(-2)&&high(-1)>high(-2)&&
                   
            close(0)<open(0)&&close(0)<close(-2)&&high(0)<high(-1)){
                       
            drawTextRelative(0,high(0),"l",Color.red,null,Text.BOTTOM|Text.CENTER,"Wingdings",8,"Dn"BarCount);
                       }else{
                       
            removeText("Dn"+BarCount);
                }           
                if(
            close(-2)<open(-2)&&close(-2)<close(-3)&&low(-2)<low(-3)&&
                   
            close(-1)<open(-1)&&close(-1)<close(-2)&&low(-1)<low(-2)&&
                   
            close(0)>open(0)&&close(0)>close(-2)&&low(0)>low(-1)){
                       
            drawTextRelative(0,low(0),"l",Color.green,null,Text.TOP|Text.CENTER,"Wingdings",8,"Up"BarCount);
                       }else{
                       
            removeText("Up"+BarCount);
                }
                

                return;

            Comment


            • #21
              Alex- what I was trying to say was to keep everything prior to this last adjustment and add the dots for all 3rd bar 2 close reversals regardless of the configuration of the prior 2 bars high /lows and opens. So in effect you could have a magenta color bar and a red dot indication also. Or in another instance the 3rd bar could be a higher high or lower low or same high or same low and reverse the prior two closes. In effect I do not want to get rid of any of the colored bars just add all the additional 2 close reversals via the dots. This really is the final installment on this and I understand if you have had enough. In looking at your work , at my present level of understanding, I can't see how to do this. Thanks , Henry

              Comment


              • #22
                Henry
                I have edited the version in my last post. Copy it again.
                Alex

                Comment


                • #23
                  Alex- what I was trying to get was to add all the other 2 close reversals. Keeping this last fix I want to add dot recognition to all the other combinations of 2 close reversals . For buys these would be a higher high that closes below the previous two closes - same high bars as the previous bar/s that closes below the previous 2 closes. The opposite for buys.The 3rd bar that is a lower high than the previous bar and closes below the previous two is already written in. I would like to keep the magenta/green recognition and dot for those. So the addition to the last post would be adding dots for : sell dots - any bar that closes below the previous 2 closes. buy dots- any bar that closes above the previous 2 closes. Obviously the 3rd bar lower high / higher low version is already accounted for. Hope this makes same sense. This really is it. Henry

                  Comment


                  • #24
                    Henry
                    Write down in plain language each single condition specifying also where the dot has to be (ie on the high or low of the bar) and in what color and I will add them to the script.
                    Alex

                    Comment


                    • #25
                      Hi Alex- Sells: Red dot above -Higher high than previous bar that closes below the previous 2 closes. Red dot above -Same high as the previous bar that closes below the previous two closes. Opposite for buys. Green dot below - Lower low than previous bar that closes above previous 2 closes. Green dot below- Same low as previous bar that closes above previous 2 closes. Hope I have been clear. Thanks.

                      Comment


                      • #26
                        Henry
                        The enclosed efs adds the conditions you listed.
                        Alex

                        PHP Code:
                        function preMain() {
                            
                        setPriceStudy(true);
                            
                        setStudyTitle("3bar range");
                            
                        setShowCursorLabel(false);
                            
                        setColorPriceBars(true);
                            
                        setDefaultPriceBarColor(Color.black);
                              
                        }

                        var 
                        lastrawtime 0;
                        var 
                        BarCount 0;

                        function 
                        main() {

                            if(
                        lastrawtime != getValue("rawtime"0)){
                                
                        BarCount += 1;
                                
                        lastrawtime getValue("rawtime"0);
                            }    

                            if(
                        close(-2)>open(-2)&&close(-2)>close(-3)&&high(-2)>high(-3)&&
                               
                        close(-1)>open(-1)&&close(-1)>close(-2)&&high(-1)>high(-2)&&
                               
                        close(0)<open(0)&&close(0)<close(-2)&&high(0)<high(-1)){
                                   
                        setPriceBarColor(Color.magenta);
                            }else if(
                        close(-2)<open(-2)&&close(-2)<close(-3)&&low(-2)<low(-3)&&
                               
                        close(-1)<open(-1)&&close(-1)<close(-2)&&low(-1)<low(-2)&&
                               
                        close(0)>open(0)&&close(0)>close(-2)&&low(0)>low(-1)){
                                   
                        setPriceBarColor(Color.green);
                            }else if((
                        high(0)-low(0))<(high(-1)-low(-1))&&(high(-1)-low(-1))<(high(-2)-low(-2))){
                                
                        setPriceBarColor(Color.blue);
                            }else if(
                        high(0)>high(-1)&&low(0)<low(-1)){
                                
                        setPriceBarColor(Color.cyan);
                            }else if(
                        close(0)>open(0)){
                                
                        setPriceBarColor(Color.lime);
                            }else if(
                        close(0)<open(0)){
                                
                        setPriceBarColor(Color.red);
                            }
                            
                            if(
                        close(-2)>open(-2)&&close(-2)>close(-3)&&high(-2)>high(-3)&&
                               
                        close(-1)>open(-1)&&close(-1)>close(-2)&&high(-1)>high(-2)&&
                               
                        close(0)<open(0)&&close(0)<close(-2)&&high(0)<high(-1)){
                                   
                        drawTextRelative(0,high(0),"l",Color.red,null,Text.BOTTOM|Text.CENTER,"Wingdings",8,"Dn"BarCount);
                                   }else{
                                   
                        removeText("Dn"+BarCount);
                            } 

                            if(
                        close(-2)<open(-2)&&close(-2)<close(-3)&&low(-2)<low(-3)&&
                               
                        close(-1)<open(-1)&&close(-1)<close(-2)&&low(-1)<low(-2)&&
                               
                        close(0)>open(0)&&close(0)>close(-2)&&low(0)>low(-1)){
                                   
                        drawTextRelative(0,low(0),"l",Color.green,null,Text.TOP|Text.CENTER,"Wingdings",8,"Up"BarCount);
                                   }else{
                                   
                        removeText("Up"+BarCount);
                            }
                            
                            if(
                        high(0)>=high(-1)&&close(0)<close(-1)&&close(0)<close(-2)){
                                   
                        drawTextRelative(0,high(0),"l",Color.red,null,Text.BOTTOM|Text.CENTER,"Wingdings",8,"Dn2"BarCount);
                                   }else{
                                   
                        removeText("Dn2"+BarCount);
                            } 
                            
                            if(
                        low(0)<=low(-1)&&close(0)>close(-1)&&close(0)>close(-2)){
                                   
                        drawTextRelative(0,low(0),"l",Color.green,null,Text.TOP|Text.CENTER,"Wingdings",8,"Up2"BarCount);
                                   }else{
                                   
                        removeText("Up2"+BarCount);
                            }
                            
                            return;

                        Comment

                        Working...
                        X