Dears members,
Please find here below a screener to identify the Morning and Evening stars. As you know, these candlestick structures are very relevant to identify the top and bottom of a trend. It’s also a strong buy and sell signal.
This code has been update to stick as much as possible to the theory of candlestick.
Do not hesitate to contact me or consult my website Boursomaniac for other strategies.
//Author: Boursomaniac
//Date: 19-02-2017
// Data Set-up
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 Signal = -1
If EvStar then
Go = -1
endif
//Go Long Signal = 1
If MornStar then
Go = 1
endif
Condition = (EvStar Or MornStar)
SCREENER[Condition] (Go AS "Go")