Description
This is nothing but the cTrader included Momentum indicator
the only difference is its more visually appealing
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; namespace cAlgo { [Levels(0)] [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class Cyf_Mom_Histogram : Indicator { //////// Drawing on the Indicator /////// private string UP = "▲"; private string Down = "▼"; //////////////////////////////////////// private MomentumOscillator _momentum; //private int RefCandle; //private IndicatorDataSeries CMA; [Parameter(DefaultValue = 12)] public int Periods { get; set; } [Output("Momentum_Down", Color = Colors.Red, PlotType = PlotType.Histogram, Thickness = 2)] public IndicatorDataSeries moScillatorDown { get; set; } [Output("Momentum_Up", Color = Colors.Blue, PlotType = PlotType.Histogram, Thickness = 2)] public IndicatorDataSeries moScillatorUp { get; set; } protected override void Initialize() { _momentum = Indicators.MomentumOscillator(MarketSeries.Close, Periods); } public override void Calculate(int index) { double momentum = _momentum.Result[index]; if (_momentum.Result[index] >= 100.0) { moScillatorUp[index] = (_momentum.Result[index] - 100.0); ChartObjects.RemoveObject("Direction"); ChartObjects.DrawText("Direction", UP, StaticPosition.BottomRight, Colors.Green); } else { ChartObjects.RemoveObject("Direction"); moScillatorDown[index] = (_momentum.Result[index] - 100.0); ChartObjects.DrawText("Direction", Down, StaticPosition.BottomRight, Colors.Red); } } } }
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Levels(0)]
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class Cyf_Mom_Histogram : Indicator
{
//////// Drawing on the Indicator ///////
private string UP = "â²";
private string Down = "â¼";
////////////////////////////////////////
private MomentumOscillator _momentum;
//private int RefCandle;
//private IndicatorDataSeries CMA;
[Parameter(DefaultValue = 12)]
public int Periods { get; set; }
[Output("Momentum_Down", Color = Colors.Red, PlotType = PlotType.Histogram, Thickness = 2)]
public IndicatorDataSeries moScillatorDown { get; set; }
[Output("Momentum_Up", Color = Colors.Blue, PlotType = PlotType.Histogram, Thickness = 2)]
public IndicatorDataSeries moScillatorUp { get; set; }
protected override void Initialize()
{
_momentum = Indicators.MomentumOscillator(MarketSeries.Close, Periods);
}
public override void Calculate(int index)
{
double momentum = _momentum.Result[index];
if (_momentum.Result[index] >= 100.0)
{
moScillatorUp[index] = (_momentum.Result[index] - 100.0);
ChartObjects.RemoveObject("Direction");
ChartObjects.DrawText("Direction", UP, StaticPosition.BottomRight, Colors.Green);
}
else
{
ChartObjects.RemoveObject("Direction");
moScillatorDown[index] = (_momentum.Result[index] - 100.0);
ChartObjects.DrawText("Direction", Down, StaticPosition.BottomRight, Colors.Red);
}
}
}
}
cyfer
Joined on 27.09.2015
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Cyf_Mom_Histogram.algo
- Rating: 0
- Installs: 3464
- Modified: 13/10/2021 09:54
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.
No comments found.