Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {*****************************************************************************
- Description : HeikinAshiSyn - This Paintbar is a Variation of the Heikin Ashi Candlestick to assist in reading the trend.
- ******************************************************************************}
- inputs: UpColor(RGB(0,192,255)),
- DnColor(RGB(255,128,64)),
- HiLoColor(DarkGray),
- CompBars(0),
- SmoothHA(False),
- SmoothAvgType(1 {1 JTHull, 2 SMA, 3 EMA, 4 wAverage} ),
- SmoothLength(6),
- ReverseColor(false);
- vars: haClose(0),haOpen(0),haHigh(0),haLow(0),
- color(0), newHi(0), newLo(0),
- iOpen(0), iClose(0), iHi(0), iLo(0)
- ;
- if SmoothHA = False then begin;
- iOpen = Open;
- iClose = Close;
- iHi = High;
- iLo = Low;
- end else begin;
- if SmoothAvgType = 1 then begin;
- iOpen = jthma(Open, SmoothLength);
- iClose = jthma(Close, SmoothLength);
- iHi = jthma(High, SmoothLength);
- iLo = jthma(Low, SmoothLength);
- end;
- if SmoothAvgType = 2 then begin;
- iOpen = average(Open, SmoothLength);
- iClose = average(Close, SmoothLength);
- iHi = average(High, SmoothLength);
- iLo = average(Low, SmoothLength);
- end;
- if SmoothAvgType = 3 then begin;
- iOpen = xAverage(Open, SmoothLength);
- iClose = xAverage(Close, SmoothLength);
- iHi = xAverage(High, SmoothLength);
- iLo = xAverage(Low, SmoothLength);
- end;
- if SmoothAvgType = 4 then begin;
- iOpen = wAverage(Open, SmoothLength);
- iClose = wAverage(Close, SmoothLength);
- iHi = wAverage(High, SmoothLength);
- iLo = wAverage(Low, SmoothLength);
- end;
- end;
- if BarNumber > 1 then begin
- haClose = (iOpen+iHi+iLo+iClose)/4;
- haOpen = (haOpen [1] + haClose [1])/2 ;
- haHigh = MaxList(iHi, haOpen, haClose) ;
- haLow = MinList(iLo, haOpen, haClose) ;
- if haClose > haOpen then
- color = UpColor
- else
- color = DnColor;
- if CompBars > 0 then begin;
- for value1 = 1 to CompBars begin
- if haOpen <= MaxList(haOpen[value1],haClose[value1]) and
- haOpen >= MinList(haOpen[value1],haClose[value1]) and
- haClose <= MaxList(haOpen[value1],haClose[value1]) and
- haClose >= MinList(haOpen[value1],haClose[value1]) then
- color = color[value1];
- end;
- end;
- if ReverseColor then begin;
- if color = UpColor then
- color = DnColor
- else
- color = UpColor;
- end;
- Plot1( haOpen, "Open", color ) ;
- Plot2( haClose, "Close", color ) ;
- Plot3( haHigh, "High", HiLoColor ) ;
- Plot4( haLow, "Low", HiLoColor ) ;
- end else begin;
- haOpen = iOpen;
- haClose = (iOpen+iHi+iLo+iClose)/4;
- haHigh = MaxList( iHi, haOpen, haClose);
- haLow = MinList( iLo, haOpen,haClose);
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement