Code Library / Candlestick Patterns
Pine Script 3 White Soldiers
Detect Three White Soldiers and Three Black Crows.
Language: Pine Script · Category: Candlestick Patterns · Tags: three white soldiers, three black crows, Pine Script, candlestick, continuation
Source code
//@version=5
indicator("3 Soldiers/Crows",overlay=true)
isBull(i)=>close[i]>open[i]; isBear(i)=>close[i]<open[i]
tws=isBull(0) and isBull(1) and isBull(2) and close[0]>close[1] and close[1]>close[2]
tbc=isBear(0) and isBear(1) and isBear(2) and close[0]<close[1] and close[1]<close[2]
plotshape(tws,"3WS",shape.arrowup,location.belowbar,color.green)
plotshape(tbc,"3BC",shape.arrowdown,location.abovebar,color.red)How to use this snippet
This is a building block, not a finished trading system. Paste it into your own Pine Script project, compile it, and test it on a demo account with your broker's real spreads before relying on it. You can convert it to MQL4 or MQL5 with the Pine Script converter.