<< <%SKIN-STRTRANS-SYNTOC%> >> Navigation: Video Tutorial > Daily Breakout With Pending Orders |
In this tutorial, we're going to modify the breakout system from the previous video. We will demonstrate using pending orders instead of market orders.
We will copy the strategy under a new name: Daily Breakout Pending.
Delete the first condition and add a new condition.
The order will be sent at 10 o'clock.
We will change the order to a pending stop order...
at Resistance with the same parameters as previously.
Create the opposite...
and the conditions for Pending Sell Order are replaced.
Now two pending orders will be sent at 10 o'clock. One at support and one at resistance. When one pending order is filled, we want to delete the second one. First, we will change "Close Long Positions" to "Delete Stop Orders".
And we will delete them when there is at least one open trade.
The number of open trades, is above, zero.
We will do the same to delete pending sell orders.
As we have pending orders, we don't need to limit the number of trades (uncheck one checkbox).
But there is one useful option. Sometimes, sending order fails with the common error message "invalid stops". It happens when the order price is too close to the current market price. This setting will fix it:
The order price will be at least 5 pips from the current price.
Now replace the source, compile it...
and let's backtest it just to see if it works as we want.
We see there are two pending orders right at the blue lines sent at 10 o'clock. Once one order is filled, the second pending order is deleted. It works as planned and we will optimize this system in the next video.