Announcement

Collapse
No announcement yet.

MACD Color Code

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

  • MACD Color Code

    Can someone help me change the color of the MACD Oscillator when it is rising, sideways, or falling?

    Thank you
    Joe

  • #2
    Joe
    You may need to post the efs you are using or provide a link to where you downloaded it
    Alex

    Comment


    • #3
      Alexis,
      Thank you for the response. I am using the standard MACD in eSignal, however am looking to change the color of the indicator when it moves up, down or sideways. Currently I have an ADX that turns green when moving up, and red when it is sideways and down. If I could figure out how to make the MACD green when it moves up, then blue when it is sideways or down that would be incredibly helpful.


      Humbly,
      Joe

      Comment


      • #4
        Joe
        Which line in the MACD study determines the up, down or sideways move? The MACD , Signal or Histogram?
        Alex

        Comment


        • #5
          MACD

          Alex,
          Sorry it took so long to respond, I have been traveling and unable to check this board. The line I am referring to is the standard blue line in the MACD indicator for the basic studies. I do not want to color code the signal line nor the histogram. I believe the process would be similar to how I coded the ADX (with your help of course). Your help is greatly appreciated. What I am looking to do is turn the MACD line green when it increases, and blue when it is sideways or down. Please let me know what you think. I apologize but I cannot attach a chart at this time.

          Joe

          Comment


          • #6
            Joe
            If you use the builtinMACD.efs that is in the Builtins folder then add the following two lines just before the return statement
            if(vMACD.getValue(MACDStudy.MACD)>vMACD.getValue(M ACDStudy.MACD,-1))
            setBarFgColor(Color.lime,1);

            This should color the MACD plot in lime when it is rising. Under all other conditions it will maintain the default color which is blue
            Alex

            Comment


            • #7
              Thank you

              Alexis,
              Thank you for your quick response and help. I will give it my best.

              Joe

              Comment


              • #8
                MACD Image

                Alexis,
                I have done it, however there is a small error, that I know your exceptional expertise would be able to fix. Would you be willing to help.

                Thank you in advance with your coorporation.
                Joe
                Attached Files

                Comment


                • #9
                  Joe
                  What is the error? I just ran the efs on a chart and it appears to work fine (result shown in the image below)
                  Alex

                  Comment


                  • #10
                    reply

                    Alexis,
                    Thank you for posting an image because i have had problems. You can see with the image that with the first downturn the indicator is still green? Look two clicks left on the blue line in the middle. Do you see how the indicator turns down, but still is green? Let me know what you think
                    Joe

                    Comment


                    • #11
                      Joe
                      Actually that is not an error but the result of how lines are colored by the efs
                      See this thread for an explanation. The example in the linked thread uses RSI but is applicable to the MACD or any other study. There is a solution however.
                      To color the plot "backwards" you need to add the following statement in preMain()
                      setPlotType(PLOTTYPE_INSTANTCOLORLINE, 1);
                      Alex

                      Comment


                      • #12
                        Much appreciated

                        Alex,
                        Thank you again. I appreciate you taking the time to help me. I will give this a try.

                        Joe

                        Comment


                        • #13
                          Hi,

                          How could i figure out how to make the MACD signal line Blue when it moves up, then red when it is sideways or down?
                          Your help is appreciated.
                          Thank you


                          fankc

                          Comment


                          • #14
                            fankc
                            Add the enclosed section of code to the script just above the section that colors the MACD line.
                            Alex

                            PHP Code:
                            if(vMACD.getValue(MACDStudy.SIGNAL)>vMACD.getValue(MACDStudy.SIGNAL,-1))//if SIGNAL is greater than previous SIGNAL
                                    
                            setBarFgColor(Color.blue,2);//color the third element of the return array in blue
                                
                            if(vMACD.getValue(MACDStudy.SIGNAL)<vMACD.getValue(MACDStudy.SIGNAL,-1))//if SIGNAL is less than previous SIGNAL
                                    
                            setBarFgColor(Color.red,2);//color the third element of the return array in red 

                            Comment


                            • #15
                              Change Color of Histogram

                              I am more interested in the color change of the difference between the macd line and signal line, which is represented by the histogram

                              Is there a way to make the color of the histogram different, eg. Blue above zero, red below zero?

                              Any pointers would be helpful

                              AK

                              Comment

                              Working...
                              X