Not possible. At least not easily.
tinivini:
Hi .I am designing a semi-automatic MQL5 EA . For each position manually I have to place SL and TP .
Is there a way to enter TP and SL in the Strategy tester at the moment when the position is to be opened or by default the position will be opened with a TP and SL after that I can edit TP/SL or drag it with the mouse ?
TP/SL can't be dragged with the mouse in the strategy tester, unfortunately.
The only way to test such function is on a live environment, on a demo account. I guess you would like to create a manual backtesting machine, but unfortunately it can't work that way
I found a solution for this problem.
In my EA, after opening a position with a certain SL and TP, the program checks the two text files TP and SL, and if there are any values in them, it replaces SL and TP with those new values.
For ease of work, I wrote a program in C# (you can write in any other language) that writes the new TP and SL values into a text file and we do less work, and in this way I can replace SL and TP in the backtest. .
It may not be the best way, but it works.
I mentioned it, maybe someone has the same problem.
C# code is attached.
In my EA, after opening a position with a certain SL and TP, the program checks the two text files TP and SL, and if there are any values in them, it replaces SL and TP with those new values.
For ease of work, I wrote a program in C# (you can write in any other language) that writes the new TP and SL values into a text file and we do less work, and in this way I can replace SL and TP in the backtest. .
It may not be the best way, but it works.
I mentioned it, maybe someone has the same problem.
C# code is attached.
Files:
SimpleText.zip
239 kb
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hi .I am designing a semi-automatic MQL5 EA . For each position manually I have to place SL and TP .
Is there a way to enter TP and SL in the Strategy tester at the moment when the position is to be opened or by default the position will be opened with a TP and SL after that I can edit TP/SL or drag it with the mouse ?