I think the problem lies in the openposition function. I changed the parameter type to
void OpenPosition(ENUM_ORDER_TYPE type)
and then changed your filling to
request.type_filling = ORDER_FILLING_FOK; And then I managed to get some trades off from my tester.
Alternatively, I suggest you utilized the Trade.mqh file that is in the MetaEditor Include file, it saves a lot of work in terms of opening different position types.
You can refer to this discussion https://www.mql5.com/en/forum/338486
How to useTrade.mqh library in mql5?
- 2020.04.24
- Yule Msee
- www.mql5.com
#include CTrade trade; I am new to mql. I have seen the code above in *** but there are parts I do not understand...
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
Hi everyone,
I'm new to programming in MQL5, and I'm trying to create a simple trading robot for the Brazilian market (mini index). My strategy is straightforward, but I’ve been running into issues where the robot doesn't open orders even when the conditions are met. I’d appreciate some guidance!
Here’s the strategy:
Buy conditions:
Sell conditions:
Extra Rules:
Indicator values:
The Problem:
When I run the robot, no orders are being executed, even though the conditions appear to be met. I’ve double-checked my code and the conditions, but I can’t figure out what’s wrong.
Has anyone encountered a similar issue or have tips on debugging this kind of problem? Could it be an issue with how I’m checking the conditions or something else?
Here is the code (comments are in portuguese lmk if you need translation):