How can i add my Indicator to my CBOT?
Created at 13 Jul 2020, 11:51
How can i add my Indicator to my CBOT?
13 Jul 2020, 11:51
Hello.
I have programmed a SSL Indicator here:
This is my SSL Code.
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class SSL : Indicator
{
[Parameter("Length", DefaultValue = 10)]
public int len { get; set; }
[Output("SSLDown", LineColor = "Red")]
public IndicatorDataSeries sslDown { get; set; }
[Output("SSLUp", LineColor = "Green")]
public IndicatorDataSeries sslUp { get; set; }
private SimpleMovingAverage smaHigh, smaLow;
private IndicatorDataSeries hlv;
protected override void Initialize()
{
smaHigh = Indicators.SimpleMovingAverage(MarketSeries.High, len);
smaLow = Indicators.SimpleMovingAverage(MarketSeries.Low, len);
hlv = CreateDataSeries();
}
public override void Calculate(int index)
{
hlv[index] = MarketSeries.Close[index] > smaHigh.Result[index] ? 1 : MarketSeries.Close[index] < smaLow.Result[index] ? -1 : hlv[index - 1];
sslDown[index] = hlv[index] < 0 ? smaHigh.Result[index] : smaLow.Result[index];
sslUp[index] = hlv[index] < 0 ? smaLow.Result[index] : smaHigh.Result[index];
}
}
}
Now i want to use this indicator in my CBOT for Autotrading.
How can i add this indicator in my Code??
if i type in private SSL it cant find my SSL indicator i had created?
How can i find my programmed Indicators in my Calgo database?
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class VSOO : Robot
{
//Parameter Einstellungen für Indikatoren
[Parameter("Quantity (Lots)", Group = "Volume", DefaultValue = 1, MinValue = 0.01, Step = 0.01)]
public double Quantity { get; set; }
[Parameter("Source", Group = "RSI")]
public DataSeries Source { get; set; }
[Parameter("Periods", Group = "RSI", DefaultValue = 14)]
public int Periods { get; set; }
[Parameter("Periods", Group = "SSL", DefaultValue = 14)]
public int Periods { get; set; }
[Parameter("Source", Group = "SSL")]
public DataSeries Source { get; set; }
private RelativeStrengthIndex rsi;
private SSL;
}
}
PanagiotisCharalampous
13 Jul 2020, 11:53
Hi renereiner,
Check here to find out how to reference a custom indicator in your cBot.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous