Module 1: Starting to Program
Module 2: Indicators and Functions
Module 3: Variables
Module 4: Inputs
Module 5: Exit Techniques
Module 6: Stop Orders and Limit Orders
Module 7 Using Multiple DataStreams in a Strategy
Final Strategy Coding Project
Module 8: Plot Studies and Their Uses
Module 9: Writing to Files
Module 10: How to Code Your Own Indicators and Functions

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