Skip to content

Program 20 | CCI trend break strategy

Program 20 applied to a 5 minute IBM chart
Program 20 applied to a 5 minute IBM chart

Program 20 consists of an unprotected TradeStation EasyLanguage strategy that generates trades based on the crossing of CCI ‘trend’ lines.Trend lines are calculated by joining CCI pivot points and then continuing the imaginary line until crossed by the CCI. An example of this concept may be found in tutorial 60 and tutorial 63.

In addition long trades are only instigated when the CCI is below a value specified in the user input CCILowFilter and short trades are only instigated when the CCI value is greater than a value specified in the user input CCIHighFilter as well as user defined filters evaluating to TRUE (see below).

The program includes a user input for the number for the contracts bought or sold, together with inputs defining two targets and how many contracts to exit at the first target. The program includes a trailing stop and a user input to define its value.

Like some of our other strategies, the program’s ‘source’ code includes a section where the user can easily define filters. As mentioned above, for a long trade to occur LongFilter1, LongFilter2 , and LongFilter3 must evaluate to true (assuming the other conditions are in force as described above). For a short trade to occur ShortFilter1, ShortFilter2, and ShortFilter3 must evaluate to true (assuming the other conditions are in force as described above).

The program is tested with Look Inside Bar Backtesting and Intra Bar Order Generation switched off.

I explain the functionality in more detail in the video, lower down the page.

This unprotected strategy is available for immediate download. You may pay by Credit Card or PayPal. I have commented the code. It has been tested it on intraday, daily, weekly and monthly charts for futures, stocks and forex.

The program works in TradeStation versions 8.7, 8.8, 9.0, 9.1, 9.5, and 10. I have commented the code. It has been tested it on intraday, daily, weekly and monthly charts for futures, stocks and forex. The download includes the following bonuses:

  • The program created in tutorial 63
  • A video demonstrating how I went about converting the program created in tutorial 63 into a strategy.

A MultiCharts version of the strategy is also available for $165-. this does not include the bonuses (i.e. tutorial 63 and the bonus video).

THE STRATEGY AND INDICATOR HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES.

CLICK HERE FOR SPECIAL DISCOUNTS ON MARKPLEX.COM STRATEGIES.

User Defined Filters

One of the keys to using this program is to define filters within the program.

The default filters are set up as follows:

LongFilter1 = TRUE;
LongFilter2 = TRUE;
LongFilter3 = TRUE;

// Short filters
ShortFilter1 = TRUE;
ShortFilter2 = TRUE;
ShortFilter3 = TRUE;

In other words, they don’t have any effect.

If you wanted to create a stochastic filter you would need to modify the code as follows:

// Long filters
// Stochastic variables
Vars: oFastK( 0 ), // Variable for Multiple Output Function for Stochastic function
oFastD( 0 ), // Variable for Multiple Output Function for Stochastic function
oSlowK( 0 ), // Variable for Multiple Output Function for Stochastic function
oSlowD( 0 ); // Variable for Multiple Output Function for Stochastic functionValue1 = Stochastic( H, L, C, 10, 3, 3, 1, oFastK, oFastD, oSlowK, oSlowD ) ;
LongFilter1 = oSlowk < 25;
LongFilter2 = TRUE;
LongFilter3 = TRUE;// Short filters
ShortFilter1 = oSlowk > 75;
ShortFilter2 = TRUE;
ShortFilter3 = TRUE;

In other words, LongFilter1 is TRUE if oSlowk is less than 25 and ShortFilter1 is TRUE if oSlowk is greater than 75.

Say you wanted to add an additional CCI filter, for example to filter trades such that we would only go long if the candlestick pattern must have occurred within MaxAfterCandle bars, any other conditions set evaluate to TRUE, and the CCI is less than -150 then you would need to add the following code:

Value2 = CCI( 14 );
LongFilter2 = Value2 < -150;

This unprotected strategy is available for immediate download. You may pay by Credit Card or PayPal. I have commented the code. It has been tested it on intraday, daily, weekly and monthly charts for futures, stocks and forex.

The program works in TradeStation versions 8.7, 8.8, 9.0, 9.1, 9.5, and 10. I have commented the code. It has been tested it on intraday, daily, weekly and monthly charts for futures, stocks and forex. The download includes the following bonuses:

  • The program created in tutorial 63
  • A video demonstrating how I went about converting the program created in tutorial 63 into a strategy.

THE STRATEGY AND INDICATOR HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES.

A MultiCharts version of the strategy is also available for $165-. this does not include the bonuses (i.e. tutorial 63 and the bonus video).

CLICK HERE FOR SPECIAL DISCOUNTS ON MARKPLEX.COM STRATEGIES.

The strategy is explained in detail in the video below.

Inputs

The inputs could be considered to be grouped into 4 different types:

Trend line determination

CCI trend lines are calculated by analyzing CCI pivots. The following inputs are used in this calculation.

LeftStrength( 2 ), // Left strength of pivot
RightStrength( 2 ), // Right strength of pivot
Length( 25 ), // Lookback length when looking For pivots

Trade management

The following inputs determine how many contracts are bought or sold, how many are taken off at the first target, the value of the first and second targets, and the trailing stop value.

Cts( 10), // Number of contracts to be traded
TrailVal( 61 ), // Trail value – expressed as multiple of minimum price move
Tgt1( 141 ), // First target – expressed as multiple of minimum price move (i.e. Target1 = Tgt1 * MinMove / PriceScale)
Tgt2( 1 ), // Second target – incremental to the first target (i.e. Target2 = Tgt2 * MinMove / PriceScale + Target1)
FirstTgtCts( 1 ), // The number of contracts to be taken off at first target

