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
According to what I read, all forms of immediate execution orders require the type_filling field to be set.
Trade Request Structure - Data Structures - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Order Properties - Trade Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Thanks for the tips, the code has been in progress for 5 days, I have solved the problem with not setting any trades, I just want to make small updates :)
You need to make a new iteration
this code is not going to correctly calculate ATR
https://www.mql5.com/en/docs/indicators/iatr
Return Value
Returns the handle of a specified technical indicator
It returns the handle which is a code, and does not return ATR value
2. Improvements: - In ExecuteTrade function: checking for open position using PositionSelect(_Symbol) is not quite correct, because this function returns true if there is any position on a symbol, but not necessarily that it is open at the moment. It is better to use a loop through all positions and check magic number and symbol. - Also, in ExecuteTrade we do not check if there is already an open position, so we can open multiple positions. We need to limit the opening to only one position (or use magic number to identify our positions). - In the OptimiseParameters: function, the movingAverage calculation can be replaced by the built-in iMA function. - In the SimulatePrice function: using MathRand() may not be the best for Monte Carlo, it is better to use normal distribution