Multitimeframe indicator - page 2

 
Arthur Singer:
What I want is that if two MAs cross on M1,M5,M15,M30 and H1, then this should be represented in the form of arrows on the H1 chart.

Right, in this case your M1, M5, M15 and M30 must not make use of indicator buffers. Use dynamic arrays instead, and size them according to the number of bars these timeframes have. You have to access each of them with different index (i.e. cannot use the same 'i' for all timeframes, for reasons already explained). Also, your indicator should check that the chart's timeframe is H1, and not work when it is anything else (i would want to code it for any timeframe, but i suppose that is not your priority for now).

Within your 'for' loop, if you want to determine whether M1 crossed, you'll have to decide how you want it done - do you want to check through ALL M1 bars during that H1 bar (which will likely give many crosses in both directions and you can decide based on crossing prices, by simple counts, etc.)? Or just first and last M1 bars? whichever the case, you'll have to use iBarShift and i to obtain the right bar index for M1. Do the same for M5, M15, and M30. Once done and you've decided to draw an arrow, then you access H1 buffer with i.


As others have said, there are big changes to be made to your existing codes (hence 'not simple'). But I'm all supportive if you're keen to work on it yourself and learn along the way - I can guide you along. 

Reason: