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
***
" A position cannot be reversed in the hedging system. In this case, the current position is closed and a new one with the remaining volume is opened. "Is there any way to disable it so that I can simultaneously hold open Buy & Sell positions on a currency pair?
I think you need to ask your question on the forum - here is a thread for those who ask questions about PROGRAMMING in MQL5, but you generally have zero knowledge. You manage to misinterpret the documentation. Please do not post any more in this thread - this thread is for those who program.
Example - there is a line (Horizontal line or Trend line) and you need to track when the price crosses the line.
To do this, you first need to get the price of the line - but first of all we check if there is an object with that name at all? If there is such an object, then, depending on the type of object, we get the price:
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:
No more than N positions for each symbol Simple
Another example of how to use the 'STRUCT_CALCULATE_POSITIONS' structure. The EA opens a position on a new bar. There is no Stop Loss or Take Profit. Nobody closes open positions - this is a demonstration of how to use and how to work with the structure 'STRUCT_CALCULATE_POSITIONS'.
Hello
I didn't understand anything at all. What's the top? What's the bottom? Ask your question in the form of a picture.
Search for the most recent position and display information about it.
The code: 'Last position info.mq5'
Result:
Working with the OBJ_VLINE graphic object
Task: find the OBJ_VLINE object and get the time of the object.
There are several stages of checks and protections in the code. Stage one - searching for an object by name. Stage two - we get the type of object. The third stage is without checking, we just get the time of the object.
The handle MUST ONLY be created ONCE. The most convenient place to create an identifier is OnInit ().
Is it possible to move the identifier part of the OnInit () section to the function, whose call is made in OnInit () ? Was there a problem?
You can't. Why? Because you will start calling this function from OnTick.