Hi all,
I’m just trying to create an indicator for morning start and evening star pattern.. i have got most of it from a screener in the forum.. but not sure what i’m doing wrong and doesn’t work.. appreciate if anyone can help me out on this???
just trying to get an arrow up or down when the morning or evening star appears ??
DEFPARAM CalculateOnLastBars = 1000
BaseCandle = 0
Open0 = Open[BaseCandle]
Close0 = Close[BaseCandle]
Open1 = Open[BaseCandle + 1]
Close1 = Close[BaseCandle + 1]
Open2 = Open[BaseCandle + 2]
Close2 = Close[BaseCandle + 2]
Open3 = Open[BaseCandle + 3]
Close3 = Close[BaseCandle + 3]
// Control height
DojiBody = ABS(Close1-Open1)
HeightLong = 7*DojiBody
// ++++++++++EVENING STAR++++++++++++
// Calcul height candelstick 2 and 2
CandleElong0 = ABS(Close0-Open0)
CandleElong2 = ABS(Close0-Open0)
// Validate Candlestick color + position
CandleE0 = Open0 > Close0 And Open0 < Close1 AND (CandleElong0>=HeightLong)
CandleE1 = Open1>Open0 AND Close1>Close0 AND Close1>Close2 AND Open1>Open2
CandleE2 = Open2 < Close2 And Close2 > Close3 And Open3 < Close3 AND (CandleElong2>=HeightLong)
EvStar = CandleE0 AND CandleE1 AND CandleE2
// ++++++++++MORNING STAR++++++++++++
// Calcul height candelstick 2 and 2
CandleMlong0 = ABS(Close0-Open0)
CandleMlong2 = ABS(Close0-Open0)
// Validate Candlestick color + position
CandleM0 = Open0 < Close0 And Open0 > Close1 AND (CandleMlong0>=HeightLong)
CandleM1 = Open1<Open0 AND Close1<Close0 AND Open1<Open2 AND Close1<Close2
CandleM2 = Open2 > Close2 And Close2 < Close3 And Open3 > Close3 AND (CandleMlong2>=HeightLong)
//Morning Star
MornStar = CandleM0 AND CandleM1 AND CandleM2
//Go Short
If EvStar then
DRAWARROWDOWN(CandleE1,LOW+5*pointsize) COLOURED(0,255,10)
endif
//Go Long
If MornStar then
DRAWARROWUP(CandleM1,LOW-5*pointsize) COLOURED(0,255,10)
endif
return
Have you seen this indicator here:
Candlestick patterns recognition
In lines 44 and 49 replace CandleE1 and CandleM1 with BARINDEX, in line 44 you should also replace Low with HIGH.