The script is used to automate the placement of pending Sell Stop orders, stop losses and take profits at the levels set by the trader. This script is not as relevant as “Virtual pending buy stop”, since the entry into a short position is made at the moment when the Bid price crosses the level. And there is no need to fear the spread widening. However, it makes sense to have it to protect against unjustified punctures of stop loss levels.
The set goals are solved in the following way. The script does not actually place a pending purchase order. It enters the market order after the Bid-quote reaches the level set by the trader. Thus, the broker can expand the spread as much as necessary. You will be safe and will enter a short position at a real breakdown of an important level. In addition, the script has a “tracking” stop loss, which will close a losing position not at the time of the “puncture” of the specified level, but only after the price closes above the STOPLOSS level. Take profit is set not virtually, but actually.
- LOT – the lot size, by default 0.1.
- DEVIATION – price deviation, default is 10.
- LEVEL – the trigger level of the virtual” waiting ” buy-stop order in units of the price chart. Default is 1.10.
- STOPLOSS – the level of the stop loss in units of the price chart. Default is 1.00.
- TAKEPROFIT – take profit in units of the price chart. Default is 1.30.
- NEWCHECK-prohibits setting a stop after reloading (allows you to set / change the stop loss after entering a position). By default, false.
[spoiler title=”Read More…”]
The specified entry levels, stop loss and take profit levels are marked on the chart with lines of different colors.