Stop and Limit Orders: Exercises

1. Code a Breakout System

Code a strategy that goes long on the highest high 5 bars back, and short on the lowest low 5 bars back. Use stop orders.

Buy next bar at highest(high,5) stop;

Sell next bar at lowest(low,5) stop;

2. Mean reversion

Code an entry that goes long when the market goes below or is equal to the lowest close 5 bars back. 

Then code an exit that sells the position if the market crosses over or is equal to the highest high 5 bars back.

 

Use limit orders for both.

Exercises

Buy next bar at lowest(close,5) limit;

Sell next bar at highest(close,5) limit;

>

Login to Your Account



Signup Here
Lost Password