The code is based on indicator ZigZag which is in-built in MT4, developed by MetaQuotes.
I have changed it slightly so that it isn’t calculated on highest Highs and lowest Lows, but instead uses highest Close and lowest Close of chart price history.
See chart below for differences: ZigZag (red) versus ZigZagClose (yellow).

Some differences are minor in nature, while at other times the effects are significant.
MT4 Indicators – Download Instructions
ZigZag Based on Close Prices is a Metatrader 4 (MT4) indicator and the essence of the forex indicator is to transform the accumulated history data.Subway provides for an opportunity to detect various peculiarities and patterns in price dynamics which are invisible to the naked eye.
Based on this information, traders can assume further price movement and adjust their strategy accordingly.
How to install the software?
- Download the mq4 file from the zip file.
- Copy the mq4 file to your Metatrader Directory / experts / indicators /
- Start or restart your Metatrader Client
- Select Chart and Timeframe where you want to test your indicator
- Search “Custom Indicators” in your Navigator mostly left in your Metatrader Client
- Right click on the mq4 file.
- Attach to a chart
- Modify settings or press ok
- Indicator should be available on your Chart
How to remove tim.mq4 from your Metatrader 4 Chart?
- Select the Chart where is the Indicator running in your Metatrader Client
- Right click into the Chart
- “Indicators list”
- Select the Indicator and delete
MT4 Indicators Download below: