Wing

Wing's Trend Line Bands - (Support and Resistance)

Category: Indicators By: Wing Created: January 29, 2017, 10:37 AM
January 29, 2017, 10:37 AM
Indicators
4 Comments
Wing's Trend Line Bands - (Support and Resistance)

Wing’s Trend Line Bands – (Support and Resistance)

This is an unconventional indicator I have created in PRT 10.2. I have not seen anything similar.

It calculates twelve different trend lines, six that resemble levels of support and six that resemble levels of resistance. They are then averaged into two trend lines, to form a band around the price. The ‘band’ does not behave like for example a bollinger band. Trend Line Bands are more dynamic since they are drawn between different high/low points, and are therefore, straight.

How to trade:

Appropriate timeframe, security and system is for you to find. Remember that this indicator is experimental and can be developed in many ways. Trend Line Bands can be traded in at least three ways that I have found:

  • Mean reversion (price bouncing on the bands)
  • Breakout (decisive move through a band)
  • Band convergence (The algorithm can output a line of support ABOVE the line of resistance. This is a sign of upcoming trend reversal and should not be traded in the ways mentioned above.)
    ////////////////////////////////////////////////////
    //
    // Wing's Trend Line Bands - (Support and Resistance)
    //
    // Made by user "Wing" of ProRealCode.com
    // https://www.prorealcode.com/user/wing/
    //
    //////////////////////////////////////////////////
    //
    // Parameter:
    
    p = 7
    
    //////////////////////////////////////////////////
    
    
    rs=RSI[p]
    
    
    
    once t1=0
    once t2=0
    once t3=0
    once t4=0
    
    once b1=0
    once b2=0
    once b3=0
    once b4=0
    
    
    once top=0
    
    if rs[4]>70  and high[4]>high[3] and high[4]>high[2] and high[4]>high[1] and high[4]>high and top=0 then
    t4=t3
    t3=t2
    t2=t1
    t1=barindex-4
    top=6
    endif
    
    if rs[4]<30  and low[4]<low[3] and low[4]<low[2] and low[4]<low[1] and low[4]<low and top=0 then
    b4=b3
    b3=b2
    b2=b1
    b1=barindex-4
    top=6
    endif
    
    if top>0 then
    top=top-1
    endif
    
    // tops
    
    if high[barindex-t2]>high[barindex-t1] then
    linet1=high[barindex-t2]-(((barindex-t2)*sqrt(square(high[barindex-t1]-high[barindex-t2])))/(t1-t2))
    else
    linet1=high[barindex-t2]+(((barindex-t2)*sqrt(square(high[barindex-t1]-high[barindex-t2])))/(t1-t2))
    endif
    
    if high[barindex-t3]>high[barindex-t2] then
    linet2=high[barindex-t3]-(((barindex-t3)*sqrt(square(high[barindex-t2]-high[barindex-t3])))/(t2-t3))
    else
    linet2=high[barindex-t3]+(((barindex-t3)*sqrt(square(high[barindex-t2]-high[barindex-t3])))/(t2-t3))
    endif
    
    if high[barindex-t3]>high[barindex-t1] then
    linet21=high[barindex-t3]-(((barindex-t3)*sqrt(square(high[barindex-t1]-high[barindex-t3])))/(t1-t3))
    else
    linet21=high[barindex-t3]+(((barindex-t3)*sqrt(square(high[barindex-t1]-high[barindex-t3])))/(t1-t3))
    endif
    
    if high[barindex-t4]>high[barindex-t1] then
    linet3=high[barindex-t4]-(((barindex-t4)*sqrt(square(high[barindex-t1]-high[barindex-t4])))/(t1-t4))
    else
    linet3=high[barindex-t4]+(((barindex-t4)*sqrt(square(high[barindex-t1]-high[barindex-t4])))/(t1-t4))
    endif
    
    if high[barindex-t4]>high[barindex-t2] then
    linet31=high[barindex-t4]-(((barindex-t4)*sqrt(square(high[barindex-t2]-high[barindex-t4])))/(t2-t4))
    else
    linet31=high[barindex-t4]+(((barindex-t4)*sqrt(square(high[barindex-t2]-high[barindex-t4])))/(t2-t4))
    endif
    
    if high[barindex-t4]>high[barindex-t3] then
    linet32=high[barindex-t4]-(((barindex-t4)*sqrt(square(high[barindex-t3]-high[barindex-t4])))/(t3-t4))
    else
    linet32=high[barindex-t4]+(((barindex-t4)*sqrt(square(high[barindex-t3]-high[barindex-t4])))/(t3-t4))
    endif
    
    // bots
    
    if low[barindex-b2]>low[barindex-b1] then
    lineb1=low[barindex-b2]-(((barindex-t2)*sqrt(square(low[barindex-b1]-low[barindex-b2])))/(b1-b2))
    else
    lineb1=low[barindex-b2]+(((barindex-b2)*sqrt(square(low[barindex-b1]-low[barindex-b2])))/(b1-b2))
    endif
    
    if low[barindex-b3]>low[barindex-b2] then
    lineb2=low[barindex-b3]-(((barindex-b3)*sqrt(square(low[barindex-b2]-low[barindex-b3])))/(b2-b3))
    else
    lineb2=low[barindex-b3]+(((barindex-b3)*sqrt(square(low[barindex-b2]-low[barindex-b3])))/(b2-b3))
    endif
    
    if low[barindex-b3]>low[barindex-b1] then
    lineb21=low[barindex-b3]-(((barindex-b3)*sqrt(square(low[barindex-b1]-low[barindex-b3])))/(b1-b3))
    else
    lineb21=low[barindex-b3]+(((barindex-b3)*sqrt(square(low[barindex-b1]-low[barindex-b3])))/(b1-b3))
    endif
    
    if low[barindex-b4]>low[barindex-b1] then
    lineb3=low[barindex-b4]-(((barindex-b4)*sqrt(square(low[barindex-b1]-low[barindex-b4])))/(b1-b4))
    else
    lineb3=low[barindex-b4]+(((barindex-b4)*sqrt(square(low[barindex-b1]-low[barindex-b4])))/(b1-b4))
    endif
    
    if low[barindex-b4]>low[barindex-b2] then
    lineb31=low[barindex-b4]-(((barindex-b4)*sqrt(square(low[barindex-b2]-low[barindex-b4])))/(b2-b4))
    else
    lineb31=low[barindex-b4]+(((barindex-b4)*sqrt(square(low[barindex-b2]-low[barindex-b4])))/(b2-b4))
    endif
    
    if low[barindex-b4]>low[barindex-b3] then
    lineb32=low[barindex-b4]-(((barindex-b4)*sqrt(square(low[barindex-b3]-low[barindex-b4])))/(b3-b4))
    else
    lineb32=low[barindex-b4]+(((barindex-b4)*sqrt(square(low[barindex-b3]-low[barindex-b4])))/(b3-b4))
    endif
    
    
    // return values
    
    resistance=(linet1+ linet2+ linet21+ linet3+ linet31+ linet32)/6
    support=(lineb1+ lineb2+ lineb21+ lineb3+ lineb31+ lineb32)/6
    midpoint=(resistance+support)/2
    
    return resistance, support, midpoint
    

