Description
This represents the official edition of the formula devised by Tushar Chande in his 1994 book entitled "The New Technical Trader."
using cAlgo.API;
namespace cAlgo
{
[Indicator(AccessRights = AccessRights.None, IsOverlay = false)]
[Levels(0, 100, -100)]
public class ChandeMO : Indicator
{
public const string NAME = "Chande Momentum Oscillator";
public const string VERSION = "1.00";
[Parameter("cTrader Guru", DefaultValue = NAME + " (" + VERSION + ") https://ctrader.guru/")]
public string Identity { get; set; }
[Parameter("Period", DefaultValue = 14, MinValue = 1)]
public int Period { get; set; }
[Output("Main")]
public IndicatorDataSeries Result { get; set; }
protected override void Initialize()
{
// TODO
}
public override void Calculate(int index)
{
if (Period > index) return;
double SumHigh = SumHighestMyData(Bars.ClosePrices, Period, index);
double SumLow = SumLowestMyData(Bars.ClosePrices, Period, index);
Result[index] = ((SumHigh - SumLow) / (SumHigh + SumLow)) * 100;
}
private double SumHighestMyData(DataSeries MyData, int MyPeriod, int CurrentIndex)
{
double result = 0;
for (int i = 0; i < MyPeriod; i++)
{
result += MyData[CurrentIndex - i] > MyData[CurrentIndex - i - 1] ? MyData[CurrentIndex - i] - MyData[CurrentIndex - i - 1] : 0;
}
return result;
}
private double SumLowestMyData(DataSeries MyData, int MyPeriod, int CurrentIndex)
{
double result = 0;
for (int i = 0; i < MyPeriod; i++)
{
result += MyData[CurrentIndex - i] < MyData[CurrentIndex - i - 1] ? MyData[CurrentIndex - i - 1] - MyData[CurrentIndex - i] : 0;
}
return result;
}
}
}
ctrader.guru
Joined on 19.07.2018
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Chande MO.algo
- Rating: 5
- Installs: 779
- Modified: 13/01/2024 13:05
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
CW
This platform needs more people like this to open source their creations on what are let's face it open source indicators. Great job Leonardo! much appreciated.
Thanks ❤️