Daily Breakout With Pending Orders

<< <%SKIN-STRTRANS-SYNTOC%> >>

Navigation:  Video Tutorial >

Daily Breakout With Pending Orders

menu_video Watch the video here.

 

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.

 

clip0270

 

Delete the first condition and add a new condition.

 

clip0271

 

clip0272

 

The order will be sent at 10 o'clock.

 

clip0273

 

We will change the order to a pending stop order...

 

clip0274

 

at Resistance with the same parameters as previously.

 

clip0275

 

Create the opposite...

 

clip0276

 

and the conditions for Pending Sell Order are replaced.

 

clip0277

 

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".

 

clip0278

 

clip0279

 

And we will delete them when there is at least one open trade.

 

clip0280

 

The number of open trades, is above, zero.

 

clip0281

 

We will do the same to delete pending sell orders.

 

clip0282

 

clip0283

 

clip0284

 

clip0285

 

As we have pending orders, we don't need to limit the number of trades (uncheck one checkbox).

 

clip0286

 

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:

 

clip0287

 

The order price will be at least 5 pips from the current price.

 

clip0288

 

Now replace the source, compile it...

 

clip0289

 

clip0290

 

and let's backtest it just to see if it works as we want.

 

clip0291

 

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.