Channel Breakout TradeStation Code

Let’s consider multi-timeframe analysis within TradeStation:

Inputs: LELen(20),SELen(20),LXLen(20),SXLen(20);
Vars: HighLE(0,data2);
Vars:LowSE(0,data2);
Vars:HighSX(0,data2);
Vars:LowLX(0,data2);
HighLE=Highest(High of data2,LELen) of data2+Minmove;
LowSE=Lowest(Low of data2,SELen) of data2-minmove;
HighSX=Highest(High of data2,SXLen) of data2+minmove;
LowLX=Lowest(Low of data2,LXLen) of data2-minmove;
If High>=HighLE then Buy next bar at market;
If Low<=LowSE then Sell short next bar at market;
If High>=HighSX then Buy to cover next bar at market;
If Low<=LowLX then Sell next bar at market;

This is a simple channel breakout which gets in using market orders on intra-day bars. We use daily bars on data 2. We want to make sure that our variables which are used to get the highest high and lowest low are tied to roll on a daily timeframe. This requires a two step process. First, we declare the variable as being tied to roll on data2. Second, we not only get the highest high of data2, but we also add the “of data2” outside of the () of the function. This makes the resulting expression roll the same as the timeframe of data 2.

Download the channel breakout code by using the form to the right (make sure and keep the channel breakout checkbox selected). You can import this code and use the 9.1 workspace to see how this concept works.

Leave a Reply

Your email address will not be published. Required fields are marked *