Skip to content

Program 12 | Flexible candlestick pattern strategy (with user definable filters)

Program 12 is a TradeStation EasyLanguage strategy that searches for candlestick patterns (the specific candlestick patterns searched for depend on which user inputs are selected, see below for more information). If a pattern occurs and a user defined filter or user defined filters evaluate to true within a user defined number of bars, then a trade is instigated.

This UNPROTECTED program (i.e. the TradeStation EasyLanguage strategy) is available for immediate download for $79.95 by clicking the ‘add to cart’ button to pay using Credit card or PayPal.

The user has the option to make the program look for the following candlestick patterns:

  • 3 White Soldiers
  • 3 Black Crows
  • Bullish Harami
  • Bearish Harami
  • Bullish Engulfing
  • Bearish Engulfing
  • Hammer
  • Hanging Man
  • Morning Doji Star
  • Evening Doji Star
  • Morning Star
  • Evening Star
  • Piercing Line
  • Dark Cloud

In each case the user can determine whether to look for the pattern by setting a user input (1 = yes, 0 = no). This also means that these patterns can be optimized for by setting the options to 0 and 1 in the optimization settings.

The video below describes these features in more detail.

The following image shows the Program 12 strategy applied to the S&P e-mini. Notice how the program has two targets. A user defined number of contracts are sold (or bought to cover) at the first target and the remainder are sold (or bought to cover) at the second target.

Please note that the following screen shots are examples and are not meant to imply that this program will generate profitable trades. THE STRATEGY HAS BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES.

Candlestick strategy applied to S&P E-mini
Program 12 applied to a 60 minute e-mini chart.

Also notice that text drawn on the chart indicates the sort of candlestick pattern that has been found. The codes for the patterns drawn on the chart (assuming the appropriate input is set to 1) are as follows:

  • 3BC = Three Black Crows
  • BeH = Bearish Harami
  • BeE = Bearish Engulfing
  • HM = Hanging Man
  • EDS = Evening Doji Star
  • ES = Evening Star
  • D = Dark cloud
  • 3WS = Three White Soldiers
  • BH = Bullish Harami
  • BE = Bullish Engulfing
  • H = Hammer
  • MDS = Morning Doji Star
  • MS = Morning Star
  • P = Piercing Line

The following image shows the program applied to a GBPUSD chart. In this case the ShowLines input is set to true. This means that the trailing stop is drawn as a red line.

Candlestick strategy applied to GBPUSD
Program 12 applied to a GBPUSD chart. The ShowLines input is set to TRUE.

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:

// 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 function

Value1 = 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.

Should you not wish to use the stochastic filter, then you would replace

LongFilter1 = oSlowk < 25;

and

ShortFilter1 = oSlowk > 75;

with

// LongFilter1 = TRUE;

and

ShortFilter1 = TRUE;

respectively. You would also comment out the stochastic calculation and variables.

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;

User Inputs

Length( 14 ), // Input to various Candlestick pattern functions
Percent( 5 ), // Input to various Candlestick pattern functions
Factor( 2 ), // Input to various Candlestick pattern functions
Adj( 0.0003 ), // Determines position of text
MaxAfterCandle( 5 ), // Determines how many bars after a candlestick pattern that a trade would be instigated (if filters become true)
Cts( 10 ), // Number of contracts to be traded
TrailVal( 100 ), // Trail value – expressed as multiple of minimum price move
Tgt1( 100 ), // First target – expressed as multiple of minimum price move (i.e. Target1 = Tgt1 * MinMove / PriceScale)
Tgt2( 200 ), // Second target – incremental to the first target (i.e. Target2 = Tgt2 * MinMove / PriceScale + Target1)
FirstTgtCts( 5 ), // The number of contracts to be taken off at first target
ShowLines( TRUE ), // If set to TRUE historical target and trailing stop lines are drawn – if false just today’s lines
Use3WhiteSoldiers( 0 ), // Use this Candlestick pattern (1 = yes, 0 = no)
Use3BlackCrows( 0 ), // Use this Candlestick pattern (1 = yes, 0 = no)
UseBullishHarami( 0 ), // Use this Candlestick pattern (1 = yes, 0 = no)
UseBearishHarami( 0 ), // Use this Candlestick pattern (1 = yes, 0 = no)
UseBullishEngulfing( 0 ), // Use this Candlestick pattern (1 = yes, 0 = no)
UseBearishEngulfing( 0 ), // Use this Candlestick pattern (1 = yes, 0 = no)
UseHammer( 0 ), // Use this Candlestick pattern (1 = yes, 0 = no)
UseHangingMan( 0 ), // Use this Candlestick pattern (1 = yes, 0 = no)
UseMorningDojiStar( 0 ), // Use this Candlestick pattern (1 = yes, 0 = no)
UseEveningDojiStar( 0 ), // Use this Candlestick pattern (1 = yes, 0 = no)
UseMorningStar( 0 ), // Use this Candlestick pattern (1 = yes, 0 = no)
UseEveningStar( 0 ), // Use this Candlestick pattern (1 = yes, 0 = no)
UsePiercingLine( 0 ), // Use this Candlestick pattern (1 = yes, 0 = no)
UseDarkCloud( 0 ); // Use this Candlestick pattern (1 = yes, 0 = no)

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 program (i.e. the TradeStation EasyLanguage strategy) is available for immediate download for $79.95 by clicking the ‘add to cart’ button to pay using Credit card or PayPal.

The program was developed in Tradestation 8.7 and works on intraday, daily, weekly, and monthly charts. The program works in version 9.5, version 10 and is forward compatible. The strategy may be applied to tick charts, but the trailing stop line may not display correctly due to an EasyLanguage limitation.

See the video below for more information.

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 program (i.e. the TradeStation EasyLanguage strategy) is available for immediate download for $79.95 by clicking the ‘add to cart’ button to pay using Credit card or PayPal.

The program was developed in TradeStation 8.7 and works on intraday, daily, weekly, and monthly charts.

Video demonstration of Program 12


This UNPROTECTED program (i.e. the TradeStation EasyLanguage strategy) is available for immediate download for $79.95 by clicking the ‘add to cart’ button to pay using Credit card or PayPal.

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.