# Program 67 | Zig zag Fibonacci decaying lines

## Fibonacci retracements based on historic zigzag moves

Program 67 is a TradeStation EasyLanguage ShowMe study that:

• Calculates and displays zig zag moves
• Displays a visual signal that two consecutive up or down zig zag moves are equal or nearly equal to each other
• Calculates either 38.2%, 61.8%, or 100% retracements based on either up zig zags or down zig zags (user selectable using the form). A horizontal line is drawn at this level
• Horizontal lines are stored in a vector and their alpha value is decreased as more zig zag lines are added, so the newer lines are ‘brighter’
• The selection of which Fib level to use to determined using a form with radio buttons
• Clicking a radio button stores the values selected in AppStorage and issues a recalculate exception

See the video demonstration below for a demonstration of the program.

The program uses EasyLanguage drawing objects to draw all the lines and text objects. It was written for TradeStation 9.5 and higher, works with volume, second, tick, kagi, Kase, line break, momentum, point and figure, range, renko charts.

The program is very calculation intensive, so if you have a large number of bars it may take some time to calculate. In addition TradeStation does have a limit to the number of drawing objects that are permitted.
The UNPROTECTED program (i.e. the TradeStation EasyLanguage is fully functional and you can see the source code) is available for IMMEDIATE download for \$39.95- by clicking the ‘add to cart’ button. After download the programs can be opened, you will be able to see the program code and modify it if you wish.

After purchase you will be redirected to a download page, so don’t close the browser.

### Programming lessons

Program 67 is commented throughout and demonstrates various useful programming techniques and constructs, including:

• Storing information using AppStorage so that it remains after a program is restarted
• Storing drawing objects in a vector
• Using the trendline, horizontal line and text drawing objects
• Creating a form
• Using the form to change program inputs and ‘restart’ the program
• Creating a method with two inputs

### Program 67 Inputs

double RetracePerc( .1 ), // 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
string ZigZagColUp( “Cyan” ), // Color of up zig zag line
string ZigZagColDn( “Magenta” ), // Color of up zig zag line
int ZZWeight( 3 ), // Determines the thickness of the zig zag line. Valid numbers are integers between 0 and 6
int ZZStyle( 2 ), // 0 = solid, 1 = dashed, 2 = dotted, 3 = dashed2, 4 = dashed3
string ColorOfText( “Lightgray” ), // Color of label showing price change of zig zag lines

int LineThickness( 3), // Thickness of line if new zig zag is within Tolerance of previous zig zag in same direction
string LineColor( “Orange” ), // Color of line if new zig zag is within Tolerance of previous zig zag in same direction
int DecayRate( 25 ), // Decay multiplier
int TLWeight( 3 ), // Determines the thickness of the horizontal line. Valid numbers are integers between 0 and 6
int TLStyle( 2 ); // Horizontal line style 0 = solid, 1 = dashed, 2 = dotted, 3 = dashed2, 4 = dashed3

Program 67 was developed for TradeStation 9.5.

The UNPROTECTED program (i.e. the TradeStation EasyLanguage is fully functional and you can see the source code) is available for IMMEDIATE download for \$39.95- by clicking the ‘add to cart’ button. After download the programs can be opened, you will be able to see the program code and modify it if you wish.

After purchase you will be redirected to a download page, so don’t close the browser.

Note that both program names begin with an underscore, so they should be towards the start of the list.

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

THESE INDICATORS, SHOW ME STUDIES, STRATEGIES AND OTHER PROGRAMS HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES.

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.