Download
Filename: Wings-Trend-Line-Bands.itf
Downloads: 207
Wing
Wing Veteran
I mostly trade DAX. My favorite strategy tool: Machine learning (yes, possible in ProOrder+ProBuilder). I like to answer questions about coding.
Author’s Profile

Comments

CKW
CKW
10 years ago
#

Hi Wing,

Thanks for your sharing. I am still trying to breakdown & understand your code.

For your example above, 30m chart & Parameter = 7. Does it mean this indicator analysze the Support & Resistance for the last 7 candles? (e.g. 4 hours?)

Br, CKW

 

Wing
10 years ago
#

Hello CKW.

No, the parameter, 7 in this case, is used when calling the RSI indicator to identify points of interests. It is between these these points that the trend lines are drawn. There are 8 points in total on which the lines are based, and when a new point is found, the oldest previous point is discarded. New points are found only when the RSI[7] hits an extreme low or high, so the distance between points will vary. If you increase the parameter from 7 to 9 for example, you will experience trend lines that are based on more long-term trends.

Wing
10 years ago
#

Yes, investigate as much as you want. For more insight, you can view the linet1, linet2 etc. individually on the chart. That will show you exactly what trend lines are found and used for the bands.

Nicolas
10 years ago
#

Hello Wing, nice to see your name into the Library too :) I appreciate your help on forums!

I need to investigate more into your interesting indicator, I think I might need some time to perfectly understand the concept behind its code. Thanks for the contribution, I'm looking forward for more interesting things from your own research :)

ProRealCode ProRealCode
Loading...