Shift Indicator in the "start" section

[Deleted]  

Hello,


Normally we use the “SetIndexShift” for determining the position of the indicator in MT4. However, this position is fixed and once the program is started the shift cannot be changed any more.

I want to use an other Indicator to shift the current Indicator. So that must be done in the “Start” section of the program. But here is the question: How can I shift an Indicator in the future or the past in the “start” section of the program of the indicator. Is it possible?


<SNIP>


So anyone has an idea to use the shift function in the “start” section ?


Regards, Osiris_71

 
Osiris_71:

Hello,

Normally we use the “SetIndexShift” for determining the position of the indicator in MT4. However, this position is fixed and once the program is started the shift cannot be changed any more. 

I want to use an other Indicator to shift the current Indicator. So that must be done in the “Start” section of the program. But here is the question: How can I shift an Indicator in the future or the past in the “start” section of the program of the indicator. Is it possible?

<SNIP>

Please edit your post . . . 


Please use this to post code . . . it makes it easier to read.

 
Osiris_71:

Hello,

Normally we use the “SetIndexShift” for determining the position of the indicator in MT4. However, this position is fixed and once the program is started the shift cannot be changed any more.

I want to use an other Indicator to shift the current Indicator. So that must be done in the “Start” section of the program. But here is the question: How can I shift an Indicator in the future or the past in the “start” section of the program of the indicator. Is it possible?

Just add or subtract your shift offset to/from the buffer index . . .
 
  1. Use SRC
  2. Use a maximum future shift value (maxShift) for SetIndexShift.  Add/Sub shift from buffer index, e.g. buffer[i+maxShift-currShift] = value;
  3. Do NOT initialize indicator buffers (per the documentation) they've already be initialized
  4. Do NOT recalculate all bars, use indicatorCounted like the book says
[Deleted]  

Thanks for the advice!

Osiris_71