I have problems creating an indicator that updates properly if used with CalculateOnBarClose = false.
Basically I modified a Stochastics to use different smoothing MA's:
K.Set(kValue); // Smooth = SlowKperiod switch (smoothType) { case 1: dValue = EMA(K, PeriodD)[0]; break; case 2: dValue = InstTrend(K, PeriodD)[0]; break; default: dValue = SMA(K, PeriodD)[0]; break; } D.Set(dValue); // PeriodD = SlowDperiod
the DataSeries to be smoothed.
If I use CalculateOnBarClose = true everything works fine with all three indicators. Input has these values for example:
CurrentBar=2839: Input[0]: 18.75, : Input[1]: 13.3333, : Input[2]: 18.75
CurrentBar=2840: Input[0]: 31.25, : Input[1]: 18.75, : Input[2]: 13.3333
ES:
When using CalculateOnBarClose = false, the current value for K does not get passed on to the InstTrend Indicator and therefore the computations will be false:
CurrentBar=2839: Input[0]: 0, : Input[1]: 13.3333, : Input[2]: 18.75
CurrentBar=2840: Input[0]: 0, : Input[1]: 18.75, : Input[2]: 13.3333
CurrentBar=2841: Input[0]: 0, : Input[1]: 31.25, : Input[2]: 18.75
However the system indicators EMA and SMA as well use Input[0] and do not seem to have any problems, even under tick by tick processing.
What is missing?
Comment