Saturday, September 04, 2010

Speed Resistance Lines [SRL]

Descripton
Summary:
The drawing script speedlines measure the rate of ascent or descent of a trend of the underlying symbol price, as it develops. 

Developer:
Edson Gould

Interpretation:
1. 2/3 Line Support: When the underlying symbol price is falling, support should be found above the 2/3 line.
2. 1/3 Line Support: When prices do fall below the 2/3 line, they should quickly drop to the 1/3 line where they should then again find support.
3. 1/3 Line Resistence: When the underlying symbol price is rising, resistance should be found below the 1/3 line.
4. 2/3 Line Resistence: When prices do raise above the 1/3 line, they should quickly raise to the 2/3 line where they should then again find resistence.


Variables
TypeIdentifierDescription

OnInitialize
Function Parameters
TypeIdentifierDescription
SymbolsymbolIndexUse for the underlying symbol index on which to draw the Speed Resistance Lines.
Implementation
	 ' Initialize the Speed Resistance Lines.	
	DrawingInitialize(symbolIndex, 2)

OnDraw
Function Parameters
TypeIdentifierDescription
Implementation
	 ' Get the X value of core point 0.
	Define line1X As Integer = DrawingCorePointBarIndex(0)
	 ' Get the Y value of core point 0.
	Define line1Y As Number = DrawingCorePointValue(0)
	 ' Get the X value of core point 1.
	Define line2X As Integer = DrawingCorePointBarIndex(1)
	 ' Get the Y value of core point 1.
	Define line2Y As Number = DrawingCorePointValue(1)
	Define line3X As Integer = line2X
	Define line3Y As Number  = line1Y + 2 / 3 * (line2Y - line1Y)
	Define line4X As Integer = line2X
	Define line4Y As Number = line1Y + 1 / 3 * (line2Y - line1Y)
	If (line1Y  > line2Y) Then
		line3Y = line2Y + 2 / 3 * (line1Y - line2Y)
		line4Y = line2Y + 1 / 3 * (line1Y - line2Y)
	End If
	
	Define index As Integer = 0
	 ' Draw the top line.
	index = DrawingSetLine(index, line1X, line1Y, "", line2X, line2Y, "")
	 ' Draw the 2 / 3 line.
	index = DrawingSetLine(index, line1X, line1Y, "", line3X, line3Y, "")
	 ' Draw the 1 / 2 line.
	index = DrawingSetLine(index, line1X, line1Y, "", line4X, line4Y, "")

Copyright © 2010 IQBroker, LLC. All rights reserved.