Download MetaTrader 5
To add comments, please log in or register
Find out the latest MQL5.community news!
Toast
220
Toast 2014.02.14 20:56 

Hello,

I'm struggling to get my head around the following:


#property indicator_buffers 5

double Buff1[];

// ---

int init()

SetIndexBuffer(4, Buff1);

// ---

int start()

CVF()

// ---

void CVF()

double Var1 = 1.33;

Buff1[i] = Var1;

Print("Debug " + Var1 + " - " + Buff[i] + " - " + i);

This will return something like:

Debug 1.33 - 0 - 197

So why isn't Buff[i] taking the value of Var1?

Any pointers greatly appreciated!

Alain Verleyen
Moderator
28672
Alain Verleyen 2014.02.14 21:03  
toast:

Hello,

I'm struggling to get my head around the following:


This will return something like:

So why isn't Buff[i] taking the value of Var1?

Any pointers greatly appreciated!

void CVF()

double Var1 = 1.33;

Buff1[i] = Var1;

Print("Debug " + Var1 + " - " + Buff[i] + " - " + i);
whroeder1
13644
whroeder1 2014.02.14 21:14  
int init()

SetIndexBuffer(4, Buff1);
Start with getting your code to compile. ^ that won't.
Toast
220
Toast 2014.02.14 21:17  
angevoyageur:



Sorry, a typo in what I posted on here. They match in the code (and compile without error; there is no array called Buff[])
Alain Verleyen
Moderator
28672
Alain Verleyen 2014.02.14 21:18  
toast:

Sorry, a typo in what I posted on here. They match in the code (and compile without error; there is no array called Buff[])
Follow WHRoeder advice, please post code that compiles if you need help.
Toast
220
Toast 2014.02.14 21:22  
WHRoeder:
Start with getting your code to compile. ^ that won't.


It compiles without error or warning (on both old build and new build). There is nearly 1000 lines of code, so I've snipped the relevant parts for simplicity which may be causing confusion. I was merely trying to indicate which sections the various bits came from.


Toast
220
Toast 2014.02.14 21:38  
toast:


It compiles without error or warning (on both old build and new build). There is nearly 1000 lines of code, so I've snipped the relevant parts for simplicity which may be causing confusion. I was merely trying to indicate which sections the various bits came from.




My stupid mistake.. overlooked increasing the IndicatorBuffers from earlier on.

But it didn't throw up any compile errors. Odd!

Thanks anyway.

/
To add comments, please log in or register