Multi Timeframe Stochastic Oscillator free

by dadi in category Trend at 31/03/2022
Description

Simply Stochastic Oscillator with multi timeframe functionality.

Looks interesting to see how H1's 5, 3, 3 Stochastic gives an early signal for reversal on 5 minutes timeframe.

*Actually I never use Stochastic on my trades (hmm I used it anyway..., when I started to learn about forex trading years ago). So if you have a profitable strategy using Stochastic please share your thoughts!

 

Cheers.

 

 

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
´╗┐using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

    [Levels(20, 50, 80)]

    public class MultiTimeframeStochasticOscillator : Indicator
    {
        private StochasticOscillator _Stochastic;
        private Bars _Series;
        private int _TimeframeIndex;

        [Parameter("%K Periods", DefaultValue = 5, MinValue = 1)]
        public int _KPeriods { get; set; }

        [Parameter("%K Slowing", DefaultValue = 3, MinValue = 1)]
        public int _KSlowing { get; set; }

        [Parameter("%D Periods", DefaultValue = 3, MinValue = 0)]
        public int _DPeriods { get; set; }

        [Parameter("MA Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType _MAType { get; set; }

        [Parameter("Timeframe", DefaultValue = "hour1")]
        public TimeFrame _Timeframe { get; set; }

        [Parameter("Smoothing", DefaultValue = _Smoothing.No)]
        public _Smoothing _SmoothLine { get; set; }
        public enum _Smoothing
        {
            Yes,
            No
        }

        [Output("%D", LineColor = "Red", LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries _PercentD { get; set; }

        [Output("%K", LineColor = "Green")]
        public IndicatorDataSeries _PercentK { get; set; }

        protected override void Initialize()
        {
            _Series = MarketData.GetBars(_Timeframe);
            _Stochastic = Indicators.StochasticOscillator(_Series, _KPeriods, _KSlowing, _DPeriods, _MAType);
        }

        public override void Calculate(int index)
        {
            switch (_SmoothLine)
            {
                case _Smoothing.No:
                    _TimeframeIndex = _Series.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]);
                    break;
                default:
                    _TimeframeIndex = GetIndexByDate(_Series, Bars.OpenTimes[index]);
                    break;
            }

            _PercentD[index] = _Stochastic.PercentD[_TimeframeIndex];
            _PercentK[index] = _Stochastic.PercentK[_TimeframeIndex];
        }

        private int GetIndexByDate(Bars series, DateTime time)
        {
            for (int i = series.ClosePrices.Count - 1; i > 0; i--)
            {
                if (series.OpenTimes[i] == time)
                    return i;
            }
            return -1;
        }

    }
}
Comments

mabellindda - April 08, 2022 @ 05:44

These are complex pieces of code. How can I apply it to the pages of this fnf onlinewordle 2 website? 

makegoalken - April 26, 2022 @ 06:31

Thank you for sharing this information driving directions mapquest it was quite helpful to me.

among012a - May 05, 2022 @ 11:55

This is a great article, with a lot of information in it, These types of articles make users interested in your website. Keep sharing more and better articles! Thanks!

poppy playtime

5