
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
Well, I will stop to ask chunk of code one by one, MT4 requires a valid price for OrderSend() even on Market execution, you could have to use RefreshRates().
Ok, I'll look into that. I've only had trouble with opening an order this one time though, would RefreshRates() be something that might be useful specifically in volatile conditions?
For what it's worth, I'm working off of WHRoeder's entry EA. I've modified it to create orders when I get a breakout at bar open and reworked the GUI, but I've left all of the price calculation, order opening, and lot size calculation stuff alone.
https://www.mql5.com/en/forum/63949/page8#comment_27751788
Ok, I'll look into that. I've only had trouble with opening an order this one time though, would RefreshRates() be something that might be useful specifically in volatile conditions?
Possibly, yes.
Possibly, yes.
Oh, I see that RefreshRates() has already been included:
Any other options would be appreciated. I'd very much like to have my orders open in the future, even with some slippage!
Oh, I see that RefreshRates() has already been included:
This is a wrong usage of RefreshRates() !
Once again : the price used in OrderSend() must be the LAST available price for the symbol, that means it must be set (Refreshed) just before OrderSend(), specially when used within a loop.
In your code :
1. where is set currentPrice ?
2. Where is it refreshed ?
OrderSend() can take time to executed, the ask/bid can change in the meantime.
This is a wrong usage of RefreshRates() !
Once again : the price used in OrderSend() must be the LAST available price for the symbol, that means it must be set (Refreshed) just before OrderSend(), specially when used within a loop.
In your code :
1. where is set currentPrice ?
2. Where is it refreshed ?
OrderSend() can take time to executed, the ask/bid can change in the meantime.
currentPrice is implemented in a way I'm still chasing down. Your input is having me realize I may not need it at all, or at least in the way it's built in.
I changed the function so it's grabbing bid/ask and refreshing rates within the loop. How is this looking to you?
currentPrice is implemented in a way I'm still chasing down. Your input is having me realize I may not need it at all, or at least in the way it's built in.
I changed the function so it's grabbing bid/ask and refreshing rates within the loop. How is this looking to you?
It looks better. Keep us posted.
Will do, thank you so much for the help!