Announcement

Collapse
No announcement yet.

MACDcolorHist.efs question

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

  • MACDcolorHist.efs question

    MACDColorHist.efs does almost what I want. If a histogram bar is lower then the previous bar, I want to see it in red (or green , if the bar is higher).

    But this efs changes bar color based on histogram bar movement as it evolves during its interval. Say previous histo bar is 0.05. In this efs, if the current bar moves between 0.08 and 0.07, the bar would display in red as it drops (and green as it rises), even though it is higher than the previous bar. I prefer to see it always in green as long as it is above 0.05.

    I tried adding SetCompute on Close, but then I don't see the current bar fluctuations, which I want to see. I tried defining vHist1 = study.getValue(MACDStudy.HIST, -1) but that didn't work.

    Any suggestions on how to achieve the above?
    Thanks
    shaeffer

  • #2
    shaeffer
    If the script is using EFS1 syntax then you should achieve what you want with the following

    if(study.getValue(MACDStudy.HIST) > study.getValue(MACDStudy.HIST, -1)
    setBarFgColor(Color.lime,x)

    where x corresponds to the series index (ie position of the element in the return array starting from 0)
    Alex

    Comment


    • #3
      Hi Alex,

      Yes, it was a downloaded efs1 (from the forum). But to stay current, I'm abandoning it in favor of efs2.

      Ultimately, I want to see the MACD histogram and the two curves in my study window. But because of the common scaling (if only one study is used), the curves often 'force' the histogram to be so small its barely readable. So what I do is overlay a MACD histogram-only efs on a Macd study with the two curves. I think that is still the only way to achieve full window height scaling of the histogram?

      So, using efs2, my objective is a Macd histogram efs, with green bars when the the latest bar is higher than the previous (and red bars when lower).

      I've started with the new basicMACD.efs and removed reference to macd and macdsig (leaving only macdHist), and I'm getting a plot. I prefer that ema's are used, do you know if basicMACD.efs uses sma's or ema's?

      And now I'm trying to determine how to insert the equivalent to the command in your previous reply, in efs2 format. Any hints?

      Or do I have to start with customMACD.efs to achieve what I'm after? It doesn't seem to have the sma/ema option anymore?

      Thanks
      shaeffer

      Comment


      • #4
        Hi Alex,

        I got the colored bars to work.
        Funny, I could use default bar thickness 1, 2 and 4, but not 3.

        The histogram doesn't quote match my older version which uses ema's. Can that be changed in this basic efs?

        Regards
        shaeffer

        Hmmm, looks like someone else had the same question at the same time - so the basic efs does use ema's. I'll have to see why my older efs doesn't look quite the same
        Attached Files
        Last edited by shaeffer; 04-30-2005, 02:15 PM.

        Comment


        • #5
          shaeffer
          Although the syntax you used works it is not the most efficient way to do that. You may want to try the revision enclosed below
          As to the sma/ema option that is no longer available and the MACD is now based only on exponential averages
          Alex

          PHP Code:
          function preMain() {
              
          setPriceStudy(false);
              
          setStudyTitle("MACD");
              
          setShowCursorLabel(false);
              
          setShowTitleParametersfalse );
              
          setCursorLabelName("MACD");
              
          setDefaultBarFgColor(Color.cyan); 
              
          setPlotType(PLOTTYPE_HISTOGRAM); 
              
          setDefaultBarThickness(4);    
          }
          var 
          vHist null;
          function 
          main(){

              if(
          vHist==nullvHist macdHist(5,35,5);

              if (
          vHist.getValue(-1) < vHist.getValue(0)) {
                  
          setBarFgColor(Color.lime);
              }
              if (
          vHist.getValue(-1) >= vHist.getValue(0)) {
                  
          setBarFgColor(Color.red);
              }

              return 
          vHist.getValue(0);

          Comment


          • #6
            MACD color Histogram

            Hi Alex,

            Thanks for the suggestion to improve the efficiency.

            I will use this efs in 12 mini-charts. To more readily see MACD histogram direction in all these charts, I paint the histogram bar backgrounds with the appropriate color, per the attached efs. But I noticed the increased computer load when I did this in my efs1 version of this. In fact, as the histo bar moved up and down as it evolved within the chart time interval, sometimes the background would only get partially repainted, before it would start the next repaint.

            So my question is, is there a more efficient way now in efs2 to do this background repainting? (I had asked Ideas for a setStudyBgColor command, hoping it would accomplish Bg repainting more efficiently, but haven't seen anything like this yet).

            Best Regards
            shaeffer
            Attached Files

            Comment


            • #7
              shaeffer
              The background painting functions are unchanged in EFS2
              Alex

              Comment

              Working...
              X