Category Trend  Published on 21/03/2023

WPR CrossSignal indicator

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's avatar
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
Comments
Log in to add a comment.
SA
sarahlison555 · 5 months ago

Signal is unstable

AN
angelaesper43 · 6 months ago

Thank you for sharing the huge data in an organized way and analyzing it in a clear and understandable way

LA
lauryfriese932 · 1 year ago

Thanks for all the great indicators (plus code) you uploaded. They've been very useful. 

HA
harringtongrimes6053737 · 1 year ago

All data has been updated World's Hardest Game. Thank!