Description
The Absolute Price Oscillator is a custom indicator used to identify price sentiment.
The strongest Long sentiment occurs when the indicator components are in order from top to bottom: green, red, black, and all components are above the zero level. Likewise, the strongest Short sentiment occurs when the indicator components are in order from bottom to top: green, red, black, and all components are below the zero level.
si
using System;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Levels(0)]
[Indicator(IsOverlay = false, AutoRescale = true, AccessRights = AccessRights.None)]
public class mAPO : Indicator
{
[Parameter("Fast Period (10)", DefaultValue = 10)]
public int inpPeriodFast { get; set; }
[Parameter("Slow Period (20)", DefaultValue = 20)]
public int inpPeriodSlowt { get; set; }
[Output("Delta", LineColor = "Black", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outDelta { get; set; }
[Output("Fast", LineColor = "Red", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outFast { get; set; }
[Output("Slow", LineColor = "Green", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outSlow { get; set; }
private MovingAverage _fast, _slow;
protected override void Initialize()
{
_fast = Indicators.MovingAverage(Bars.ClosePrices, inpPeriodFast, MovingAverageType.Exponential);
_slow = Indicators.MovingAverage(Bars.ClosePrices, inpPeriodSlowt, MovingAverageType.Exponential);
}
public override void Calculate(int i)
{
outDelta[i] = _fast.Result[i] - _slow.Result[i];
outFast[i] = Bars.ClosePrices[i] - _fast.Result[i];
outSlow[i] = Bars.ClosePrices[i] - _slow.Result[i];
}
}
}
mfejza
Joined on 25.01.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: mAPO.algo
- Rating: 0
- Installs: 405
- Modified: 21/11/2023 08:04
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.