The script is created for the possibility of setting pending orders of the typeStop Close Only. This type of order involves entering a long position if the price closes above the specified price level and opening a short position if the price closes below the price set by the trader. This type of order is especially often used to open trades when the price exits the horizontal channel.
In the script settingsStop Close Only provides the ability to place both directional and multidirectional orders, take profits and stop losses on them. The script provides for the possibility of trailing profit with a specified step after the price passes a specified number of points from the position opening point. You can control the entry levels, stop loss levels, and take profit levels by moving the corresponding lines on the price chart with the mouse.
The script has a money management block. By default, the risk is 2% of the equity amount of the trading account. This means that if the trader does not set the lot size in the settings, but assigns this task to the script, the script will automatically determine the lot size based on the free balance on the trading account and the distance of the stop loss from the entry point to the position so that the trader will not receive a loss from the transaction more than 2% of the trading account balance. The trader can set the expiration date and time of the script activation.
[spoiler title=”Read More…”]
Trading with a scriptStop Close Only is performed as follows:
Open a window with the desired tool on the desired timeframe. In the interface of the Meta Trader 5 program, enable the “Auto-trade” button. Use hot keys or by attaching to the graph to activate the script. In the script settings, set the desired parameters.
- Trading BUY positions-true means to allow binary positions, false – to prohibit.
- Trading SELL positions-true means to allow short positions, false – to prohibit.
- Fixed Lot, 0.0 – % of risk – if this line is set to 0.0, the lot size is set automatically based on the size of the risk limit.
- % risk from equity of account – the amount of risk, by default 2% of the account equity amount.
- method of setting levels – method for setting levels. 0 – script, 1 – external lines. The value 0 sets the ability to control the levels by moving their lines with the mouse.
- Price SCO for Buy-specify the specific price of the instrument to enter the binary position in case of closing above the specified price.
- Price SCO for Sell-specify the specific price of the instrument to enter a short position in case of closing below the specified price.
- Stop loss for BUY – the stop loss setting level for long positions.
- Take profit for BUY – take profit setting level for long positions.
- Stop loss for SELL – the stop loss setting level for short positions.
- Take profit for SELL – take profit setting level for short positions.
- true-cancel, false-Date and Time-sets the expiration date and time of the script activation.
- 2013.08.21 00: 10-format of the date and time of the expiration of the script activation.
- pips for start of profit traling, 0 – no traling – the number of points to start trailing profit. By default, 100 points.
- step for traling profit – the step of trailing profit. By default, 20 points.
- Magic-magic number, default is 1000.