i struggle since few days to get MAEnvelopes (with M1 calculations) plotted on the Strategy Analyzer 1-tick chart (within a Strategy)
I manage to plot it with 1-tick calc, but not with M1 on 1-tick. Below is the code
private MAEnvelopes MA_Env;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Strategy here.";
Name = "Blabla";
Calculate = Calculate.OnEachTick;
EntriesPerDirection = 1;
EntryHandling = EntryHandling.UniqueEntries;
IsExitOnSessionCloseStrategy = false;
ExitOnSessionCloseSeconds = 30;
IsFillLimitOnTouch = false;
MaximumBarsLookBack = MaximumBarsLookBack.Infinite;
OrderFillResolution = OrderFillResolution.Standard;
Slippage = 0;
StartBehavior = StartBehavior.WaitUntilFlat;
TimeInForce = TimeInForce.Gtc;
TraceOrders = false;
RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
StopTargetHandling = StopTargetHandling.PerEntryExecution;
BarsRequiredToTrade = 2000;
IsInstantiatedOnEachOptimizationIteration = true;
}
else if (State == State.Configure)
{
AddDataSeries(BarsPeriodType.Tick, 1);
AddDataSeries(BarsPeriodType.Minute, 1);
}
else if (State == State.DataLoaded)
{
MA_Env= MAEnvelopes(BarsArray[2], 0.05,Convert.ToInt32( 3), Convert.ToInt32(30));
AddChartIndicator(MA_Env);
SetStopLoss(@"", CalculationMode.Pips, Stoploss, false);
SetProfitTarget("", CalculationMode.Pips, Takeprofit);
}
}
protected override void OnBarUpdate()
{
.....
btw i also created custom MAEnvelopes and added following to it, but still didnt help:
else if (State == State.Configure)
{
AddDataSeries(BarsPeriodType.Minute, 1);
}
What i am doing wrong?
Help will be highly appreciated
Thanks
BR
Toti

Comment