Issues with different timeframes

Moderator: admin

Issues with different timeframes

Postby Magoth » Tue Sep 12, 2017 5:30 pm

Hello team,

in a custom indicator/strategy, I'm using two differents timeframes.

1/ the first one is the one used by the actual candles => M1.
2/ the second one is used by Ichimoku => M5

Both are working ok. My issue is when I want to make them work together.

As an example, I would like to have a signal when my candle (M1) crosses the Kijun (M5).

My issue is that the Kijun seems to be calculated after 5xM1 Candles and not after the last one. Yes, I have to call ICH.TL[bSource5:size()-1] (bSource5 being the m5 stream) instead of ICH.TL[period] to not have an out of index error.

So if the kijun is all flat, it works because ICH.TL[bSource5:size()-1] gives me the value of the Kijun given by the last M5 Kijun calculation.
But if we have a powerfull ascending/descending candle between 2 Kijun calculation, we miss it.

I don't see how I can do it, if it's even possible. I can calculate the Kijun update just after the close of the M1 Candle but maybe there is an easier solution.

Any help would be greatly appreciated,
Posts: 8
Joined: Fri Sep 01, 2017 6:13 pm

Re: Issues with different timeframes

Postby Apprentice » Tue Sep 19, 2017 4:17 am

Can you share your code?
Will fix it for you.
User avatar
FXCodeBase: Confirmed User
Posts: 20336
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 4 guests