Ichimoku cloud breakout Bot
Ichimoku cloud breakout Bot
20 May 2021, 14:40
Can someone please help me with this code i am getting this error from ctrader --- Error CS0246: The type or namespace name 'IchimokuCloud' could not be found (are you missing a using directive or an assembly reference?)
And this is the code
------------------------------------------------------------------
using cAlgo.API;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC)]
public class IchimokouBot : Robot
{
private IchimokuCloud ichimoku;
[Parameter(DefaultValue = 9)]
public int periodFast { get; set; }
[Parameter(DefaultValue = 26)]
public int periodMedium { get; set; }
[Parameter(DefaultValue = 52)]
public int periodSlow { get; set; }
[Parameter(DefaultValue = 26)]
public int DisplacementCloud { get; set; }
[Parameter(DefaultValue = "MyLabel")]
public string MyLabel { get; set; }
[Parameter(DefaultValue = 10000)]
public int Volume { get; set; }
[Parameter("Stop Loss", DefaultValue = 25, MinValue = 0, MaxValue = 100)]
public int StopLossPips { get; set; }
[Parameter("Take Profit", DefaultValue = 20, MinValue = 0, MaxValue = 100)]
public int TakeProfitPips { get; set; }
protected override void OnStart()
{
ichimoku = Indicators.GetIndicator(periodFast, periodMedium, periodSlow, DisplacementCloud);
}
protected override void OnBar()
{
var closedAbove = MarketSeries.Close.Last(1) > ichimoku.SenkouSpanA.Last(1);
var openedInsideKumo = MarketSeries.Open.Last(1) <= ichimoku.SenkouSpanA.Last(1) &&
MarketSeries.Open.Last(1) >= ichimoku.SenkouSpanB.Last(1);
var distanceFromKumo = (MarketSeries.Close.LastValue - ichimoku.SenkouSpanA.LastValue)/Symbol.PipSize;
if (closedAbove && openedInsideKumo && distanceFromKumo <= 30)
ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, MyLabel, StopLossPips, TakeProfitPips);
}
}
}