Chikou does not shift 26 bars backward

Posted By: marr

Chikou does not shift 26 bars backward - 07/26/19 07:15

I get this weird behavior where chikou does not lag 26 price behind when running on a live account but it works properly when running in backtest

Here is the snippet of my Ichimoku

Code
Ichimoku(9, 26, 53, 0);
vars Chikou = series(Chikou(-26));


As you can see the shift of chikou is set to -26 since I used PEEK flag because on the manual the chikou description:

Quote

The traditional Ichimoku requires a future peeking Chikou line (Shift = -26); this can be achieved by setting Shift = 0 and moving the rest of the Ichimoku forward by Offset = 26.


by setting the Shift = 0 of chikou the line will just plot on the priceClose() since the souce code of chikou from indicators.c is a priceClose(Shift) so following the description above would mess up the chart.
I compared the chart from Zorro and TWS and everything match except the Chikou line

Did i miss anything using the Chikou?

Attached picture backtest.png
Attached picture chikou live.png
Posted By: Petra

Re: Chikou does not shift 26 bars backward - 07/26/19 10:20

Chikou is simply the close price just with a fancy name. You cannot shift an indicator backwards in live trading, only forwards. I dont know anyway why Zorro has such nonsense indicators in its library. Another advice, dont give a variable the same name as a function.
Posted By: marr

Re: Chikou does not shift 26 bars backward - 07/26/19 12:50

can i shift the price backward in live trade? i tried a workaround where:

Code
vars Close = series(priceClose(26));


when i plot the Lag it shows a shift forward the price, I should expect backward shift since series starts on the last 26 bar of the price. Did i miss something?
Posted By: Petra

Re: Chikou does not shift 26 bars backward - 07/26/19 13:06

You can shift anything forwards, but not backwards because that would be future peeking. priceClose(26) is forwards, -26 would be backwards.

Posted By: marr

Re: Chikou does not shift 26 bars backward - 07/26/19 13:35

is this the right way to do the ichimoku?

Code
Ichimoku(9, 26, 53, 26);

vars Lagging_Span = series(Chikou(0));

vars Close = series(priceClose(26));


I shifted forward the ichimoku and price then the chikou will be 26 bars behind the price
when I plot the result, the trades are triggered on the chikou span

or im wrong?
© 2024 lite-C Forums