here is the code i'm using :
private Ichimoku ichimoku1; private Ichimoku ichimoku2; private Ichimoku ichimoku3; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Ma stratégie perso made in Tessan Molinié"; Name = "DTPStrategy_v2"; Calculate = Calculate.OnBarClose; EntriesPerDirection = 1; BarsRequiredToTrade = 52+26; IsUnmanaged = true; // Disable this property for performance gains in Strategy Analyzer optimizations // See the Help Guide for additional information IsInstantiatedOnEachOptimizationIteration = false; } else if (State == State.Configure) { //AddDataSeries(instruments[0], new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 60 }, 52+26, string.Empty, null); AddDataSeries(BarsPeriodType.Minute, 15); AddDataSeries(BarsPeriodType.Minute, 60); } else if (State == State.DataLoaded) { ichimoku1 = Ichimoku(BarsArray[0]); ichimoku2 = Ichimoku(BarsArray[1]); ichimoku3 = Ichimoku(BarsArray[2]); AddChartIndicator(ichimoku1); AddChartIndicator(Pivots(BarsArray[0], PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 0, 0, 0, 240)); } } protected override void OnBarUpdate() { if(State == State.Historical) return; if (CurrentBars[0] < BarsRequiredToTrade) { Print("Not enough bars in data serie 0"); return; } if(CurrentBars[1] < BarsRequiredToTrade) { Print("Not enough bars in data serie 1"); return; } if(CurrentBars[2] < BarsRequiredToTrade) { Print("Not enough bars in data serie 2"); return; }
Comment