CCI trade filter

To instigate a trade the program checks whether MarketPosition is flat, looks for a trend line break, ensures user defined filters evaluate to TRUE and, for a long trade, makes sure the CCI is less than or equal to the CCILowFilter input, or a short trade makes sure the CCI is greater than or equal to the CCIHighFilter input.
CCILowFilter( -100 ),
CCIHighFilter( 100 ),
CCILength( 14), // CCI length

Presentation

If the user input ShowLines is set to TRUE then a line representing the trailing stop level is drawn for all trades, if FALSE, it is just drawn for the current date,

ShowLines( False ); // If set to TRUE, trailing stops are shown for all trades, otherwise just for the current date

Screen Images

Program 20 applied to a 15 minute @ES chart. ShowLines is set to TRUE so the trailing stop is visible.
Program 20 applied to a 15 minute @ES chart. ShowLines is set to TRUE so the trailing stop is visible.

In order to see a bigger image, simply click on the image you would like to enlarge. Once open, to close the enlarged image, click the cross at the top right hand corner.

A performance report after optimization of strategy on a 5 minute @ES chart with 2 years of data. Commission set at $2.50 per contract and slippage at $12.50 per contract.

A performance report after optimization of strategy on a 5 minute @ES chart with 2 years of data. Commission set at $2.50 per contract and slippage at $12.50 per contract.


This unprotected strategy is available for immediate download. You may pay by Credit Card or PayPal. I have commented the code. It has been tested it on intraday, daily, weekly and monthly charts for futures, stocks and forex.

The program works in TradeStation versions 8.7, 8.8, 9.0, 9.1, 9.5, and 10. I have commented the code. It has been tested it on intraday, daily, weekly and monthly charts for futures, stocks and forex. The download includes the following bonuses:

  • The program created in tutorial 63
  • A video demonstrating how I went about converting the program created in tutorial 63 into a strategy.

THE STRATEGY AND INDICATOR HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES.

A MultiCharts version of the strategy is also available for $165-. this does not include the bonuses (i.e. tutorial 63 and the bonus video).

CLICK HERE FOR SPECIAL DISCOUNTS ON MARKPLEX.COM STRATEGIES.

See a video demonstration below.

TO THE BEST OF MARKPLEX CORPORATION’S KNOWLEDGE, ALL OF THE INFORMATION ON THIS PAGE IS CORRECT, AND IT IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY FOR ANY DAMAGES, DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION AND/OR PROGRAM(S) DESCRIBED, AND NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. USE OF THIS INFORMATION AND/OR PROGRAMS DESCRIBED IS AT YOUR OWN RISK.

ANY EASYLANGUAGE OR POWERLANGUAGE TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (AND PARTS THEREOF) AND ASSOCIATED TECHNIQUES REFERRED TO, INCLUDED IN OR ATTACHED TO THIS TUTORIAL OR PROGRAM DESCRIPTION ARE EXAMPLES ONLY, AND HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION. DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS AND TECHNIQUES DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.

This unprotected strategy is available for immediate download. You may pay by Credit Card or PayPal. I have commented the code. It has been tested it on intraday, daily, weekly and monthly charts for futures, stocks and forex.

The program works in TradeStation versions 8.7, 8.8, 9.0, 9.1, 9.5, and 10. I have commented the code. It has been tested it on intraday, daily, weekly and monthly charts for futures, stocks and forex. The download includes the following bonuses:

  • The program created in tutorial 63
  • A video demonstrating how I went about converting the program created in tutorial 63 into a strategy.

THE STRATEGY AND INDICATOR HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES.

A MultiCharts version of the strategy is also available for $165-. this does not include the bonuses (i.e. tutorial 63 and the bonus video).

Video demonstration of program 20

This unprotected strategy is available for immediate download. You may pay by Credit Card or PayPal. I have commented the code. It has been tested it on intraday, daily, weekly and monthly charts for futures, stocks and forex.

The program works in TradeStation versions 8.7, 8.8, 9.0, 9.1, 9.5, and 10. I have commented the code. It has been tested it on intraday, daily, weekly and monthly charts for futures, stocks and forex. The download includes the following bonuses:

  • The program created in tutorial 63
  • A video demonstrating how I went about converting the program created in tutorial 63 into a strategy.

A MultiCharts version of the strategy is also available for $165-. this does not include the bonuses (i.e. tutorial 63 and the bonus video).

CLICK HERE FOR SPECIAL DISCOUNTS ON MARKPLEX.COM STRATEGIES.

Please email any bugs that you may discover to support@markplex.com.

TO THE BEST OF MARKPLEX CORPORATION’S KNOWLEDGE, ALL OF THE INFORMATION ON THIS PAGE IS CORRECT, AND IT IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY FOR ANY DAMAGES, DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION AND/OR PROGRAM(S) DESCRIBED, AND NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. USE OF THIS INFORMATION AND/OR PROGRAMS DESCRIBED IS AT YOUR OWN RISK.

ANY EASYLANGUAGE OR POWERLANGUAGE TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (AND PARTS THEREOF) AND ASSOCIATED TECHNIQUES REFERRED TO, INCLUDED IN OR ATTACHED TO THIS TUTORIAL OR PROGRAM DESCRIPTION ARE EXAMPLES ONLY, AND HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION. DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS AND TECHNIQUES DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.