JustUncleL

Price Action Doji Harami v0.2 by JustUncleL

This is an updated and final version of this indicator. This version distinguishes between the true Harami and the other Doji candlestick patterns as used with the Heikin Ashi candle charts. These candle patterns indicate a potential trend reversal or pullback.
The patterns identified are:
- Bearish Harami (Red Highlight above Bar):
One to three (default 3) large body Bull (green) candles followed by a small (red)
or no body candle (less than 0.5pip) with wicks top and bottom that are at least 60% of candle.
- Bullish Harami (Green Highlight below Bar):
One to three (default 3) large body Bear (red) candles followed by a small (green)
or no body candle (less than 0.5pip) with wicks top and bottom that are at least 60% of candle.
- Bearish Doji (Fuchsia Highlight above Bar):
One to three (default 3) large body Bull (green) candles followed by a small (green)
with wicks top and bottom that are at least 60% of candle.
- Bullish Doji (Aqua Highlight below Bar):
One to three (default 3) large body Bear (red) candles followed by a small (red)
with wicks top and bottom that are at least 60% of candle.

You can optionally specify how large the candles prior to Harami/ Doji are in pips, default is 0 pip.
If you set this to zero then it will have no candle size consideration. You can also specify how many look back candles (1-3) are used in Harami/ Doji calculations (default 3).

Included option to perform Calculations purely on Heikin Ashi candles, this helps when you want to see the HA Doji /Harami bars with the normal candle stick chart.

Also can optionally set an alert condition for when Harami/ Doji found, this also displays a circle on the bottom of the screen when alert is triggered.
開源腳本

秉持真正的TradingView精神,該腳本的作者將其開源發佈,因此交易者可以理解和驗證它。為作者加油!您可以免費使用它,但是在發佈中重複使用此程式碼受網站規則的約束。您可以把它加入到常用以在圖表上使用它。

想在圖表上使用此腳本?
//@version=2
//
// Name: Price Action Doji Harami v0.2 by JustUncleL
// By: JustUncleL
// Date: 4-Sep-2016
// Version: v0.2
//
// Description:
//   Identifies the Harami + Doji candlestick patterns as used with the
//   Heikin Ashi candles. These candles indicates a potential trend reversal.
//   The patterns identified are:
//   - Bearish Harami (Red Highlight above Bar): 
//       Three(3) large body Bull (green) candles followed by a small (red) 
//       or no body candle with wicks top and bottom that are at least 60% of candle.
//   - Bullish Harami (Green Highlight below Bar): 
//       Three(3) large body Bear (red) candles followed by a small (green) 
//       or no body candle with wicks top and bottom that are at least 60% of candle.
//   - Bearish Doji (Fuchsia Highlight above Bar): 
//       Three(3) large body Bull (green) candles followed by a small (green) 
//       with wicks top and bottom that are at least 60% of candle.
//   - Bullish Doji (Aqua Highlight below Bar): 
//       Three(3) large body Bear (red) candles followed by a small (red)
//       with wicks top and bottom that are at least 60% of candle.
//
//   You can optionally specify large candle in pips previous to Doji, default is 1 pip.
//   If you set this to zero then it will have no candle size consideration.
//   Included option to perform Calculations purely on Heikin Ashi candles, this helps
//   when you want to still see the HA Doji/Harami with the normal candle chart.
//
// references:
//  - Price Action Candles v0.3 by JustUncleL
//  
// modifications:
//  0.2 Modified Doji caculations to seperate true Harami patterns. 
//      Included option to show/alert all Doji's patterns.
//      Included option to Calculate Doji/Harami patterns only on Heikin Ashi candles.
//      Included option to specify how many candles (1 to 3) to look back to test Doji/Harami pattern.
//  0.1 Original Beta version.
//
study(title = "Price Action Doji Harami v0.2 by JustUncleL", shorttitle="PACDOJI v0.2 by JustUncleL", overlay = true, max_bars_back=3000)
//

pctDw = input(60,minval=0,maxval=90,title="Doji, Min % of Range of Candle for Wicks")
pipMin= input(0,minval=0,title="Doji, Previous Candle Min Pip Body Size")
sname=input(true,title="Show Price Action Bar Names")
cbar = input(false,title="Highlight Harami & Doji Bars")
sHm    = input(false,title="Show Only Harami Style Doji's")
setalm = input(true, title="Generate Alert for Harami & Doji Bars")
uha   =input(true, title="Use Heikin Ashi Candles for Calculations")
bars = input(3,minval=1,maxval=3,step=1,type=integer, title="Doji, Number of Lookback Bars")
//
// Use only Heikinashi Candles for all calculations
srcclose = uha ? security(heikinashi(tickerid), period, close) : close
srcopen = uha ? security(heikinashi(tickerid), period, open) : open
srchigh = uha ? security(heikinashi(tickerid), period, high) : high
srclow = uha ?security(heikinashi(tickerid), period, low) : low

//
pip = syminfo.mintick
range = srchigh - srclow


// Calculate Doji/Harami Candles
pctCDw = (pctDw/2) * 0.01
pctCDb = (100-pctDw) * 0.01

