Summary: The drawing script draws two parallel trend lines, forming the channel in the trend direction and connecting extreme maximum and minimum prices
' Make sure that x1 is the smaller of the two points. If (x1 > x2) Then Define tempX As Integer = x1 x1 = x2 x2 = tempX Define tempY As Number = y1 y1 = y2 y2 = tempY End If ' Calculate the slope. Define m As Number = (y2 - y1) / (x2 - x1) Define y As Number ' If the two points don 't share a common X value then calculate all other points. If (x1 <> x2) Then Define firstIndex As Integer = index ' Draw all points in between the two points. For x As Integer = x1 To x2 Step 1 y = y1 + (x - x1) * m If (x = x1) DrawingSetPoint(index, x, y, "", index) Else DrawingSetPoint(index, x, y, "", index) End If index += 1 Next DrawingSetPoint(firstIndex, x1, y1, "", index - 1) Else DrawingSetPoint(index ,x1, y1, "", index) index += 1 DrawingSetPoint(index, x2, y2, "", index - 1) index += 1 End If Return index
' Get the X position of core point 0. Define line1X As Integer = DrawingCorePointBarIndex(0) ' Get the Y position of core point 0. Define line1Y As Number = DrawingCorePointValue(0) ' Get the X position of core point 1. Define line2X As Integer = DrawingCorePointBarIndex(1) ' Get the Y position of core point 1. Define line2Y As Number = DrawingCorePointValue(1) Define index As Integer = 0 ' Draw the top line. index = DrawLine(line1X, line1Y, line2X, line2Y, index) ' Draw the parallel line. index = DrawLine(line1X, line1Y + _distance, line2X, line2Y + _distance, index)
' Initialize the Equidistant Channel. DrawingInitialize(symbolIndex, 2) _distance = distance