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
Are you a coder?
Check if the order type ( ORDER_TYPE_BUY_STOP and ORDER_TYPE_SELL_STOP ) is compatible with the current market conditions. For example, if the market is already above the EMA, sending a BUY_STOP order will not be valid
Make sure that the price calculated for the pending orders ( request.price ) is valid and within the acceptable range. If the calculated price is too far from the current market price, the broker may reject the order.
Consider the current spread and slippage settings. If the spread is too large or slippage is significant, it may affect the validity of pending orders. Improve error handling to provide more detailed information about any errors that occur during order sending or processing.
Here are some adjustments i made for you
Thank you very much sir! I will definitely work on improving my coding , this was basically my first code, from a trade idea I would like to try.. Thanks again :)
Check if the order type ( ORDER_TYPE_BUY_STOP and ORDER_TYPE_SELL_STOP ) is compatible with the current market conditions. For example, if the market is already above the EMA, sending a BUY_STOP order will not be valid
Make sure that the price calculated for the pending orders ( request.price ) is valid and within the acceptable range. If the calculated price is too far from the current market price, the broker may reject the order.
Consider the current spread and slippage settings. If the spread is too large or slippage is significant, it may affect the validity of pending orders. Improve error handling to provide more detailed information about any errors that occur during order sending or processing.
Here are some adjustments i made for you
When I try to use the strategy tester, the EA is not able to open trades, it gives erros such as
"2024.04.11 11:53:22.335 2024.01.04 13:45:00 OrderSend error 4756
2024.04.11 11:53:22.374 2024.01.04 13:50:00 Alert: Price crossed below EMA
2024.04.11 11:53:22.374 2024.01.04 13:50:00 failed prices for EURUSD 0.1 [Invalid request]
2024.04.11 11:53:22.374 2024.01.04 13:50:00 OrderSend error 4756
2024.04.11 11:53:22.410 2024.01.04 13:55:00 Alert: Price crossed below EMA
2024.04.11 11:53:22.410 2024.01.04 13:55:00 failed prices for EURUSD 0.1 [Invalid request]
2024.04.11 11:53:22.410 2024.01.04 13:55:00 OrderSend error 4756
2024.04.11 11:53:22.490 2024.01.04 14:00:00 Alert: Price crossed below EMA
2024.04.11 11:53:22.490 2024.01.04 14:00:00 failed prices for EURUSD 0.1 [Invalid request]
2024.04.11 11:53:22.490 2024.01.04 14:00:00 OrderSend error 4756"
I don't understand where the problem still is
When I try to use the strategy tester, the EA is not able to open trades, it gives erros such as
"2024.04.11 11:53:22.335 2024.01.04 13:45:00 OrderSend error 4756
2024.04.11 11:53:22.374 2024.01.04 13:50:00 Alert: Price crossed below EMA
2024.04.11 11:53:22.374 2024.01.04 13:50:00 failed prices for EURUSD 0.1 [Invalid request]
2024.04.11 11:53:22.374 2024.01.04 13:50:00 OrderSend error 4756
2024.04.11 11:53:22.410 2024.01.04 13:55:00 Alert: Price crossed below EMA
2024.04.11 11:53:22.410 2024.01.04 13:55:00 failed prices for EURUSD 0.1 [Invalid request]
2024.04.11 11:53:22.410 2024.01.04 13:55:00 OrderSend error 4756
2024.04.11 11:53:22.490 2024.01.04 14:00:00 Alert: Price crossed below EMA
2024.04.11 11:53:22.490 2024.01.04 14:00:00 failed prices for EURUSD 0.1 [Invalid request
2024.04.11 11:53:22.490 2024.01.04 14:00:00 OrderSend error 4756"
I don't understand where the problem still is
Yes, you are right, even though it compiles without errors, you will still encounter such errors as there are multiple fixes that needs to be done in your code. This would take way more time to fix. I would suggest that you work through it, as its the best way to learn. look at the (request.price), (request.deviation), NormalizeDouble, SymbolInfoDouble, and your arrays[]
Yes, you are right, even though it compiles without errors, you will still encounter such errors as there are multiple fixes that needs to be done in your code. This would take way more time to fix. I would suggest that you work through it, as its the best way to learn. look at the (request.price), (request.deviation), NormalizeDouble, SymbolInfoDouble, and your arrays[]
Hello again, after working through the the code I was able to make it execute trades. The only pronlem is that it's not opening only one trade per bar close, but it's opening multiple orders after the condition has been met. Here is the updated code:
Hello again, after working through the the code I was able to make it execute trades. The only pronlem is that it's not opening only one trade per bar close, but it's opening multiple orders after the condition has been met. Here is the updated code: