Description
WPR CrossSignal indicator
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
public class mWPRcrsoosignal : Indicator
{
[Parameter("Fast Periods (5)", DefaultValue = 5)]
public int inpPeriodsFast { get; set; }
[Parameter("Slow Periods (34)", DefaultValue = 34)]
public int inpPeriodsSlow { get; set; }
[Output("CrossSignal OpenLong trigger", LineColor = "Green", PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries outLongOpen { get; set; }
[Output("CrossSignal OpenShort trigger", LineColor = "Red", PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries outShortOpen { get; set; }
private WilliamsPctR _wprfast, _wprslow;
private IndicatorDataSeries _longtrigger, _shorttrigger;
protected override void Initialize()
{
_wprfast = Indicators.WilliamsPctR(inpPeriodsFast);
_wprslow = Indicators.WilliamsPctR(inpPeriodsSlow);
_longtrigger = CreateDataSeries();
_shorttrigger = CreateDataSeries();
}
public override void Calculate(int i)
{
_longtrigger[i] = _shorttrigger[i] = double.NaN;
if(_wprfast.Result[i-1] > _wprslow.Result[i-1] && _wprfast.Result[i-2] < _wprslow.Result[i-2] && _wprfast.Result[i] > _wprslow.Result[i])
_longtrigger[i] = Bars.LowPrices[i];
if(_wprfast.Result[i-1] < _wprslow.Result[i-1] && _wprfast.Result[i-2] > _wprslow.Result[i-2] && _wprfast.Result[i] < _wprslow.Result[i])
_shorttrigger[i] = Bars.HighPrices[i];
outLongOpen[i] = _longtrigger[i];
outShortOpen[i] = _shorttrigger[i];
}
}
}
mfejza
Joined on 25.01.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: mWPRcrosssignal.algo
- Rating: 5
- Installs: 781
- Modified: 21/03/2023 19:45
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.
AN
Thank you for sharing the huge data in an organized way and analyzing it in a clear and understandable way
LA
HA
All data has been updated World's Hardest Game. Thank!
Signal is unstable