Different values for indicators depending on WFOCycle

Posted By: GPEngine

Different values for indicators depending on WFOCycle - 07/19/15 17:08

What's happening, here?
Code:
function run() {
  if (is(INITRUN)) {
    BarPeriod = 60;
    BarOffset = 57;
    Weekend = 1;
    LookBack = 1001;
    StartDate = 20080101;
    EndDate = 20150301;
    NumWFOCycles = 169;
  }

  vars Price = series(price());
  if (Bar == 41712) {
    print(TO_ANY, strf("\nAt bar %d MMI17=%f.", Bar, MMI(Price, 17)));
  }
}


Select EUR/USD. Click Train. Observed:
Quote:
WFO: wfobug 2008..2015
At bar 41712 MMI17=50.000000.
At bar 41712 MMI17=50.000000.
At bar 41712 MMI17=50.000000.
At bar 41712 MMI17=50.000000.
At bar 41712 MMI17=50.000000.
At bar 41712 MMI17=50.000000.
At bar 41712 MMI17=50.000000.
At bar 41712 MMI17=50.000000.
At bar 41712 MMI17=50.000000.
At bar 41712 MMI17=31.250000.
Time 00:00:02
Expected: indicators to have the same values at the same bar, regardless of WFO cycle number.
Posted By: GPEngine

Re: Different values for indicators depending on WFOCycle - 07/19/15 17:21

Here's another.
Code:
function run() {
  if (is(INITRUN)) {
    BarPeriod = 60;
    BarOffset = 57;
    Weekend = 1;
    LookBack = 406;
    StartDate = 20080101;
    EndDate = 20150301;
    NumWFOCycles = 169;
  }

  var rvi405 = RVI(405);
  if (Bar == 41712) {
    print(
      TO_ANY,
      strf("\nAt bar %d in Cycle %d RVI405=%f.", Bar, WFOCycle, rvi405));
  }
}

Train prints
Quote:

wfobug compiling.................
WFO: wfobug 2008..2015
At bar 41712 in Cycle 158 RVI405=-0.090028.
At bar 41712 in Cycle 159 RVI405=-0.090028.
At bar 41712 in Cycle 160 RVI405=-0.090028.
At bar 41712 in Cycle 161 RVI405=-0.090028.
At bar 41712 in Cycle 162 RVI405=-0.090028.
At bar 41712 in Cycle 163 RVI405=-0.090028.
At bar 41712 in Cycle 164 RVI405=-0.069675.
At bar 41712 in Cycle 165 RVI405=-0.763646.
Time 00:00:02
Posted By: jcl

Re: Different values for indicators depending on WFOCycle - 07/20/15 15:37

There is certainly a natural explanation of that phenomenon. Thanks for the script, I'll look into that.
Posted By: jcl

Re: Different values for indicators depending on WFOCycle - 07/20/15 15:46

Ok - I believe you can also quickly find the natural explanation when you refine your print statement a little:

if (Bar == 41712 && !is(LOOKBACK)) {
print(...

laugh
Posted By: GPEngine

Re: Different values for indicators depending on WFOCycle - 07/21/15 04:47

Ah. So smart. laugh

:et me toss you another one. What's happening in this case?
Code:
function run() {
  if (is(INITRUN)) {
    BarPeriod = 60;
    Weekend = 1;
    LookBack = 1001;
    StartDate = 20080101;
    EndDate = 20150301;
    NumWFOCycles = 169;
  }

  vars Price = series(price());

  var uo400 = UO(Price, 400);
  if (Bar == 41712 && !is(LOOKBACK)) {
    print(
      TO_ANY,
      strf("\nAt bar %d in Cycle %d UO400=%f.", Bar, WFOCycle, uo400));
  }
}

Quote:
Made with Gamestudio by oP group 2015
Monte Carlo plugin mounted


wfobug compiling.................
WFO: wfobug 2008..2015
At bar 41712 in Cycle 151 UO400=-0.594472.
At bar 41712 in Cycle 152 UO400=-0.594472.
At bar 41712 in Cycle 153 UO400=-0.594472.
At bar 41712 in Cycle 154 UO400=-0.594471.
At bar 41712 in Cycle 155 UO400=-0.594476.
Time 00:00:03
Posted By: jcl

Re: Different values for indicators depending on WFOCycle - 07/21/15 06:38

Same reason.

Cumulative indicators are affected by the amount of past data. For instance, the EMA will give you a different value dependent on whether you started it one month or two months ago. That's why we wait through the lookback period until we start trading. After that period, the indicator has stabilized and differences are negligible. But they are still there, up to infinity.
© 2024 lite-C Forums