
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
No, don't be lazy! Make your code work properly for both types of accounts.
Study how to properly handle the trade functionality on MT5 ...
ok thank you so much and you think that I have to redesign only the trailing stop or all the code logic in order to the hedge account?
We did not see all your code so I don't know. You will have to study the article suggested and then analyse and debug your own code.
When you have some time, could you please check if the trailing stop logic in my code is correct? In the strategy tester, I always get the same error, and I’m not sure if I’m missing something. I’ve also added the logic inside the OnTick function, so if you have time, I’d really appreciate it if you could have a look at that too.
Thanks a lot!
When you have some time, could you please check if the trailing stop logic in my code is correct?
SYMBOL_TRADE_STOPS_LEVEL and SYMBOL_TRADE_FREEZE_LEVEL are int's. Defining them as double's without typecasting might be causing issues.
Symbol Properties - Environment State - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5SYMBOL_TRADE_STOPS_LEVEL is an int.
So I have to change it?
So I have to change it?
I haven't debugged your code but as a matter of good practice, I always typecast when defining a double by an int.
EDIT: Fernando did a deep dive into how to process this as an int in another thread:
Tick size vs Point(), can be a little tricky in Multicurrency EA - Currency Pairs - Expert Advisors and Automated Trading - MQL5 programming forumWhat did I state about "netting" and "hedging" accounts?
What did I recommend (multiple times) you should read and study? ... Orders, Positions and Deals in MetaTrader 5
Why do you refuse to do the necessary research and due diligence?