Hello,
iNDays Channel is a VertexFX VTL Client side script. It plots support resistance channel on price chart. The support resistance levels are identified as the last fractal high and fractal low. The resistance line is colored blue, the support line is colored red and the yellow line is the middle line of the channel. The blue and red dots mark the fractal high and low.
The channel can be used for breakout trading. When price break below the red line (bottom line) and stays below it, a down trend is emerging. Price breaking above blue line (upper line) and staying above it indicates an up trend emerging. In consolidation, price will remain within the channel. The channel can be used as stop loss level also. Trades can be opened with breakout of the channel or in combination with other indicators confirming a breakout.

iNDays Channel is a VertexFX VTL Client side script. It plots support resistance channel on price chart. The support resistance levels are identified as the last fractal high and fractal low. The resistance line is colored blue, the support line is colored red and the yellow line is the middle line of the channel. The blue and red dots mark the fractal high and low.
The channel can be used for breakout trading. When price break below the red line (bottom line) and stays below it, a down trend is emerging. Price breaking above blue line (upper line) and staying above it indicates an up trend emerging. In consolidation, price will remain within the channel. The channel can be used as stop loss level also. Trades can be opened with breakout of the channel or in combination with other indicators confirming a breakout.
Quote:
|
'''############################################### ###################################### '''#### Script Name: indays_Channel ###### '''#### Author : Joy Sebastian ###### '''#### eMail : ###### '''#### Date : 24-08-2015 19:47:37 ###### '''#### Description: indays Channel identifies the up and down fractals. ###### '''#### It plots the fractals with the light blue and red dots on chart. ###### '''#### The channel is constructed with the most recnt up and down fractal ###### '''#### high/low, the yellow middle line being the average of the upper and ###### '''#### lower lines ###### '''############################################### ###################################### ''' Parameter Declarations Dim LeftBars, RightBars, RightAsLeft, AddToLevel '''################### PARAMETERS ################################################## #### LeftBars = 2 ''' fractal strength on left side RightBars = 2 ''' fractal strength on right side RightAsLeft = true AddToLevel = 5 ''' Pips to draw the channel above/below fractal high/low '''############################################### ###################################### ''' Buffers Dim pick(), trok(), up1(), lo1(), c1(), ut1(), lt1() Dim indKeyPick, indKeyTrok, indKeyUp1, indKeylo1, indKeyC1, indKeyUt1, indKeylt1 Dim Len, point Dim bars0, mode, processing Dim aryHigh(), aryLow(), aryTime() ''' Function to return the index of the high bar between startBar and endBar private function getHighx(startBar, endBar) highest = aryHigh(cint(startBar)) hBar = startBar for ii = cint(startbar) +1 to cint(endbar) if aryHigh(ii) > highest then highest = aryHigh(ii) hBar = ii end if getHighx = hBar next end function ''' Function to return the index of the low bar between startBar and endBar private function getLowx(startBar, endBar) lowest = aryLow(Cint(startBar)) lBar = startBar for ii = Cint(startBar) + 1 to Cint(endBar) if aryLow(ii) < lowest then lowest = aryLow(ii) lBar = ii end if next getLowx = lBar end function Public Sub main() processing = true ''' Is main ended ? bars0 = CINT(Bars(0)) Dim start ''' start identifes the bar to begin indicator calculation, to avoid refrenceing back ''' negative values for price arrays subscript If LeftBars > RightBars Then start = LeftBars*2+1 ''' start is the minimum bars required for indicator calculation Else start = RightBars*2+1 End If If bars0 <= start Then Exit Sub ''' Not enough bars End If ''' create the price arrays If CopyHigh( 0,1,CLNG(bars0),aryHigh ) = -1 Then Exit Sub End IF If CopyLow(0, 1, CLNG(bars0), aryLow ) = -1 Then Exit Sub End If If CopyTime(0, 1, CLNG(bars0), aryTime ) = -1 Then Exit Sub End If If mode = 1 Then ''' main is called from onTick event ''' Adjust last bar prices in price arrays aryTime(bars0) = GetTime(0,CINT(bars0)) aryHigh(bars0) = GetHigh(0,CINT(bars0)) aryLow(bars0) = GetLow(0,CINT(bars0)) End if Dim limit If mode = 0 Then limit = start End if If mode = 1 Or mode = 2 Then limit = bars0-start ''' calculate the indicator on minimum bars from right end of chart, to speed up indicator End If If mode = 0 or mode = 2 Then Redim Preserve pick(bars0-1), trok(bars0-1), up1(bars0-1), lo1(bars0-1), c1(bars0-1), ut1(bars0-1), lt1(bars0-1) End If For i = limit + 1 To Bars0 Dim p p = i - rightBars pick(p-1) = 0 trok(p-1) = 0 up1(i-1) = up1(i-2) lo1(i-1) = lo1(i-2) ut1(i-1) = ut1(i-2) lt1(i-1) = lt1(i-2) c1(i-1) = c1(i-2) Dim hb, lb hb = getHighx(i-len+1, i) lb = getLowx(i-len+1, i) If hb = p Then pick(p-1) = aryHigh(p) up1(i-1) = aryHigh(p) + Point * AddToLevel ut1(i-1) = aryTime(p) If ut1(i-1) <> CSTR(0) And lt1(i-1) <> CSTR(0) Then c1(i-1) = (up1(i-1)/2 + lo1(i-1)/2) Else c1(i-1) = 0 End if End If If lb = p Then trok(p-1) = aryLow(p) lo1(i-1) = aryLow(p)- Point*AddToLevel lt1(i-1) = aryTime(p) c1(i-1) = up1(i-1)/2 + lo1(i-1)/2 If ut1(i-1) <> CSTR(0) And lt1(i-1) <> CSTR(0) Then c1(i-1) = (up1(i-1)/2 + lo1(i-1)/2) Else c1(i-1) = 0 End If End If Next If Mode = 0 Then ''' When indicator iniiializing, attach indicator to chart indKeyPick = AddCustomIndicator(0, pick, 1, false) SetDrawingStyle 0, CSTR(indKeyPick), DRAW_ARROWS SetArrowStyle 0, CSTR(indKeyPick), 159 LineColor 0, CSTR(indKeyPick), RGBCOLOR(0,191,255) indKeyTrok = AddCustomIndicator(0, trok, 1, false) SetDrawingStyle 0, CSTR(indKeyTrok), DRAW_ARROWS SetArrowStyle 0, CSTR(indKeyTrok), 159 LineColor 0, CSTR(indKeyTrok), RGBCOLOR(255,0,0) indKeyUp1 = AddCustomIndicator (0, up1, 1, false) LineColor 0, CSTR(indKeyUp1), RGBCOLOR(0,191,255) indKeyLo1 = AddCustomIndicator (0, lo1, 1, false) LineColor 0, CSTR(indKeyLo1), RGBCOLOR(255,0,0) indKeyC1 = AddCustomIndicator (0, c1, 1, false) LineColor 0, CSTR(indKeyC1), RGBCOLOR(250,255,0) End If processing = false End Sub ''' <summary> ''' The function is generated when a new tick is received for any symbol ''' </summary> Public Sub OnTick(symbolName) If symbolName <> ChartSymbol(0) Then Exit Sub End If Mode = 1 Main() ObjectSeriesSetValue 0, CSTR(indKeyPick), CLNG(bars0-RightBars), CDBL(pick(uBound(pick)-rightBars)) ObjectSeriesSetValue 0, CSTR(indKeyTrok), CLNG(bars0-RightBars), CDBL(trok(uBound(trok)-rightBars)) ''' The above 2 object series are plotting the fractals, they must be updated on the "rightBars" back from last bar ''' Below are challe object sries and they are updated on last bar only ObjectSeriesSetValue 0, CSTR(indKeyup1), CLNG(bars0), CDBL(up1(uBound(up1))) ObjectSeriesSetValue 0, CSTR(indKeylo1), CLNG(bars0), CDBL(lo1(uBound(lo1))) ObjectSeriesSetValue 0, CSTR(indKeyC1), CLNG(bars0), CDBL(c1(uBound(c1))) End Sub ''' <summary> ''' The function is generated when initialization script ''' </summary> Public Sub OnInit() If RightAsLeft Then RightBars = LeftBars End If len = LeftBars + RightBars + 1 mode = 0 If SymbolInfoInteger(CStr(ChartSymbol()),SYMBOL_PIP_L OCATION,Point) then Point = 10^Point End if End Sub ''' <summary> ''' The function is generated when deinitialization script ''' </summary> Public Sub OnDeInit() ObjectDelete 0, CSTR(indKeyPick) ObjectDelete 0, CSTR(indKeyTrok) ObjectDelete 0, CSTR(indKeyUp1) ObjectDelete 0, CSTR(indKeyLo1) ObjectDelete 0, CSTR(indKeyC1) End Sub ''' <summary> ''' The OnTimer function called when the timer event occurs ''' </summary> Public Sub OnTimer() ''''TODO: Timer Function End Sub ''' <summary> ''' The OnCalculate function called when a new candle received ''' </summary> Public Sub OnCalculate(symbol, symbolPeriod, openVal, highVal, lowVal, closeVal) If symbol <> ChartSymbol(0) Then Exit Sub End If mode = 2 Main() SetIndicatorData 0,CSTR(indKeyPick), CDBL(pick(Ubound(pick))) SetIndicatorData 0,CSTR(indKeyTrok), CDBL(trok(Ubound(trok))) SetIndicatorData 0,CSTR(indKeyUp1), CDBL(up1(Ubound(up1))) SetIndicatorData 0,CSTR(indKeyLo1), CDBL(lo1(Ubound(lo1))) SetIndicatorData 0,CSTR(indKeyC1), CDBL(c1(Ubound(c1))) End Sub ''' <summary> ''' Raise when all data are loaded after Login ''' </summary> Public Sub AllDataLoaded() End Sub ''' <summary> ''' Raise when Account Selected ''' </summary> Public Sub AccountSelected(accountNumber) End Sub ''' <summary> ''' Raise when the server returns order result ''' </summary> Public Sub OnOrderTrade(actionType ,orderID , returnValue) End Sub ''' <summary> ''' Raise when the server returns position result ''' </summary> Public Sub OnPositionTrade (actionType ,ticketID) End Sub ''' <summary> ''' Raise when the server returns Manage SL/TP Orders after calling RequestManageOrders method ''' </summary> public sub OnManageOrdersReceived(manageOrders) End Sub |
Aucun commentaire:
Enregistrer un commentaire