Discuss Set Fixed SL and TP MetaTrader script in this thread. You can ask any questions about this free script here.
Error 1 means ERR_NO_RESULT (No error returned, but the result is unknown). I only get this error when I am trying to set the same SL and TP as the order already has set on it. Try modifying the SL and TP to some different values.Hi there, I'm trying to apply the following script available in the software library to DAX30 CFD (have also tried with regular fx pair) but it fails with the error:
2021.09.15 10:18:40.714 SetFixedSLandTP_v1-0 GER30.cash,M1: Order failed to update with error - 1
I was wondering if anyone was familiar with this script could tell me what I am doing wrong?
Settings attached
Not sure what you mean. Could you please explain more?Hello,
nice idea <Set Fixed SL and TP Script>, thank you for that.
I have a question/idea:
If you work in hedging, there can also be several trades open in one “Magic ID”. However, when the market turns, there are many positions open.
Sometimes it would be helpful to exit these trades at a certain price. Can you also add this “feature” as an “option”?
Best Ergards
Hello,Not sure what you mean. Could you please explain more?
Sorry, but I still don't understand what you are asking for. How is it different from setting TP at some specific level?Hello,
for an example see the screen below.
Due to the large number of open positions, it would not have been possible to close them all in line with the market.The regular "TP" was apparently missed by a few pips - see the marking "yellow" (1/ 2/ 3).
The idea would have been to pull the "TP" up a few pips - see the "orange" marking.
View attachment 26579
The difference is that when specified in points, the target of the points specified in TP must be achieved for each open order.When entering the price, for example: all open orders of a specific Magic ID should be closed at this price.Sorry, but I still don't understand what you are asking for. How is it different from setting TP at some specific level?
OK, now I understand what you want. I will consider adding such an option to this script in its future version.The difference is that when specified in points, the target of the points specified in TP must be achieved for each open order.When entering the price, for example: all open orders of a specific Magic ID should be closed at this price.
Hi. In my opinion, working on percentages would be much more useful than on points. What do you think about adding it to the script? RegardsThe Set Fixed SL and TP script has been updated to version 1.01 to introduce numerous changes:
- Added an MT5 version of the script.
- Added an option to apply stop-loss and take-profit based on the current price rather than open price.
- Added an option to work with pending orders as well.
- Added an option to set SL and TP not only for the current trading symbol.
- Added an option to skip either SL or TP by setting the respective input parameter to zero.
- Added a filter based on trade's direction.
- Changed the script to work based on points rather than pips.
- Removed the Slippage input parameter (wasn't used).
- Refactored the MQL4 code.
A percentage of price? I don't think that's used often in Forex. Do you use that?Hi. In my opinion, working on percentages would be much more useful than on points. What do you think about adding it to the script? Regards
So, it would set the TP based on the percentage of the SL, not on the percentage of price? That makes some sense, but I think that would be best as a separate script because it won't be able to set any TP for trades that don't already have a SL. The current script is intended more for setting a uniform SL and TP on a large number of filtered trades.Hi. Yes, I use it as a basic strategy. Eg. I fix 150% TP versus 100% SL. It means I always earn 1,5 more than I risk. Additionally, I do not need to think about points because of different markets - Gold, Silver are different in points than Currencies. All my trading community uses %, so not only me.
Regards,
Yes, you are right regarding TP based on % of SL. I hope you find time for thatSo, it would set the TP based on the percentage of the SL, not on the percentage of price? That makes some sense, but I think that would be best as a separate script because it won't be able to set any TP for trades that don't already have a SL. The current script is intended more for setting a uniform SL and TP on a large number of filtered trades.
The archive that you downloaded contains two folders. Both have to be copied directly to the MQL4 folder. The script will then appear under Scripts in your MT4's Navigator.Hi @Enivid and all - I appreciate the script SetFixedSLandTP (thank you) but I cannot seem to get it to work in my MT4 ...in the data folder, should the scripts be added to Expert Advisors folder OR Indicators folder OR Scripts folder? Just need to get it working ...any help please, thanks