
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
im using multiple symbols and timeframes through loops, declaring handles in OnInit will not work without looping
This is your delusion. Work by the rules - there is no problem with multi-symbol trading. Until you fix the code, don't try asking questions.
im using multiple symbols and timeframes through loops, declaring handles in OnInit will not work without looping
Do not double post!
I have deleted your duplicated topic.
Fix your code as Vladimir has already said and only create handles in OnInit().
The code that you are attempting to do is way too complicated for a beginner.
You are making the common beginners' error of using _Point when dealing with multiple symbols.
So if the EA is placing a trade on a Japanese 3 digit symbol and the chart symbol is 5 digits, obviously the TP and SL will be 100 times smaller than you expect.
Will replacing _Point with this function work properly ?
Of course not.
If _Point is incorrect for the non chart symbol, _Digits wont be correct either.
You seem to have deleted your code, but I am sure that you got the correct value elsewhere in your code.
When writing a multi-symbol Expert Advisor, one should remember that the properties of each symbol can vary greatly - starting from the number of symbols after zero, and by the price.
The most simple example of Multi-symbol Two iMA Simple :
Trading strategy
The strategy itself is quite trivial - it is the intersection of two iMAs (Moving Average, MA). But the implementation deserves a separate description. This is a multi-symbol Expert Advisor that trades two symbols at once. Executed as a single file. All trading code is in the ' CTradingEngine31 ' class, the main advisor in the initialization block creates two instances of advisors - one for the ' Symbol 0 ' symbol and one for the ' Symbol 1 ' symbol. After that, the main advisor needs to call OnTick and OnTradeTransaction in both instances.
The EA itself is simplified as much as possible: there is no Stop Loss, no Tape Profit, no Trailing. The appearance of any trading signal means first unconditional closing of a position and immediately opening a new position. The search for a signal only at the moment of the birth of a new bar, which means that the intersection is searched for at bar # 1, not at the current one. Position volume (' Number of minimum lots ') is set as the number of minimum lots.
Trading signals:
Features:
Now in more detail on each group of parameters:
Trading settings:
' Working timeframe ' - working timeframe. Timeframe on which indicators are created and on which a new bar is searched for.
Position size management (lot calculation)
The lot is specified as the number of minimum lots.
Additional features:
' Print log ' prints extended logging of all operations. The ' Freeze and StopsLevels Coefficient ' parameter sets the coefficient for stop and freeze levels for cases when these levels for a symbol are equal to zero. The recommended value is '3'.
Hi Vladimir.
Thanks for your hard work.
I'm trying to get this MQL4 code back to MQL5. With this code, I get open price of last current position.
I wrote this code in MQL5 and unfortunately it does not work. Can you help me?Hi Vladimir .
Thanks for your hard works.
I'm trying to get this MQL4 code back to MQL5. With this code, I get open price of last positions.
I wrote this code in MQL5 and unfortunately it does not work. Can you help me?I love working with OnTradeTransaction. This is where I get all the information I need about the last trade.
I love working with OnTradeTransaction. This is where I get all the information I need about the last trade.
How can I use OnTradeTransactionfor catch OpenPrice of last current position?
Example:
Example:
thank you.
But you brought this code in previous pages.
Oh, maybe I didnt fully explain what I meant. I dont search the history for closed positions.
I want to find the openprice of the last position that is still open and take another position or positions according to its price.