Morning Star rules not respected
Forums › ProRealTime English forum › ProBuilder support › Morning Star rules not respected
- This topic has 20 replies, 3 voices, and was last updated 5 years ago by Bard.
Tagged: Morning Star
-
-
03/19/2019 at 6:28 PM #94059
Hi
I can’t find a good Morning Star candlestick pattern on here that respects Charles Bulkowski’s definition. He is regarded as the master on candlestick studies publishing % return tables for candlestick patterns. See http://thepatternsite.com/MorningStar.html
Eg: MorningStar, Bullish Reversal, Accuracy = 78% in a Bull Market/65% Bear Market with a very low occurrence.
I have amalgamated different code from prorealcode to obtain the closest to Bulkowski’s definition for this pattern. In the first screenshot the last green candle (with a white arrow after the Morning Star) doesn’t respect the rule that it should climb up to over half the opening candles body length (first long white long candle), probably because maybe I haven’t coded it correctly?
I think adding a bullish pinbar code (on this forum) for extending the Morning Star candle shadow may also help to respect the rules further.
(First screen Morning Star pattern from XAGUSD Daily 9th Feb 2000)
Morning Star123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051if range>0 thenratio=body/rangeelseratio=0endiflongcandle= (ratio>0.7)body=close-openabody=abs(body)MorningStar = 0signal = 0if MorningStar thensignal = 5endif//text color// white = 255,255,255 ; black = 0,0,0r = 255g = 51b = 51//Orig//e1 = close[2] < open[2] // red candle//e2 = open[1] < close[2] and close[1] < close[2] and low[1] < close[2] // candle entirely below predecessor's body//e3 = close[0] > open[0] and open[0] > open[1] and high[0] > low[1] // green candle with a gap//e4 = range[1] > (range[2] / 2 ) and close[0] > (open[2] - close[2]/2) // morning star's range is small compared to preceding candlee1 = body[2]<0 and body>0 and longcandle[2] // red candlee2 = open[1]<close[2] and low[1]<low[2] and low[1]<low[0] and high[1]<open[2] and high[1]<close [0] and abody[1]<abody[2] and abody[1]<abody[0] // small candle entirely below predecessor's bodye3 = open[0]>close[1] and ratio[1]<0.3 and close[0] > (open[2] - close[2]/1.5)//green candle with a gapif e1 and e2 and e3 thenMorningStar = 1endifif MorningStar = 1 thensignal = 1endifif e1 and e2 and e3 thenDRAWTEXT("Morning Star", barindex, high, Dialog, Standard, 20) COLOURED(R,G,B)DRAWARROWUP(barindex,low) COLOURED(0,155,10)endifReturn signal > 003/19/2019 at 6:49 PM #94064I suggest that lines 1 through 7 be moved AFTER line 11, since at line 2 BODY has not yet been defined, so it will refer to the body of the previous candlestick.
03/19/2019 at 10:10 PM #94087Thanks @Robertogozzi, that makes logical sense, problem is that it now produces zero Morning Stars patterns? There were 4 with Daily Silver so I relaxed the rules for longcandle= (ratio>0.7) changing it to longcandle= (ratio>0.5) and also (open[2] – close[2]/1.5) changing it to (open[2] – close[2]/2). No patterns. I have tried it on 10,000 units of Daily silver, £/$ $/CHF and £/Yen, yet no patterns? (Please screens of “Morning Star 2” indicator now missing whereas the second image shows it produced a pattern before reversing the body code)
03/19/2019 at 11:32 PM #94096I changed it a bit:
Morning Star1234567891011121314151617181920212223242526272829303132333435363738394041offset1 = 50 * pipsizeoffset2 = offset1 * 4body=close-openabody=abs(body)if range>0 thenratio=abody/rangeelseratio=0endiflongcandle= (ratio>0.5) //0.7//MorningStar = 0signal = 0//if MorningStar then//signal = 5//endif//text color// white = 255,255,255 ; black = 0,0,0r = 255g = 51b = 51//Orig//e1 = close[2] < open[2] // red candle//e2 = open[1] < close[2] and close[1] < close[2] and low[1] < close[2] // candle entirely below predecessor's body//e3 = close[0] > open[0] and open[0] > open[1] and high[0] > low[1] // green candle with a gap//e4 = range[1] > (range[2] / 2 ) and close[0] > (open[2] - close[2]/2) // morning star's range is small compared to preceding candlee1 = body[2]<0 and body>0 and longcandle[2] // red candlee2 = open[1]<close[2] and low[1]<low[2] and low[1]<low[0] and high[1]<open[2] and high[1]<close[0] and abody[1]<abody[2] and abody[1]<abody[0] // small candle entirely below predecessor's bodye3 = open[0]>close[1] and ratio[1]<0.5 and close[0] > open[2]//(open[2] - close[2]/1.5)//green candle with a gapif e1 and e2 and e3 then//MorningStar = 1//endif//if MorningStar = 1 thensignal = 1//endif//if e1 and e2 and e3 thenDRAWTEXT("Morning Star", barindex,low-offset2, Dialog, Standard, 14) COLOURED(R,G,B)DRAWARROWUP(barindex,low-offset1) COLOURED(0,155,10)endifif signal thenendifReturn// signalI used it on the price chart, not below.
The second and third last lines are intended to use the variable SIGNAL only (dummy lines).
As you can see I commented out many unnecessary lines and modified line 28 (your line 35).
I also addet the first two line to set offset values to plot at a distance from the candles.
I also changed line 6 (your line 2).
Few patterns were found, but this may depend on settings. The pattern recognition seems to work.
1 user thanked author for this post.
03/20/2019 at 9:49 AM #94130That’s much appreciated @Robertogozzio, thanks for re-writing this code,
A number of thoughts occur to me:
Can you think why the first candle of the Morning Star formation is still very short? In your first screenshot both red candles don’t have a long body. I believe this is a crucial part of the pattern where the Bears think they have the upper hand and then the price gaps down to the Star candle only to powerfully reverse direction after it, (i.e. an exhaustion point).
There appears to be no gap between the opening of the third green candle and the Morning Star candle in the first two examples? (Hence the name “Star”).
Also I think it’s important for the third green candle to cover / retrace back to at least over half the height of the first long red candles body – which they do – but in these examples is that only because the first red candles are all short in body?
Nice offset tip too!
Cheers
Bard03/20/2019 at 11:53 AM #94142Line 10 (my version’s) deals with the size of the body, but not with the size of the range. A big body is only evaluated with reference to its range, if it’s a candle having a small range, then its body will be even smaller!
You must define a way to translate into code what you would do when sitting in front of your PC; when you watch your charts, when do you say “this candle is big enough”:
- when it has a big range, regardless of its body size?
- when it has a big body, regardless of its range?
then code then accordingly. You might use averages to compute the average (body or range) size of the last, say 50, candle and consider a candle as being a big one if it exceeds that average.
Example 1 (body size average):
123Body = abs(close - open) //definition of bodyBodySize = average[50,0](Body) //average of the body size of the last 50 candlesMyCond = Body > BodySize //MyCond is true id the size exceeds the average oneExample 2 (body size in relation to the average range size):
123Body = abs(close - open) //definition of bodyRangeSize = average[50,0](range) //average of the range size of the last 50 candlesMyCond = Body > (RangeSize * 0.7) //MyCond is true if the size exceeds a percentage of the average RangeSize1 user thanked author for this post.
03/21/2019 at 5:09 PM #94337Thanks for explaining the issue @Robertogozzi.
I added the second option:
12345678Body = abs(close – open) //definition of bodyRangeSize = average[50,0](range) //average of the range size of the last 50 candlesLongCandle = Body > (RangeSize * 0.9) //LongCandle is true if the size exceeds a percentage of the average RangeSizee1 = close[2] < open[2] // red candlee2 = open[1] < close[2] and close[1] < close[2] and low[1] < close[2] // candle entirely below predecessor’s bodye3 = close[0] > open[0] and open[0] > open[1] and low[0] < high[1] and LongCandle // green candle with a gap //and ratio[0]>0.3e4 = range[1] < (range[2] / 2 ) // morning star’s range is small compared to preceding candle..and yet there is still a small red (white) candle as the first candle of the formation even though I upped the RangeSize to 0.9? Range size has some big candles: Pls see screenshot. I also tried the first option with the pattern still showing despite the opening small down candle.
Any ideas how to get rid of these dwarf candles!? (on the crosshair in image)
Cheers
03/21/2019 at 5:19 PM #94339You could replace line 5 with:
1e1 = close[2] < open[2] AND LongCandle // red candlebut if you think LongCandle is too much for the second previous candle, then you can define a smaller LongCandle and use both definitions (with different names):
12345678Body = abs(close – open) //definition of bodyRangeSize = average[50,0](range) //average of the range size of the last 50 candlesLongCandle = Body > (RangeSize * 0.9) //LongCandle is true if the size exceeds a percentage of the average RangeSizeLongCandle2 = Body > (RangeSize * 0.5) //LongCandle is true if the size exceeds a percentage of the average RangeSizee1 = close[2] < open[2] AND LongCandle2 // red candlee2 = open[1] < close[2] and close[1] < close[2] and low[1] < close[2] // candle entirely below predecessor’s bodye3 = close[0] > open[0] and open[0] > open[1] and low[0] < high[1] and LongCandle // green candle with a gap //and ratio[0]>0.3e4 = range[1] < (range[2] / 2 ) // morning star’s range is small compared to preceding candle1 user thanked author for this post.
03/21/2019 at 7:45 PM #94352Thanks very much again for the modifications, right.. there was a LongCandle in previous versions, not that it worked then.
Thing is, even with the exact same code as above or even with slight modifications to your code (swapping the LongCandles), to really follow Bulkowski’s definition as close as possible — (i.e. large first red candle and the last green candle’s price, after the Morning Star, must climb at least over half way into the red body of the first red candle) — this code still produces a “red dwarf?”
Morning Star12345678Body = abs(close - open) //definition of bodyRangeSize = average[150,0](range) //average of the range size of the last 50 candlesLongCandle = Body > (RangeSize * 0.9) //LongCandle is true if the size exceeds a percentage of the average RangeSizeLongCandle2 = Body > (RangeSize * 0.6) //LongCandle is true if the size exceeds a percentage of the average RangeSizee1 = close[2] < open[2] AND LongCandle // red candlee2 = open[1] < close[2] and close[1] < close[2] and low[1] < close[2] // candle entirely below predecessor’s bodye3 = close[0] > open[0] and open[0] > open[1] and low[0] < high[1] and LongCandle2 // green candle with a gap //and ratio[0]>0.3e4 = range[1] < (range[2] / 2 ) // morning star’s range is small compared to preceding candleI also notice my first post didn’t contain the images from Bulkowski’s book, which I tried twice to upload, thinking the second time had been successful. I’m going to try again here with at least one of the screens:
03/21/2019 at 8:11 PM #94357There’s no requirement for the long black candle, it just needs to be long.
It’s up to anyone one defining how long enough is LONG.
If you think an average does not help, you can replace it with the sum of the previous 2-3 candles’range or maybe the previous one multiplied by some factor.
Look at your chart and when you see a candle and think “this is not a dwarf”, well… code exactly what your eyes see.
1 user thanked author for this post.
03/21/2019 at 8:30 PM #94358Also realised this code will need to be added…:
12345bearishbody = ABS(open-close)bearishwick = ABS(high-close)//bearishnose = ABS(close-low)e5 = bearishwick/bearishbody < 30/100…so this exhaustion point spike on the green candle (after the Morning Star) is taken account of and avoids a Morning Star signal being given (see Morning Star 4 indicator) :
03/21/2019 at 9:31 PM #94365The more rules you add, the less clear and uncertain your definition will be!
There are a million candlestick combinations around, you cannot follow any DWARF candle your eyes see and get rid of it…. you’ll need a million rules!
Have ONE rule, you’ll get rid of, say 67-75 %, of dwarfs; still, you’ll have have some left. It’s like a strategy, no strategy will EVER have a 100% winning rate!
Few simple rules, few simple lines of code, few indicators, few… everything will prove to be more winning than anything else.
In the second last pic you attached you can read “ignore the shadows in this candlestick pattern“. DO stick to this rule.
1 user thanked author for this post.
03/21/2019 at 10:49 PM #94368no strategy will EVER have a 100% winning rate!
Not quite true.
12345678910//SP500//Dailyif date = 19700101 thenbuy 1 contract at marketendifif date = 20190321 thensell at marketendif03/21/2019 at 11:00 PM #94369-
no strategy will EVER have a 100% winning rate!
Not quite true.
12345678910//SP500//Dailyif date = 19700101 thenbuy 1 contract at marketendifif date = 20190321 thensell at marketendif - Any overnight fee/rollover?
- Would you have opened that trade on Jan. 1st, 1970?
03/22/2019 at 8:56 AM #94381Any overnight fee/rollover? Would you have opened that trade on Jan. 1st, 1970?
Even with fees it has a 100% win rate.
No I wouldn’t have bought as I was only a few months old and so unable to open an account with a broker due to silly age restrictions.
-
AuthorPosts
Find exclusive trading pro-tools on