Announcement

Collapse
No announcement yet.

OBV with a simple MA

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

  • OBV with a simple MA

    I've been trying to add a simple MA to the OBV. In the past I've been able to modify studies but cannot figure out how to do this. Tried modifying the OBV in the library folder without success. Can anyone help?

    Thanks
    Rod

  • #2
    Rod
    You can find an MAofOBV.efs in this group in FileShare.
    All parameters can be edited through Edit Studies
    Alex

    Comment


    • #3
      Thank you so much!!!

      Comment


      • #4
        OBV MA Alert

        Is it possible to set an alert on the OBV EMA???
        Maybe an arrow on the chart or an aural alert???
        Thanks for your time.......greg

        Comment


        • #5
          greg
          Yes it is possible. Shown below are a couple of examples based on different events
          You would write the required code just below the section that reads Insert your code following this text block..
          Alex

          PHP Code:
          //this logic based on direction change of the MA 
          if(getBarState()==BARSTATE_NEWBAR){//if at a new bar
              
          if(vMAofOBV.getValue(MAStudy.MA,-1)>vMAofOBV.getValue(MAStudy.MA,-2)&&//prior MA > MA 2 bars back and
                 
          vMAofOBV.getValue(MAStudy.MA,-2)<vMAofOBV.getValue(MAStudy.MA,-3)){//MA 2 bars back < MA 3 bars back
                  
          Alert.playSound("ding.wav");//play sound
              
          }
              
          //reverse logic for falling MA
          }
          //this logic based on the cross of MA and OBV
          if(getBarState()==BARSTATE_NEWBAR){//if at a new bar
              
          if(vMAofOBV.getValue(MAStudy.MA,-1)>vOBV.getValue(OBVStudy.OBV,-1)&&//prior MA > prior OBV and
                 
          vMAofOBV.getValue(MAStudy.MA,-2)<vOBV.getValue(OBVStudy.OBV,-2)){//MA 2 bars back < OBV 2 bars back
                     
          Alert.playSound("ding.wav");//play sound
              
          }
              
          //reverse logic for crossing under

          Comment


          • #6
            MA OBV histogram

            Alexis;
            Is it possible to change the MA OBV to a histogram so where the OBV is above the 10 day MA it is green and below it is RED?
            Thanks for your time...Greg

            Comment


            • #7
              Greg
              Add a setPlotType(PLOTTYPE_HISTOGRAM,0) statement in preMain to plot the OBV as a histogram.
              To paint the histogram in green or red depending if it is above or below its moving average insert in main() the code enclosed below
              Alex

              PHP Code:
              if(vOBV.getValue(OBVStudy.OBV)>vMAofOBV.getValue(MAStudy.MA)){
                      
              setBarFgColor(Color.green,0);
                  }else{
                      
              setBarFgColor(Color.red,0);
                  } 

              Comment


              • #8
                MA OBV histogram

                Alex;
                I cannot get it to work. If you have time could you get the MA OBV with histogram Green above the MA(simple 10) and Red below the 10 day simple MA working and submit it in a EFS file?
                Thanks for all you do...Greg

                Comment


                • #9
                  Greg
                  All you need to do is add the setPlotType(...) statement in preMain then copy the code I posted in my prior reply and paste it in the efs right after the comment section "Insert your code following this text block..."
                  If you still encounter problems post the code as you have modified it and I or someone else can guide you through fixing it
                  Alex

                  Comment


                  • #10
                    Histogram Thickness

                    Alex;
                    How do you thicken the histogram?
                    Thanks for your time...Greg

                    Comment


                    • #11
                      Greg
                      You can do that by adding a setDefaultBarThickness() statement in preMain. (see the link for the syntax and examples).
                      Alex

                      Comment


                      • #12
                        Thanks Alex....

                        Comment

                        Working...
                        X