Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input period = 55;
- input alertsOn = yes;
- def price = (high + low + close) / 3;
- #-----Typical Price ZeroLag Triple Exponential Moving Average
- def TMA1 = 3 * ExpAverage(price, period)
- -3 * ExpAverage(ExpAverage(price, period), period)
- +ExpAverage(ExpAverage(ExpAverage(price, period)
- , period), period);
- def TMA2 = 3 * ExpAverage(TMA1, period)
- +3 * ExpAverage(ExpAverage(TMA1, period), period)
- +ExpAverage(ExpAverage(ExpAverage(TMA1, period)
- , period), period);
- def difference = TMA1 - TMA2;
- def TypicalPriceZeroLagTEMA = TMA1 + difference;
- #------Heikin-Ashi Close ZeroLag Triple Exponential Moving Average
- rec haopen = CompoundValue(1, ((open[1] + high[1]
- +low[1] + close[1]) / 4 + haopen[1]) / 2, hl2);
- def haclose = ((open + high + low + close) / 4 + haopen
- +Max(high, haopen) + Min(low, haopen)) / 4;
- def HATMA1 = 3 * ExpAverage(haclose, period)
- -3 * ExpAverage(ExpAverage(haclose, period), period)
- +ExpAverage(ExpAverage(ExpAverage(haclose, period)
- , period), period);
- def HATMA2 = 3 * ExpAverage(HATMA1, period)
- -3 * ExpAverage(ExpAverage(HATMA1, period), period)
- +ExpAverage(ExpAverage(ExpAverage(HATMA1, period)
- , period), period);
- def HAdifference = HATMA1 - HATMA2;
- def HeikinAshiZeroLagTEMA = HATMA1 + HAdifference;
- def buySignal = if TypicalPriceZeroLagTEMA > HeikinAshiZeroLagTEMA and TypicalPriceZeroLagTEMA[1] <= HeikinAshiZeroLagTEMA[1] then 1 else 0;
- def sellSignal = if TypicalPriceZeroLagTEMA < HeikinAshiZeroLagTEMA and TypicalPriceZeroLagTEMA[1] >= HeikinAshiZeroLagTEMA[1] then 1 else 0;
- plot zeroline = 0;
- plot histogram = TypicalPriceZeroLagTEMA - HeikinAshiZeroLagTEMA;
- histogram.AssignValueColor(if histogram >= 0 then if histogram > histogram[1] then color.green else color.dark_green else if histogram < histogram[1] then color.red else color.dark_red);
- histogram.SetLineWeight(2);
- histogram.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
- plot signalsell2 = if sellSignal then zeroline else Double.NaN;
- signalSell2.SetDefaultColor( Color.DOWNTICK );
- signalSell2.SetLineWeight(3);
- signalSell2.SetPaintingStrategy( PaintingStrategy.ARROW_DOWN );
- plot signalsell3 = if buySignal then zeroline else Double.NaN;
- signalSell3.SetDefaultColor( Color.UPTICK );
- signalSell3.SetLineWeight(3);
- signalSell3.SetPaintingStrategy( PaintingStrategy.ARROW_UP );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement