How SuperTrend.mq4 works, Logic of SuperTrend Indicator Created by Jason Robinson (jnrtrading)
Submitted by kolier on Mon, 11/22/2010 - 18:17
SuperTrend.mq4 was created by Jason Robinson (jnrtrading) and published on http://www.forex-tsd.com/221493-post1.html
- Default = 10. Use as ATR period settings.
- Default = 3.0. Trend line range control, if set it larger, it will check bigger trend. Switch from 1.0 to 3.0 to compare.
Logic of SuperTrend
- ATR = Average True Range value counting with Nbr_Periods as period.
- ATR Range = Multiplier * ATR.
- Medium Price = (High + Low)/2.
- Main Trend Line in Up Trend (Show in Color Lime) = Medium Price - ATR Range.
Tricky Part: And the value will keep the same as the previous one if the current value from the formula is less than the previous one, but it will rise up if the value is larger.
- Main Trend Line in Down Trend = Medium Price + ATR Range.
- Main Trend Line
- Up Trend: Current close price is larger than the "Main Trend Line in Up Trend"
- Down Trend: Current close price is less than the "Main Trend Line in Down Trend"
- Same logic, improvement implementation in code, can draw full chart and less resource consume.
- Extended. TrendMode=0 means original logic for trend line. TrendMode=1 means new logic for trend line.