Announcement

Collapse
No announcement yet.

Alexis' MAx2 for 3.

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

  • Alexis' MAx2 for 3.

    Hello folks,

    I have tried to take Alexis MAx2 (two moving averages), and add in a third. I also tried to have the chart background change for various scenarios.
    1. all 3 MA's in "up-trend" = color1
    2. all 3 MA's in "down-trend" = color2

    3. Else =color3

    I have never programmed anything before, and I failed . I am getting a definition error for color 3.


    Thank you.
    Attached Files

  • #2
    JJOM
    The error is in line 121 where you have
    f15.setDefault(Color.grey); //Edit this value to set a new default
    instead of
    fp15.setDefault(Color.grey); //Edit this value to set a new default
    Once you fix that the efs should run.
    FYI I have not checked the logic, just the syntax error.
    Alex

    Comment


    • #3
      Thanks Alexis. I looked at at those lines for hours and missed that!

      It seems that my attempt at the 3 color change if flawed too.

      The chart is always color 3...

      Comment


      • #4
        JJOM
        What do you mean with "uptrend" or "downtrend" in your conditions?
        That the current value is higher (in uptrend) than the prior?
        Also the chart may be all of one color because you have selected the option to paint the whole background. Go into Edit Studies and select Bar instead of Chart and see if that provides the result you are looking for
        Alex

        Comment


        • #5
          Alexis,

          I do want the entire chart color to change.

          My problem is that I am trying to build a quick "visual filter."

          Your MAx2 is perfect and I use it on another chart, Thank You. For this one I am trying to do the same as MAx2 but add a third middle MA. So when the fastest MA is above the Middle and Slowest I get a green screen (and the reverse Gives Yellow).

          The difference is that when they (all three MA's are not in "order" the screen is grey). For example: when the fastest is above the slowest, but under the middle MA the screen would be grey.

          I hope this helps, and I thank you for your attention.

          Comment


          • #6
            JJOM
            Try the attached revision. I have extended the logic also to the "Bar" option.
            Alex
            Attached Files

            Comment


            • #7
              thank you

              Comment


              • #8
                Two things:

                1. I added this to the latest "else if" line to get a true "three-way-color-change:"

                && vMA3.getValue(MAStudy.MA)<vMA2.getValue(MAStudy.MA )){
                setChartBG(vColor2);
                }

                2. I have a new question/problem. When I use the bars only option (for coloring) it colors over the top of the "grid" and any lines drawn on the chart. Is there a way to avoid this?

                Thanks

                Comment


                • #9
                  JJOM
                  2. With regards to the grid there is nothing that can be done at this time. There have already been requests to change the bar background painting to be the same as the chart background painting.
                  As to lines that depends. If you are referring to lines drawn with the Line Tools then right click the chart, select Properties and put a check in Draw Lines on Top of Price.
                  With regards instead to lines returned by other efs(s) or builtin studies I think that depends on the order in which the efs(s) are loaded (I am unsure about this and will check)
                  Alex

                  Comment


                  • #10
                    JJOM
                    Following up on my prior reply.
                    If you also have other efs(s) running on the same chart you need to ensure that the efs that paints the bar background is the last one loaded.
                    Alex

                    Comment


                    • #11
                      Again, Thanks Alexis.

                      Comment


                      • #12
                        Alexis (or other),

                        I was messing with some colors, and the MAx2 became an indicator (below the price ). I have no idea how I got it there?

                        I do know about the shift and drag of an indicator into the price chart, but I do not know how this efs. drop down.

                        After watching it for a bit, this way, I think I like it, so I was wondering, what did I do that got it there?

                        Thanks

                        Comment


                        • #13
                          JJOM
                          You may have deleted setPriceStudy(true); which is at the very beginning of the preMain section.
                          Note that if you switch to bar color it will color only the background of the indicator and not of the price pane
                          Alex

                          Comment

                          Working...
                          X