Description
The Wildhog oscillator displays an asset's overbought/oversold states and also searches for divergences. It works on any timeframe.
The system is based on the highs, lows, and closing prices of the last eight bars by default period.
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Levels(30,70,50)]
[Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
public class mWildhog : Indicator
{
[Parameter("Period (8)", DefaultValue = 8, MinValue = 2)]
public int inpPeriod { get; set; }
[Output("Wildhog Oscillator", LineColor = "Black", PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries outWoldhog { get; set; }
private IndicatorDataSeries _hh, _ll, _delta, _woldhog;
protected override void Initialize()
{
_hh = CreateDataSeries();
_ll = CreateDataSeries();
_delta = CreateDataSeries();
_woldhog = CreateDataSeries();
}
public override void Calculate(int i)
{
_hh[i] = i>inpPeriod ? Bars.HighPrices.Maximum(inpPeriod) : Bars.HighPrices[i];
_ll[i] = i>inpPeriod ? Bars.LowPrices.Minimum(inpPeriod) : Bars.LowPrices[i];
_delta[i] = _hh[i] - _ll[i];
_woldhog[i] = i>1
? 100.0 * (Bars.ClosePrices[i] - _ll[i]) / (3.0 * _delta[i]) + _woldhog[i-1] / 1.5
: 100.0 * (Bars.ClosePrices[i] - _ll[i]) / (3.0 * _delta[i]);
outWoldhog[i] = _woldhog[i];
}
}
}
mfejza
Joined on 25.01.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: mWildhog.algo
- Rating: 5
- Installs: 463
- Modified: 18/05/2023 11:25
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.