Skip to content

Program 29 (array version) | Zig zag estimator | Multicharts compatible

p29-array-version

Program 29 (array version) is a TradeStation and MultiCharts compatible ShowMe study based on Program 29. The original program used TradeStation EasyLanguage vectors and so did not work with MultiCharts. This program replaces the vectors with arrays. It uses historic horizontal zig zag moves (measured in numbers of bars) to attempt to estimate future zig zag turning points.

The program may be useful for you if you are interested in working with zig-zag patterns or learning more about EasyLanguage/PowerLanguage arrays.

How the program works

The program works by calculating and storing the length of each horizontal zig zag move, either up or down. In the case of up moves, it then averages the last up moves in terms of the number of bars over which they took place (the number depends on the user input: NumZigZagsInArray, so, for example, if NumZigZagsInArray were set to 1, only the last up move would be used. If it were set to 2 the last two up moves would be averaged. Then, when a new bottom zig zag pivot is confirmed this average is added to the bar number of the bottom zig zag pivot and the result stored in an array of potential bars where potential zig zag bottom pivots may occur.

If the user input NumZigZagsInArray is set to 3, program 29 (array version) would take the number of bars in UP1, UP 2 an UP 3, find the average and then add the result to Bar Number (once that lower Zig Zag pivot was confirmed) and then store the results in an array for potential top zig zag turning points

Similarly for down moves, the program averages the last down moves in terms of the number of bars over which they took place (the number depends on the user input: NumZigZagsInArray, so, for example, if NumZigZagsInArray were set to 1, only the last down move would be used. If it were set to 2 the last two down moves would be averaged. Then, when a new top zig zag pivot is confirmed this average is added to the bar number of the top zig zag pivot and the result stored in an array of potential bars where potential zig zag top pivots may occur.

The size of both the potential top pivots and potential bottom pivots arrays is controlled by the SizeFutureArray user input. For each new bar the program loops through these arrays to see if the bar number if included. If it is a vertical line is drawn. The color of the lines is controlled the TopLine and BottomLine user inputs.

Program 29 (array version) applied to MultiCharts

Program 26 functionality

Program 29 (array version) includes the functionality created in program 26, i.e. calculates zig-zag patterns and calculates the difference between each high and the next low, and the difference between each low and the next high. The values are ‘drawn’ on the chart to the appropriate number of decimal places. The user can change the color of the zig zag lines and the text.

In addition to modifying the original program 29 to change the use of vectors to arrays, a couple of additional changes were necessary in order for the program to work correctly in Multicharts.
1. In the part of the program that compares the current bar number with values in two arrays, it was necessary to use IntPortion with the values stored in the arrays.
2. In the original program Tl_SetExtRight( Value2, TRUE ); was used to extend the vertical line over the height of the chart. In MultiCharts it appeared that TL_SetExtLeft( Value2, TRUE ); was necessary to achieve the same effect.

The program also compares each downward zig zag with the previous downward zig zag. If the new downward zig zag is within a user defined tolerance of the previous downward zig zag, the thickness of the current downward zig zag is increased to a user defined value. Similarly, if the new upward zig zag is within a user defined tolerance of the previous upward zig zag, the thickness of the current upward zig zag is increased to a user defined value. This provides a visual cue the ‘matching’ zig zag lengths have occurred.

This UNPROTECTED program (i.e. the TradeStation EasyLanguage show me study/MultiCharts PowerLanguage indicator) is available for immediate download for $64.95 by clicking the ‘add to cart’ button to pay using Credit card or PayPal.

The program was developed in MultiCharts and TradeStation and works on intraday, daily, weekly, and monthly charts. It is compatible with TradeStation version 9.o, 9.1, 9.5, 10.0 and higher and MultiCharts. The download includes a PLA file which contains the MultiCharts PowerLanguage indicator and an ELD file which contains the TradeStation EasyLanguage show me study.

This show me study uses the TradeStation legacy drawing tools. It may be applied to tick charts, but the pattern text may not display correctly due to an EasyLanguage drawing tool limitations, particularly for lower tick values.

If you are a Gold Pass member make sure you enter the special coupon code to get 20% discount off this price.

Video demonstration of program 29 (array version)

User inputs

double RetracePerc( 0.2 ), // Percentage above running pivot that pivot must be formed to start a new zig zag
double Tolerance( 10 ), // Percentage tolerance calculating a range above and below last change
int ZigZagColUp( Cyan ), // Color of up zig zag line
int ZigZagColDn( Magenta ), // Color of up zig zag line
int ColorOfText( Lightgray ), // Color of number label
int TopLine( Red ), // Color of lines projected from top zig zag turning points
int BottomLine( Green ), // Color of lines projected from bottom zig zag turning points
int LineThickness( 3 ), // Thickness of line if new zig zag is within Tolerance of previous zig zag in same direction
int NumZigZagsInArray( 3 ), // The number of zig zags that will be used to average the zig zag move
int SizeFutureArray( 5 ); // The maximum number of potential turning points stored in a array

Gold Pass content

A sample program and a video notes about the differences between vectors and arrays and how to convert between the two.
This content is for members only.

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.

If you are a Gold Pass member make sure you enter the special coupon code to get 20% discount off this price.