Hello,
I have tested your code on strategy tester, it was working properly. STP and TKP were triggered as expected.
But i am curious with this line:
if (Buy_condition_1)
Perhaps you missed the opening and closing brackets for this conditional?
Regards,
Hello,
I have tested your code on strategy tester, it was working properly. STP and TKP were triggered as expected.
But i am curious with this line:
Perhaps you missed the opening and closing brackets for this conditional?
Regards,
Thank you for your response. Are you sure SL and TP were triggered? And thank you for pointing out the brackets. This EA is riddled with errors but I'm just trying to get the basics down :). I just added the brackets and the SL and TP were still not triggered. Here's a screen shot. Also, I've encountered another small problem which is not illustrated in the code here. No matter what I change the variable "Lot" to, it is always 1 in strategy tester. I overcame this by adding a static number for mrequest.volume. Thank you!
Hi, same here.
I've tested that code --which I guess comes from the article Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners, I mean, that's the one I tested-- in tons of different ways on the Strategy Tester to no avail; I can just plain remove the mrequest.sl/mrequest.tp lines, re-compile and re-test, and it won't make any difference.
I've tied searching both on the forums and the codebase, but I was rather surprised not to find a single EA with an OrderSend() in the whole codebase (in other words, not a single EA that actually trades)... looks like folks are not very enthusiastic about automatic trading around here, and I feel kind of silly asking on how to use stop losses/take profits while auto-trading; anyway, any help appreciated.
Hi guys, I'm getting the same result for my_first_EA and for a lot of samples even this simple EA here: https://www.mql5.com/en/code/103
Then I suddenly stumbled on this thread: https://www.mql5.com/en/forum/5360
here's what they said:
The only problem that remains is getting a sample of code that can create a pending order for stoploss and takeprofit with the original trade.
Do you guys know any code that does not require storing of our SL/TP on the side of the broker and just places a stop/limit order on our side/server?
Appreciate your reply. Thanks in advance!
- votes: 15
- 2010.04.27
- Karlis Balcers | English Russian Spanish Portuguese
- www.mql5.com
This problem is also related to an earlier post that I've made: https://www.mql5.com/en/forum/7345
and this is also the same problem that's causing the big spread between the account balance and equity curve in one of my backtests:
I really hope someone can help me with this problem, I've been stuck with this problem for several weeks now. Maybe you could point me to a sample code that can solve this problem?
Thanks in advance!
- www.mql5.com
Thank you for your response. Are you sure SL and TP were triggered? And thank you for pointing out the brackets. This EA is riddled with errors but I'm just trying to get the basics down :). I just added the brackets and the SL and TP were still not triggered. Here's a screen shot. Also, I've encountered another small problem which is not illustrated in the code here. No matter what I change the variable "Lot" to, it is always 1 in strategy tester. I overcame this by adding a static number for mrequest.volume. Thank you!
Hi guys, I'm getting the same result for my_first_EA and for a lot of samples even this simple EA here: https://www.mql5.com/en/code/103
Then I suddenly stumbled on this thread: https://www.mql5.com/en/forum/5360
here's what they said:
The only problem that remains is getting a sample of code that can create a pending order for stoploss and takeprofit with the original trade.
Do you guys know any code that does not require storing of our SL/TP on the side of the broker and just places a stop/limit order on our side/server?
Appreciate your reply. Thanks in advance!
i met the same problem. it seems that the broker don't actually take a sl/tp with the sending rder when its an ea....
i met the same problem. it seems that the broker don't actually take a sl/tp with the sending rder when its an ea....
Hi luenbo, did you find anything that could solve this problem or did you try something else? Did you use other approaches to set the stop loss and take profit levels?Appreciate it if you could share your findings...
- www.mql5.com
Why don't you guys use stealth sl and tp orders?
- 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 everyone, I just modified my first EA from a tutorial. Everything went smoothly, it compiled with no errors, and it places trades! (yay!) However the STP and TKP values are never triggered in the strategy tester (which means that all trades are closed at the end of the experiment). I've looked through the code carefully (keep in mind that I'm a new programmer), I couldn't find the answer. Any help would be greatly appreciated. Thank you.