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
You make one and the same annoying mistake: you mix PENDIND ORDERS and POSITIONS into one heap.
Forget the word "order" and never use it again. Now your main word is "position". Use only the word "position" and, accordingly, functions that work with "positions".Thank you for pointing that out. So, is it possible for an EA to open two positions for each currency pair in say five different currency pairs? if yes, please share with me how to do it.
Thank you for pointing that out. So, is it possible for an EA to open two positions for each currency pair in say five different currency pairs? if yes, please share with me how to do it.
First, decide: how to choose these currency pairs? Hard to set in the input parameters? Or set four parameters - each will have its own symbol, or set all four in one parameter, or ...
First, decide: how to choose these currency pairs? Hard to set in the input parameters? Or set four parameters - each will have its own symbol, or set all four in one parameter, or ...
I am okay with having individual EA for each pair. The hard part is calling the PositionsTotal()<2 for each EA without this affecting what the other EAs are doing.
I have been searching how to proceed beyond this point but I cant find any snippet on the same.
I am okay with having individual EA for each pair. The hard part is calling the PositionsTotal()<2 for each EA without this affecting what the other EAs are doing.
I have been searching how to proceed beyond this point but I cant find any snippet on the same.
I showed the solution - how to get the number of BUY positions and the number of SELL positions at once for all symbols in one function:
Forum on trading, automated trading systems and testing trading strategies
How to start with MQL5
Vladimir Karputov, 2021.03.21 16:04
Calculate positions for all symbols
Code: 'Calculate positions for all symbols.mq5
Objective: Several positions are open in the market. You need to get the number of positions (both BUY and SELL) for each symbol.
Suggested solution: the 'STRUCT_CALCULATE_POSITIONS' structure
is created and this structure is filled in the 'CalculateAllPositions'
function.
For example, a test advisor has been created: first, it opens four positions and then (after calling 'CalculateAllPositions') unpacks the 'STRUCT_CALCULATE_POSITIONS' structure'
Result:
I showed the solution - how to get the number of BUY positions and the number of SELL positions at once for all symbols in one function:
Thank you for guiding me. Let me work out how to incorporate this code to what I posted.
I showed the solution - how to get the number of BUY positions and the number of SELL positions at once for all symbols in one function:
I have tried working around this structure but I haven't succeeded. See the sample screenshot
I have tried working around this structure but I haven't succeeded. See the sample screenshot
You inattentively looked at the example to which I gave the link (I think that you did not even follow the link). Follow the link and see the code of the Expert Advisor in the example.
Hi,
I have tried following the examples as given but I am missing a step and therefore, am not getting it right. I really need this to open two positions per currency pair. The
Suggested solution: the 'STRUCT_CALCULATE_POSITIONS' structure is a bit tough for me to master right now. I am learning MT5 but I have started with areas that are simpler to grasp and comprehend.Hi,
I have tried following the examples as given but I am missing a step and therefore, am not getting it right. I really need this to open two positions per currency pair. The
Suggested solution: the 'STRUCT_CALCULATE_POSITIONS' structure is a bit tough for me to master right now. I am learning MT5 but I have started with areas that are simpler to grasp and comprehend.I finally managed to have just one position using
Now let me engage in mastering 'STRUCT_CALCULATE_POSITIONS' to have two positions per pair.
I finally managed to have just one position using
Now let me engage in mastering ' STRUCT_CALCULATE_POSITIONS ' to have two positions per pair.
An example for you: No more than N positions for each symbol Simple