Download MetaTrader 5

Indicator: how to print buffers in the future (negative shifts) ??

To add comments, please log in or register
Joao
50
Joao  

Hi everyone,

Normally when the Buffers are printed, the minimum shift is 0. So you can only see the values from the past till now.

My goal is to print the current value of shift 0 not just now, but till the end of the day.

How can I do that ? It's an easier way to visualize for ex. Support/Resistance etc. My indicator uses an IndexStyle type DRAW_LINE.

Help is appreciated.


Thanks,

Joao

whroeder1
15902
whroeder1  
Joao: not just now, but till the end of the day.
You can't see the future
Victor Ziborov
1866
Victor Ziborov  

Hi Joao. If you know, in the standard Alligator indicator, three MAs are shifted forward by 3, 5 and 8 candles(bars). They programmed it this way:

void OnInit(void)
{
   IndicatorDigits(Digits);
// Setting the line shift when drawing:
   SetIndexShift(0,InpJawsShift); 
   SetIndexShift(1,InpTeethShift); 
   SetIndexShift(2,InpLipsShift); 
// Skip the first bars:
   SetIndexDrawBegin(0,InpJawsShift+InpJawsPeriod); 
   SetIndexDrawBegin(1,InpTeethShift+InpTeethPeriod); 
   SetIndexDrawBegin(2,InpLipsShift+InpLipsPeriod);

Maybe this piece of code will help you.

Joao
50
Joao  
Victor Ziborov:

Hi Joao. If you know, in the standard Alligator indicator, three MAs are shifted forward by 3, 5 and 8 candles(bars). They programmed it this way:

Maybe this piece of code will help you.


Thanks Victor. You are right. Since the index cannot be negative, instead it uses the IndexShift to print the Line in the future. I guess something similar is used also in the " Ichimoku " indicator.

Will test it. Appreciated.

To add comments, please log in or register