TripleMovingAverage by md.safari.ci55
929 downloads / 1569 views / Created: 19.01.2024 Average Rating: 0
Indicator Description
TripleMovingAverage
Comments
//==============================================================
// Forex Strategy Builder
// Copyright © Miroslav Popov. All rights reserved.
//==============================================================
// THIS CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE.
//==============================================================
using ForexStrategyBuilder.Infrastructure.Enums;
using ForexStrategyBuilder.Infrastructure.Interfaces;
namespace ForexStrategyBuilder.Indicators.Custom
{
public class TripleMovingAverage : MainChartSingleLineIndicator
{
public TripleMovingAverage()
{
IndicatorName = "Triple Moving Average";
IndicatorVersion = "1.0";
IndicatorAuthor = "Miroslav Popov";
IndicatorDescription = "Triple Exponential Moving Average - TEMA";
}
public override void Initialize(SlotTypes slotType)
{
base.Initialize(slotType);
IndParam.ListParam[1].ItemList = new string[] {"Exponential"};
IndParam.ListParam[1].Text = "Exponential";
IndParam.ListParam[1].Index = 0;
}
public override void Calculate(IDataSet dataSet)
{
InitCalculation(dataSet);
double[] ema = MovingAverage(IndicatorPeriod, 0, IndicatorMaMethod, Price(IndicatorBasePrice));
double[] emaOfEma = MovingAverage(IndicatorPeriod, 0, IndicatorMaMethod, ema);
double[] emaOfEmaOfEma = MovingAverage(IndicatorPeriod, 0, IndicatorMaMethod, emaOfEma);
for (int bar = 0; bar < Bars; bar++)
IndicatorLine[bar] = 3*ema[bar] - 3*emaOfEma[bar] + emaOfEmaOfEma[bar];
FirstBar = 3*IndicatorPeriod + 2;
PostCalculation();
}
}
}
Risk warning: Forex, spread bets and CFD are leveraged products. They may not be suitable for you as they carry a high degree of risk to your capital and you can lose more than your initial investment. You should ensure you understand all of the risks.
Copyright © 2006 - 2024, Forex Software Ltd.;
Copyright © 2006 - 2024, Forex Software Ltd.;