Announcement

Collapse
No announcement yet.

Synch Bar Colors And Ma

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

  • Synch Bar Colors And Ma

    I was wondering if there is an efs that could color a moving average differently when it is rising or falling and also would use this function derived from the MA to color the chart bars

    If not yet available, could anyone create one. I think that it could be useful to link this option to color the bars not only to a MA but to any other study that one might chose

    Thank you,

    Giulio Rugarli

  • #2
    Giulio
    The attached efs derived from the builtinMA.efs which is available in the Builtin folder will color the price bars and the MA according to whether the MA is rising or falling.
    Alex

    Attached Files

    Comment


    • #3
      Want to do same thing but not with built-in function

      I want to be able to do the same thing but with my own function.

      At the start of main I have the following to save the last value of the curve:

      if ( getBarState() == BARSTATE_NEWBAR ) {
      prevLRS20 = LRS20;
      prevLRS60 = LRS60;
      }


      then I call my functions.....

      then at the end I do this:

      if (LRS60 < prevLRS60) {
      setBarFgColor(Color.red,1);
      } else if (LRS60 > prevLRS60) {
      setBarFgColor(Color.green,1);
      } else {
      setSBarFgColor(Color.magenta,1);
      }

      but the problem is that the line changes color 1 bar late instead of the the first bar with the slope change.

      Does anybody know what the problem is?

      Thanks

      Comment


      • #4
        bpschoch
        If I understood correctly what you are describing that is simply due to how the lines are colored. For a brief explanation of this you may want to see this message.
        Since that post however an option was made available to color the lines in a different way. To implement it add the following statement in preMain:
        setPlotType(PLOTTYPE_INSTANTCOLORLINE, #);
        where # represents the element in the return.
        Hope this helps
        Alex

        Comment


        • #5
          Sorry for asking more

          What I was wondering is if it was possible to modify the script and add a couple of settings to it that would make it better.

          I hope I am not asking too much, but I have a feeling that for you could be a piece of cake.

          What I was thinking is if we could add bar color settings for both up and down bars, and also for the MA up/down, and its line thickness.

          Since I would like to use with different markets where I use different colors, to change the colors myself directly in the formula would not work.

          Thank you very much,

          Giulio

          P.S: Sorry if I ask, but are you also Italian?

          __________________
          Giulio Rugarli

          Comment


          • #6
            Giulio
            The attached revision of the efs includes an example (complete of instructions and/or comments) on how to add color selectors.
            All you need to do is to repeat the process for each item you wish to be able to select a color.
            Alex
            Attached Files

            Comment


            • #7
              Ma color bars

              I am posting the modified version of the script that Alexis very kindly helped me complete. This shows both MA and Price bars change colors according to the rising/falling of this indicator.

              Giulio Rugarli

              *** Moderator Edit ***
              An earlier post in Italian was moved to the Italian forum, and can be found at this location.
              Attached Files

              Comment

              Working...
              X