Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1331
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
Help fix the indicator, it is not displayed in the MT5 terminal, it gives errors during compilation.
Help fix the indicator, it is not displayed in the MT5 terminal, it gives errors when compiling.
The easiest way is to set ArraySetAsSeries(Open,true) ; ArraySetAsSeries(Close,true) ; and so on in OnCalculate at the very beginning of all arrays.
this is the traditional surprise on the face of it: in 5 the default indexing directions are different than in 4.
indicator does not use buffers, it just builds graph objects - after start press Ctrl+B and see where it put them there
Digging through documentation and forum ...
How to make variables of pointer type global [in the example var], if they are created in OnInit() by string:
CObj* var=new CObj(p1,p2,p3);
and the number of objects and constructor parameters are not known in advance and are calculated in OnInit() ?
Digging through documentation and forum ...
How to make variables of pointer type global, if they are created in OnInit():
and the number of objects and constructor parameters are not known in advance and are calculated in OnInit() ?
I don't understand anything, but pass an array of pointers CArrayObj to the objects created in OnInit()
Nothing understood, but pass an array of CArrayObj pointers to objects created in OnInit()
Artem, thank you for your reply.
I apologize for unclear question)
There are three global variables of pointer type to an object in Expert Advisor: var1, var2, var3.
Before executing OnInit(), it is unknown whether all these variables will be needed (this is related to timeframes), also unknown are the parameters for constructors, which will initialize objects.
How to create such variables in OnInit() so that they are global?
Artem, thank you for your reply.
I apologize for unclear question)
Three global variables of pointer type can be used in EA: var1, var2, var3.
Before executing OnInit(), it is unknown whether all these variables will be needed (this is related to timeframes), also unknown are the parameters for constructors that will initialize objects.
How to create such variables in OnInit(), so that they are global?
I don't know what magic constructor you have there, which contains only unknowns :)
You don't have to declare objects as instances beforehand.
You need to declare one array CArrayObj. Your objects themselves must be descendants of CObject.
Create your object by new and add a pointer to it to the list.
Create the next object and add it to the list, and so on.
This list - a pointer to it (and the list is declared globally) - is passed to your constructors.
But here's how you were going to do constructors with arguments unknown in advance - I don't understand it a bit. Try to clarify it
But here's how you're going to make constructors with arguments unknown in advance - I'm a bit confused here. Try to explain it
Creation of CIsNewBar typeobjects for each used timeframe for each symbol.
HH.There was a problem with theCArrayObj class: when accessing elements of typeCArrayObj* ArrayObj. At(0), the class members of the object which is At(0) are unavailable, although these class members are exactly public, i.e. a construct of type ArrayObj.At(0).method(parameter) doesn't work.Characters are specified by one line with separators in input parameter, so you can't create all objects beforehand before OnInit().
I.e. the first unknown constructor parameter is a symbol.
The second unknown constructor parameter is a timeframe, as each symbol will have its own set of timeframes, similarly passed by a string with delimiters in the input-parameter.
And I'm also afraid to use these libraries, maybe something will change in them when updating the terminal, and my Expert Advisor will suddenly stop working...
Create CIsNewBar typeobjects for each timeframe used for each symbol.
P.S.There was a problem with theCArrayObj class: when accessing elements of typeCArrayObj* ArrayObj. At(0), the class members of the object that At(0) is not available, although these class members are exactly public, i.e. a construct like ArrayObj.At(0).method(parameter) doesn't work.Characters are specified by one line with separators in input parameter, so it is impossible to create all objects before OnInit() in advance.
I.e. the first unknown constructor parameter is a symbol.
The second unknown constructor parameter is a timeframe, as each symbol will have its own set of timeframes, similarly passed by a string with delimiters in the input-parameter.
And I'm also afraid to use these libraries, maybe something will change in them when updating the terminal, and my Expert Advisor will suddenly stop working...
It's all wrong somehow...
Write in simple words what you want to do. Without any reference to your attempts to code it all.
It just doesn't feel right...
Write in simple words what you want to do. Without any mention of your attempts to code it all.
Multicurrency Expert Advisor.
The list of symbols is specified via input parameter, the string with the delimiter "AUDUSD,EURUSD,GBPUSD...", the number of symbols is not predefined.
For each symbol, there are two timeframes, on which its "own" trading system works.
Correspondingly, there are two input parameters, strings delimited by : short timeframe for a respective symbol "M1,M30,M5..."
a long timeframe for the respective symbol "H1,D1,H4.."
I.e. for AUDUSD the timeframes are M1 and H1, for EURUSD M30 and D1, etc.
In OnTick(), for each symbol, it is necessary to track the appearance of a new bar on both (short and long) timeframes to make trading decisions.
I tried to write it as simply as possible)
Multicurrency Expert Advisor.
The list of symbols is set via input parameter, a string with separator "AUDUSD,EURUSD,GBPUSD...", the number of symbols is not predefined.
For each symbol, there are two timeframes, on which its "own" trading system works.
Correspondingly, there are two input parameters, strings delimited by : short timeframe for a respective symbol "M1,M30,M5..."
a long timeframe for the respective symbol "H1,D1,H4.."
I.e. for AUDUSD the timeframes are M1 and H1, for EURUSD M30 and D1, etc.
In OnTick(), for each symbol, it is necessary to track the appearance of a new bar on both (short and long) timeframes to make trading decisions.
I tried to write it in the easiest way possible.)
Do you already have a class for a new bar?
And what exactly do the input parameters look like?