One of the first rules in money management and risk management in Forex is to ALWAYS have a stop loss set for all your trades. Remember that the broker can execute a margin call on your account if a trade moves against you and you don’t have sufficient funds to cover the loss. Long story short, missing a stop loss may result in your account wiped or badly damaged. The script SetFixedSLandTP (short for Set Fixed Stop Loss and Take Profit) allows you to set a stop loss and an optional take profit price to all the open orders in a determined currency.
There may be cases where you need to open an order quickly or you simply forget to set a stop loss and take profit for your order. Sometimes you may also have many orders open following the same strategy and you may want to set the stop loss and take profit for all of them at once. You can use the SetFixedSLandTP script to make it faster for you.
You can download the script for educational purposes and test it on a Demo Account.
When you run the script on a chart you can set some parameters in order to limit which orders will be affected, You will also have to specify the pips of distance from the open price for the stop loss and take profit price.
The parameters are:
- Take Profit in Pips, distance in pips between the open price and the take profit
- Stop Loss in pips, distance in pips between the open price and the stop loss
- Modify only orders martching the magic number, can be false or true and it specifies if you want to limit the changes only to orders of a specific magic number
- Matching magic number, in case the previous is true you need to specify which magic number to use for the match
- Modify only oders with the following comment, can be false or true depending if you want to modify only orders with a specific comment
- Matching comment, write the comment to match in case the previous is true
- Slippage, to specify the slippage in pips
- Delay to wait between modifying orders (in milliseconds), this is in case you want to delay the execution of the changes, may be necessary with some brokers or systems
The script is free to download and use.
Please leave a comment if you have any feedback or doubt and remember to like us on Social Media!
I would really appreciate also suggestions for improvements and reports of any bug found. Thank you!
If you want to save hours of research and coding and you want to see some professional code check this out! You can use it to build your own EA!