Hi
I am learning how to program expert advisors. So far, it worked quite well.
Last week, I started to create programs including orders.
First I wanted to test my program in the strategy tester which is included in MT4. I could place Buy orders including SL and TP which worked fine. But the program also included Sell orders and OrderClose commands which both did not work.
To find the root cause, I created a small program only including a Buy order with SL and TP. First I ran that program with the strategy tester and set the SL and TP to a distance never to be reached in the specified timeframe. During the test, the EA placed the buy order at the beginning and that order was closed after the test, then I modified the SL an TP to be reached, which also worked. Following you can find my simple program:
Afterwards I modified the program to place Sell orders. Which did not work at all in the strategy tester. It did not open any orders. Could you please help me to solve this issue? I have already spent many hours trying to solve this problem, googled it and read in the manual. But I could not find a solution. I also tried these small programs in my testaccount ( not the strategy tester), but I got the same result. The modification I made was only to the OrderSend command according to the following line:
For the strategy tester I used the following settings:
Symbol: EURUSD
Period: M15
Spread: 30
Model: every tick
Optimization: off
Timeframe: 2018.01.04 to 2018.01.05
For the EA I used the following settingsö.-:
Balance: 10000 USD
Positions: Long&Short
Best regards
Dominik Gächter
Your stop loss and take profit are not good when you try to open sell - correct that and it will work
Hi Mladen Rakic
Thank you for your reply.
This was exactly the problem. Now I also solved the problem with the CloseOrder. I mixed up Bid and Ask in the command.
I have spent at least 2 hours on this issue :(
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
I am learning how to program expert advisors. So far, it worked quite well.
Last week, I started to create programs including orders.
First I wanted to test my program in the strategy tester which is included in MT4. I could place Buy orders including SL and TP which worked fine. But the program also included Sell orders and OrderClose commands which both did not work.
To find the root cause, I created a small program only including a Buy order with SL and TP. First I ran that program with the strategy tester and set the SL and TP to a distance never to be reached in the specified timeframe. During the test, the EA placed the buy order at the beginning and that order was closed after the test, then I modified the SL an TP to be reached, which also worked. Following you can find my simple program:
Afterwards I modified the program to place Sell orders. Which did not work at all in the strategy tester. It did not open any orders. Could you please help me to solve this issue? I have already spent many hours trying to solve this problem, googled it and read in the manual. But I could not find a solution. I also tried these small programs in my testaccount ( not the strategy tester), but I got the same result. The modification I made was only to the OrderSend command according to the following line:
For the strategy tester I used the following settings:
Symbol: EURUSD
Period: M15
Spread: 30
Model: every tick
Optimization: off
Timeframe: 2018.01.04 to 2018.01.05
For the EA I used the following settingsö.-:
Balance: 10000 USD
Positions: Long&Short
Best regards
Dominik Gächter