Demarks MA

Chuck

Moderator
Staff member
5V2h2hP.png
Code:
# Demarks MA
# Mobius
# V01.2.2011
# What makes this MA unique is that it can be run at very low period lengths and still be a smooth indicator. Which makes it very responsive.

script Range{
    input d = close;
    input Min = 0;
    input Max = 10000;
    def hh = HighestAll(d);
    def ll = LowestAll(d);
    plot nr = (((Max - Min) * (d - ll)) /
                (hh - ll)) + Min;
}

input n = 5;
input V = 0.682;


   def newMax = Highest(high, n);
   def newMin = Lowest(low, n);

script BP {
   def bp = (((close - open) / (high - low)) * volume);
  plot data = bp;
}

   def newBP = Range(BP().data, newMin, newMax);
   def StDev = StDev(newBP, n);
   def GDEMA = (ExpAverage(newBP, n)* (1 + V)) -
               (ExpAverage((ExpAverage(newBP, n)), n)* V);

  plot PlotData = if IsNaN(newBP)
                  then Inertia(GDEMA[1], n)
                  else Inertia(GDEMA, n);
       PlotData.SetStyle(Curve.Firm);
       PlotData.SetLineWeight(1);
       plotData.AssignValueColor(if PlotData > PlotData[2]
                                 then Color.Green
                                 else Color.Red); 

# End Code
 
Top