Warning! This section will be deprecated on February 1st 2025. Please move all your Indicators to the cTrader Store catalogue.
Description
Using this indicator, you can have four stochastics at the same time
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class MultiStochastic : Indicator{
[Parameter("K%1", DefaultValue = 17)]
public int K1 { get; set; }
[Parameter("K%2", DefaultValue = 26)]
public int K2 { get; set; }
[Parameter("K%3", DefaultValue = 52)]
public int K3 { get; set; }
[Parameter("K%4", DefaultValue = 234)]
public int K4 { get; set; }
[Parameter("Slowing", DefaultValue = 1)]
public int KSlowing { get; set; }
[Parameter("D%", DefaultValue = 1)]
public int DPeriods { get; set; }
[Parameter("maType")]
public MovingAverageType MAType { get; set; }
private StochasticOscillator _one;
private StochasticOscillator _tow;
private StochasticOscillator _three;
private StochasticOscillator _four;
[Output("Stok_1", Color = Colors.Red)]
public IndicatorDataSeries Stok_1 { get; set; }
[Output("Stok_2", Color = Colors.Blue)]
public IndicatorDataSeries Stok_2 { get; set; }
[Output("Stok_3", Color = Colors.Yellow)]
public IndicatorDataSeries Stok_3 { get; set; }
[Output("Stok_4", Color = Colors.Green)]
public IndicatorDataSeries Stok_4 { get; set; }
protected override void Initialize(){
_one = Indicators.StochasticOscillator(K1, KSlowing, DPeriods, MAType);
_tow = Indicators.StochasticOscillator(K2, KSlowing, DPeriods, MAType);
_three = Indicators.StochasticOscillator(K3, KSlowing, DPeriods, MAType);
_four = Indicators.StochasticOscillator(K4, KSlowing, DPeriods, MAType);
}
public override void Calculate(int index) {
Stok_1[index] = _one.PercentK[index];
Stok_2[index] = _tow.PercentK[index];
Stok_3[index] = _three.PercentK[index];
Stok_4[index] = _four.PercentK[index];
}
}
}
MR
MrDeveloper
Joined on 30.09.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Mutli_Stock.algo
- Rating: 0
- Installs: 1049
- Modified: 30/09/2022 11:14
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.