Announcement

Collapse
No announcement yet.

Changing MA line colors

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

  • Changing MA line colors

    Hi:

    I am making some modifications to the file strmacrvs.efs which is a 2 MA crossover strategy study. I would like to display the fast MA line (10) in green and the slow MA line (20) in red to better see the trend direction and crossover point.

    I note that to set the price bar color you use the following command:

    setPriceBarColor(color.red)

    However, I cannot find a similar command that will set the color of the moving average study line (although it must be possible, because the Edit Studies command will allow you to change the line colors).

    Is there another parameter for the base MA study:

    (MAStudy 20,0,"Close",MAStudy.SIMPLE)

    or some other parameter that will change this MA line color?

    Thanks,

    Mark

  • #2
    Mark
    If you require specific help on an efs you may want to either post the code or attach the efs in question or provide a link to it.
    To answer your question in general terms click here for information on the functions setDefaultBarFgColor() and setBarFgColor() which are used to color a plot
    Alex

    Comment


    • #3
      MA crossover

      Alex:

      Thanks for the response. Attached is the file in question that generates a signal for the crossover of a 10 and 20 period EMA. My goal is to paint the shorter EMA in one color, and the longer EMA in another color, so that I can gauge the strength of the movement. At the present time, both EMAs are in blue.

      Any assistance would be most appreciated!

      Mark
      Attached Files

      Comment


      • #4
        Mark
        Add the following lines in preMain
        setDefaultBarFgColor(Color.red,0);
        setDefaultBarFgColor(Color.blue,1);

        BTW this information is available at the link I suggested in my prior reply.
        Alex

        Comment


        • #5
          Alex:

          Thanks for quick response and programming tip -- much appreciated!

          On a similar vein, the setStudyTitle command is used to paint the study title on the screen. Can the setDefaultBarFgColor command also be used to change the color of the printed text on the screen, or is the default of black text not changeable?

          My goal is to have multiple studies on the screen, and a reference (from this setStudyTitle command) to the colors that each study represents.

          Thanks again!

          Mark

          Comment


          • #6
            Mark
            The color of all text in a chart is controlled through Properties (right click the chart and select Properties or select Chart Options->Properties from the main menu).
            As far as I know you cannot assign an individual color to each study title
            Alex

            Comment


            • #7
              Alex:

              Thanks again for your help on this one!

              Mark

              Comment

              Working...
              X