//Lookback Candles for bulls or bears
lbBull = bars==1? srcopen[1]>srcclose[1]: bars==2? (srcopen[1]>srcclose[1] and srcopen[2]>srcclose[2]): bars==3?(srcopen[1]>srcclose[1] and srcopen[2]>srcclose[2] and srcopen[3]>srcclose[3]):false
lbBear = bars==1? srcopen[1]<srcclose[1]: bars==2? (srcopen[1]<srcclose[1] and srcopen[2]<srcclose[2]): bars==3?(srcopen[1]<srcclose[1] and srcopen[2]<srcclose[2] and srcopen[3]<srcclose[3]):false

//Lookback Candle Size only if mininum size is > 0
lbSize = pipMin==0? true : bars==1 ? (abs(srcopen[1]-srcclose[1])>pipMin*pip) :
  bars==2 ? (abs(srcopen[1]-srcclose[1])>pipMin*pip and abs(srcopen[2]-srcclose[2])>pipMin*pip) :
  bars==3 ? (abs(srcopen[1]-srcclose[1])>pipMin*pip and abs(srcopen[2]-srcclose[2])>pipMin*pip and abs(srcopen[3]-srcclose[3])>pipMin*pip) :
  false

dojiBu = (srcopen[1] >= max(srcclose,srcopen) and srcclose[1]<=min(srcclose,srcopen)) and lbSize and
  (abs(srcclose-srcopen)<range*pctCDb and (srchigh-max(srcclose,srcopen))>(pctCDw*range) and (min(srcclose,srcopen)-srclow)>(pctCDw*range))? 1 : 0

dojiBe = (srcclose[1] >= max(srcclose,srcopen) and srcopen[1]<=min(srcclose,srcopen)) and lbSize and
  (abs(srcclose-srcopen)<range*pctCDb and (srchigh-max(srcclose,srcopen))>(pctCDw*range) and (min(srcclose,srcopen)-srclow)>(pctCDw*range))? 1 : 0
  
haramiBull = (srcopen<=srcclose or (max(srcclose,srcopen)-min(srcclose,srcopen))<pip*0.5) and lbBull and dojiBu
haramiBear = (srcopen>=srcclose or (max(srcclose,srcopen)-min(srcclose,srcopen))<pip*0.5) and lbBear and dojiBe

dojiBull = not sHm and not haramiBull and not haramiBear and lbBull and dojiBu
dojiBear = not sHm and not haramiBull and not haramiBear and lbBear and dojiBe

//
plotshape(haramiBear and sname?srchigh:na,title="Bearish Harami",text='Bearish\nHarami',color=red, style=shape.arrowdown,location=location.abovebar)
plotshape(haramiBear and cbar?max(srcopen,srcclose):na,title="Bear Colour Harami",color=red, style=shape.circle,location=location.absolute,size=size.normal)
//
plotshape(haramiBull and sname?srclow:na,title="Bullish Harami",text='Bullish\nHarami',color=green, style=shape.arrowup,location=location.belowbar)
plotshape(haramiBull and cbar?max(srcopen,srcclose):na,title="Bull Colour Harami",color=green, style=shape.circle,location=location.absolute,size=size.normal)
//
plotshape(dojiBear and sname?srchigh:na,title="Bearish Doji",text='Bearish\nDoji',color=fuchsia, style=shape.arrowdown,location=location.abovebar)
plotshape(dojiBear and cbar?max(srcopen,srcclose):na,title="Bear Colour Doji",color=fuchsia, style=shape.circle,location=location.absolute,size=size.normal)
//
plotshape(dojiBull and sname?srclow:na,title="Bullish Doji",text='Bullish\nDoji',color=aqua, style=shape.arrowup,location=location.belowbar)
plotshape(dojiBull and cbar?max(srcopen,srcclose):na,title="Bull Colour Doji",color=aqua, style=shape.circle,location=location.absolute,size=size.normal)

// Only Alert harami Doji's
bcolor = haramiBull ? 1 : haramiBear ? 2 : dojiBull ? 3 : dojiBear ? 4 : 0
baralert = setalm and bcolor>0
alertcondition(baralert,title="PACDOJI Alert",message="PACDOJI Alert")

//
plotshape(na(baralert[1])?na:baralert[1], transp=0,style=shape.circle,location=location.bottom, offset=-1,title="Bar Alert Confirmed", 
  color=bcolor[1]==1 ? green : bcolor[1]==2? red : bcolor[1]==3? aqua : bcolor[1]==4? fuchsia : na)

//EOF
JustUncleL

評論

Hello, I am using Heikinashi hourly chart for trading. Take previous day's highest close/open in hourly chart (Heikinashi) as support/ resistance. Can you please explain how I can draw support/resistance line?
回覆
nice work
回覆
Is it possible to scan for stocks with this set up? Thank you!
回覆
@Sree6, The TV scanner currently cannot use scripts as a filter.
+2 回覆
Sree6 JustUncleL
@JustUncleL, Thank you!
回覆
nice, do you make anything for Metatrader 4 ?
回覆
JustUncleL cobra5000
@cobra5000, No, I do not code for Metatrader.
回覆
ok!!!
回覆
Good job!
回覆
pls give permisson to use it sir
回覆
首頁 股票篩選器 外匯篩選器 加密貨幣篩選器 全球財經日曆 關於 圖表功能 價格 推薦朋友 網站規則 幫助中心 網站 & 經紀商解決方案 小工具 圖表解決方案 輕量圖表庫 部落格 & 新聞 推特
概覽 個人資料設定 賬戶和賬單 推薦朋友 代幣 我的客服工單 幫助中心 私人訊息 在線聊天 登出