Hello Forum, good day.
I'm staring with MQL5 and tried to place a pending order, but when I ran it in the strategy tester I couldn't make any buy/sell operations. What I'm trying to do is to place a buy stop order if +DI > -DI and a sell stop order if +DI < -DI. I also tried to buy if close price < open price, and sell if close price > open price but couldn't make it.
Any help will be really appreciated, here is the code:
Regards and thank you in advance,
codeMolecules
Why do you want to place a pending order at market price ?
Hello angevoyageur,
Sorry, I forgot to edit/format the code I posted, thanks for editing.
I started this code as a TRADE_ACTION_DEAL and then started to modify it to make it a TRADE_ACTION_PENDING order and tried to use NormalizeDouble(open[0], _Digits); to get the latest open price but didn't work, so I did some ctrl+z to return just after I started modifying it to a pending order and when I pasted the code on the forum I had returned to request.price = SymbolInfoDouble(_Symbol,SYMBOL_ASK); sorry, my bad.
I'm currently searching in the forum and found this: OrderGetDouble(ORDER_PRICE_OPEN). Is this the correct way to do it? Or should I try it with: MqlRates rates[]; and then request.price = NormalizeDouble(rates[0].open, _Digits);?
Regards and thank you in advance,
codeMolecules
Hello angevoyageur,
Sorry, I forgot to edit/format the code I posted, thanks for editing.
I started this code as a TRADE_ACTION_DEAL and then started to modify it to make it a TRADE_ACTION_PENDING order and tried to use NormalizeDouble(open[0], _Digits); to get the latest open price but didn't work, so I did some ctrl+z to return just after I started modifying it to a pending order and when I pasted the code on the forum I had returned to request.price = SymbolInfoDouble(_Symbol,SYMBOL_ASK); sorry, my bad.
I'm currently searching in the forum and found this: OrderGetDouble(ORDER_PRICE_OPEN). Is this the correct way to do it? Or should I try it with: MqlRates rates[]; and then request.price = NormalizeDouble(rates[0].open, _Digits);?
Regards and thank you in advance,
codeMolecules
Thanks for your response angevoyageur. I'll try it with CopyRates.
Regards and thank you,
codeMolecules

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello Forum, good day.
I'm staring with MQL5 and tried to place a pending order, but when I ran it in the strategy tester I couldn't make any buy/sell operations. What I'm trying to do is to place a buy stop order if +DI > -DI and a sell stop order if +DI < -DI. I also tried to buy if close price < open price, and sell if close price > open price but couldn't make it.
Any help will be really appreciated, here is the code:
Regards and thank you in advance,
codeMolecules