Hi maestrade,
This would not work. If you are coding a formula it will only return a single value so you would just reference as normal variable not as an array ie[]. If you want to return an array as your formula you would need to create a function or loop to build the array, then you could reference it as an array. Here is an example of a funciton
This would not work. If you are coding a formula it will only return a single value so you would just reference as normal variable not as an array ie[]. If you want to return an array as your formula you would need to create a function or loop to build the array, then you could reference it as an array. Here is an example of a funciton
bool GetArray( double& anArray[]) { for (i = bars; i >= 0; i--) { anArray[i] = some formula; } } // now you could call double myArray[100]; GetArray(myArray); double val = myArray[1];
This code would still need work as you would need to make sure that the array is big enough or add resizing code but it should give you the basic idea.
Pedro
Hello Maestrade,
Try this
Try this
double var; double var1; var1 = var; var = Formula;
Thanks
EK
At this step , I have :
double var
double var1
var = Formula;
now I want to have
var1 = previous value of Formula
If Formula was an Array such as High I would just write
var1 = High[1]
But writing
var1 = Formula[1]
is not recognized.
who could help ? Thanks
In general, the question is : how to transform the value of a formula into an Array
double var
double var1
var = Formula;
now I want to have
var1 = previous value of Formula
If Formula was an Array such as High I would just write
var1 = High[1]
But writing
var1 = Formula[1]
is not recognized.
who could help ? Thanks
In general, the question is : how to transform the value of a formula into an Array
Pedro,
Thanks for your time
Unfortunately your suggestion does not work at all. First, the way you define the function is not proper.
If you think it works, could you write the code for MACD using the sample given by Metaquotes
How to get the previous value of the MACD or better the value of the MACD n bars before ?
Thanks for your time
Unfortunately your suggestion does not work at all. First, the way you define the function is not proper.
If you think it works, could you write the code for MACD using the sample given by Metaquotes
How to get the previous value of the MACD or better the value of the MACD n bars before ?

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
double var
double var1
var = Formula;
now I want to have
var1 = previous value of Formula
If Formula was an Array such as High I would just write
var1 = High[1]
But writing
var1 = Formula[1]
is not recognized.
who could help ? Thanks
In general, the question is : how to transform the value of a formula into an Array