Announcement

Collapse
No announcement yet.

changing color of moving average

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

  • changing color of moving average

    hello all!

    there is a nice visual feature on ensign that I would like to see
    on Esignal.

    The rising/falling moving average with changing color.
    When moving average is rising, it draws a light color(usually green).
    When the moving average is falling, you pick a different color(usually a dark color).

    I would like to know if it is possible to do so and guide me on how to build this feature.

    Thanks

  • #2
    changing background color

    Following the same idea and being a highly visual person,
    I would like to know if it is possible to program the rising/falling
    moving average that changes color(up-green down-red)
    And as well I would like to see the background (the whole
    background not just part of it ) turn to light gray when the moving average is rising and to a darker shade of gray when moving average is falling.

    PLease inspire me, I need some direction and instruction on
    how to achieve this.

    Thanks
    Last edited by dojistarz; 03-06-2005, 07:17 PM.

    Comment


    • #3
      dojistarz
      The attached efs will color the moving average in lime and the chart background in light grey if the average is rising and in red and dark grey respectively if the average is falling (see enclosed images). Comments are included in the script.
      If you run a search through the Bulletin Board you should find several variations on this type of study.
      Also you may want to go through the EFS KnowledgeBase and in particular the Help Guides where you can find all the information regarding EFS
      Alex



      Attached Files

      Comment


      • #4
        thanks

        alexis

        you really impressed me!

        thanks a million

        I did not know it could be done,

        now the sky's the limit!

        Comment


        • #5
          Hi Alex. I was wondering if the basicmovingaverage(colors).efs below could be modified so one could specify the number of days up or down the MA had to occur before changing the color.

          In other words, the color would change green only if the MA is rising for 20 days or more. If it stopped rising it would turn gray until it fell for 20 days at which point it would turn red. The number of days could be set for whatever the user desires.

          This seems like a simple addition, but I am not sure how to simply capture the days variable. Any help would be GREATLY appreciated.

          David

          Comment


          • #6
            David
            Here is what you would need to do to accomplish what you want.
            First declare two global variables [ie outside of preMain() and main()] called CounterUp and CounterDn and set them both initially to 0. These store the counters for the rising and falling average and are then used to apply the color.



            Then comment out or delete the whole section of code (lines 54 to 61) that currently checks for the state of the average and colors it together with the background
            Once you have done that you need to add the logic that increments or resets the counters depending on the conditions of the average. This logic needs to be executed once per bar only at every new bar. An example of this logic together with comments is shown in the following image



            At this point you need to add the logic that checks the value of the counters and paints the average and the background accordingly. For an example see the following image that includes comments



            Save the script with a different name and load it in the chart.
            Alex

            Comment


            • #7
              Alex, It works (no surprise). You are always a great help! Thanks.

              David

              Comment


              • #8
                David
                You are most welcome and thank you for the feedback
                Alex

                Comment

                Working...
                X