[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 701
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
your dog in passing parameters to the function, if you pass it as SaveDataIND(double TempIND[])
double TempIND[ ] is actually a new array for the function, but without the right to change parameters, try SaveDataIND(double & TempIND[])
Is it possible to make it possible to pass in a function which indicator to use, so that in the string
not a specific indicator but passed as a function parameter?
Well, make a switch or something and write out your possible indictors by assigning indices to them.
Is it possible to make it possible to pass in a function which indicator to use, so that in the string
not a specific indicator but passed as a function parameter?
But what's the point? Such actions are not usually performed - usually the data are sent to the function, and the calling function prepares the data/array
it seems that your construction ArrayResize(TempIND,nBars); is not correct, at least in other programming languages, the compiler would not miss it since you have double TempIND[50]; - i.e. the array is declared as static and should be dynamic (i.e. without dimensions) - double TempIND[];
ZS: and confusion with the names in the variables in the function - do not forget that if there is a global variable (global in the body of the EA), the variable declared within the function with the same name will be completely different:
this is usually called the scope of variables - rename what is in the function its name i.e. void SaveDataIND(double myTempIND[], int nBars) - less confusion will beWhere is Lot initialized?
Then only after checking for lots either change Lots_New as written before, or assign it value = Lot;
Thank you! It's all working!
But what is the point? Such actions are not usually performed - the data are usually sent to the function, and the calling function prepares the data/array
You seem to have the wrong ArrayResize(TempIND,nBars); construction, at least in other programming languages the compiler would not miss it because you have double TempIND[50]; - i.e. the array is declared as static, while it should be dynamic (i.e. without dimensionality) - double TempIND[];
ZS: and confusion with the names in the variables in the function - do not forget that if there is a global variable (global in the body of the EA), the variable declared within the function with the same name will be completely different:
this is usually called scope of variables - rename things in function their names, i.e. void SaveDataIND(double myTempIND[], int nBars) - less confusion will be1. So, Igor, should I write my own absolutely identical function for each indicator?
2. Thanks, I fixed it just in case...
3. it doesn't confuse me - I can see which array is being used and where, it's somehow easier for me to reverse it, but when I have a lot of names, I'll definitely get confused... Although... I should probably get used to spelling it right...
Thank you! It's all working!
Check the opening of a new candle. If new, you open, if old, you don't...
Check for the opening of a new candle. If new, you open, if old, you don't...
static int time = Time[0];
if (time < Time[0]){
// old candle
} else {
// new candle
time = Time[0];
}