[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Candlestick Indicator for Education



PureBytes Links

Trading Reference Links

<x-flowed>
I've created an ELA indicator (based on Omega Research's indicator) to 
assist me in
honing my candlestick reading skills.  However, I can't get the commentary 
to "pop-up"
in the form of an "alert" or "message log entry".  I'd really like an alert 
to pop-up when
each candlestick pattern appears.  I think I've got most of the code done, 
but I just
haven't been able to get the alerting part of the programming.

Any assistance is appreciated... and feel free to use the code to educate 
yourself
on candlesticks.  (All of the interpretations I'm using are based on Steve 
Nison's book.)

Warmly,
Brian Voiles


Here's my code:

Inputs: Tolernce(5), Length(5), Tail(2);
Variables: String1(""), TextLoc(0), String2(""), String3("");

If DataCompression = 0 and BarInterval <= 5 Then
	Commentary("This indicator must be applied to a bar interval larger than 5 
ticks.")
Else
	If DataCompression = 5 Then
		Commentary("This indicator can not be applied to Point and Figure charts. ")
	Else Begin
		String1 = "";
		String2 = "";
		Condition2 = false;
	
		If Doji(tolernce) Then Begin
			String1 = "DJ";
			String3 = "DOJI suggests the trend is stalling -- a reversal is unlikely 
without "+"confirmation from the upcoming candles" "+"however, congestion 
and churning are more likely";
			Condition2 = True;
		End;
	
		If Hammer(Length, tail) Then Begin
			String1 = "HA";
			String3 = "Hammers are bullish when they occur near the low of any run 
down. The real "+"body color does not matter. Remember, ideally the long 
shadow should be twice "+"the height of the real body, and it should have 
no, or a very short, upper "+"shadow.  Be sure and watch the next candle 
for confirmation... A Hammer "+"doesn't mean that prices will reverse... it 
merely implies that the prior "+"trend should end -- and the market is 
likely to go into a consolidation and "+"congestion.";
			Condition2 = True;			
		End;
	
		If HangingMan(Length, tail) Then Begin
			String1 = "HM";
			String3 = "Hanging Man patterns are bearish when they occur near the 
high of any run "+"up. The real body color does not matter.  However, the 
smaller the real body, "+"the more meaningful the bearish hanging man is. 
Remember, ideally the long "+"shadow should be twice the height of the real 
body, and it should have no, or "+"a very short, upper shadow. Be sure and 
watch the next candle for "+"confirmation... A Hanging Man doesn't mean 
that prices will reverse... it "+"merely implies that the prior trend may 
end -- and the market is likely to go "+"into a consolidation or congestion 
"+"phase. IMPORTANT--The greater the down gap between the real body of the 
"+"Hanging-Man bar and the opening of the next bar, the more likely the 
"+"hanging man will be a top!  Another bearish verification could be a red 
real "+"body bar with a lower close than the hanging-man's close.";
			Condition2 = True;			
		End;
	
		If ShootingStar(Tail) Then Begin
			String1 = "SS";
			String3 = "A Shooting Star is a 2-bar pattern that sends a warning of a 
potential TOP if "+"it occurs in any up-trend.  It is not as major of a 
reversal signal as is the "+"Evening Star.  The Shooting Star has a small 
real body at the lower end of its "+"range, with a long upper shadow.  (The 
color of the body is not important). "+"The ideal Shooting Star has a real 
body which gaps away from the prior real "+"body... however, the gap is not 
necessary.";
			Condition2 = True;			
		End;
	
		If BearishEngulfing(length) Then Begin
			String1 = "BeE";
			String3 = "Bearish Engulfing is a major reversal signal that occurs in a 
clearly "+"definable up-trend.  A doji or a blue (bullish) candle's real 
body is engulfed "+"by a red candle's opposite movement.  The red candle 
must engulf the real body "+"of the prior bar, but doesn't need to engulf 
the shadows.  Factors that "+"increase the likelihood that the Bearish 
Engulfing pattern indicates a strong "+"reversal are: 1) The prior red bar 
has a very small real body, or is a doji"+" 2) The engulfing pattern 
appears after a very fast move down, or after a very "+"slow, protracted 
move. 3) There is heavy volume on the 2nd real body of the "+"pattern. 4) 
The 2nd bar engulfs more than one real body.";
			Condition2 = True;			
		End;
	
		If BullishEngulfing(length) Then Begin
			String1 = "BuE";
			String3 = "Bullish Engulfing is a major reversal signal that occurs in a 
clearly "+"definable downtrend.  A doji or a red (bearish) candle's real 
body is engulfed "+"by a blue candle's opposite movement.  The blue candle 
must engulf the real "+"body of the prior bar, but doesn't need to engulf 
the shadows.  Factors that "+"increase the likelihood that the Bullish 
Engulfing pattern indicates a strong "+"reversal are: 1) The prior red bar 
has a very small real body, or is a doji; "+"2) The engulfing pattern 
appears after a very fast move down, or after a very "+"slow, protracted 
move. 3) There is heavy volume on the 2nd real body of the "+"pattern. 4) 
The 2nd bar engulfs more than one real body.";
			Condition2 = True;			
		End;

		If DarkCloud(length) Then Begin
			String1 = "DC";
			String3 = "Dark Cloud Cover is a 2-bar pattern that is a top reversal 
after an uptrend, "+"or at times, at the top of  a congestion area.  The 
1st bar of this 2-candle "+"pattern is a strong, blue real body. The 2nd 
bars price opens above the prior "+"bar's high (above the top of the upper 
shadow).  However, by the close of the "+"2nd bar, the market closes near 
the low of the day and well into the prior "+"day's blue body.  The greater 
the degree of penetration into the blue real "+"body, the more likely a top 
will occur. PLEASE NOTE:If the 2nd bar opens "+"above a major resistance 
area and then fails, it's a pretty sure sign that the "+"bulls are unable 
to take control.  Also, remember that a prior support level, "+"once 
broken, easily can become a new resistance level... there will be many 
"+"Dark Cloud Cover patterns coincided with resistance levels.";
			Condition2 = True;			
		End;

		If MorningStar(length) Then Begin
			String1 = "MS";
			String3 = "Morning Star is a bullish, bottom-reversal pattern when it 
occurs in a clearly "+"definable down-trend.  It's comprised of 3 bars… the 
1st of which being a "+"tall, red real body followed by a small real body 
of either color which gaps "+"lower.  The 3rd bar is a blue real body that 
moves well within the first bar's "+"red real body.  This pattern is a 
signal that the bulls have probably seized "+"control.  Although more 
significant after a down-trend, the Morning Star can "+"be an important 
indicator at the bottom of a congestion band as long as other "+"technical 
indicators confirm its bullishness. An ideal Morning Star should "+"have a 
gap between the first and second real bodies, and then another gap 
"+"between the second and third real bodies... however, this second gap is 
rarely "+"seen and is unnecessary.  The main thing to look for is how far 
the 3rd "+"period's red real body intrudes into the first period's blue 
real body. "+"The Evening Star pattern requires the low of real body 2 to 
be above the high "+"of real body 1 to be a valid reversal signal. Three 
factors that increase the "+"likelihood that a Morning Star could be a 
reversal are: 1) If there's a gap "+"between the 1st candlestick's and 
star's real bodies and then in the star's "+"and 3rd candlestick's real 
bodies; 2) If the 3rd candlestick closes deeply "+"into the 1st 
candlestick's real body; 3) If there is light volume on the 1st 
"+"candlestick session and heavy volume on the 3rd candlestick session. 
"+"(This shows a reduction of force for the prior trend and an increase in 
the "+"force of the new trend.)";
			Condition2 = True;			
		End;
	
		If EveningStar(length) Then Begin
			String1 = "ES";
			String3 = "Evening Star is a bearish, top-reversal pattern when it 
occurs in a clearly "+"definable up-trend.  It's comprised of 3 bars… the 
1st of which being a tall, "+"blue real body followed by a small real body 
of either color which gaps "+"higher.  The 3rd day is a red real body that 
moves well into the first bar's "+"blue real body.  This pattern is a 
signal that the bears have probably seized "+"control.  Although more 
significant after an up-trend, the Evening Star can be "+"an important 
indicator at the top of a congestion band as long as other "+"technical 
indicators confirm it's bearishness. Ideally the Evening Star should 
"+"have a gap between the first and second real bodies, and then another 
gap "+"between the second and third real bodies... however, this second gap 
is rarely "+"seen and is unnecessary.  The main thing to look for is how 
far the 3rd bar's "+"red real body intrudes into the first bar's blue real 
body.  The Evening Star "+"pattern requires that the low of real body 2 be 
above the high of real body 1 "+"to be a valid reversal signal.  Three 
factors that increase the likelihood "+"that an Evening Star could be a 
reversal are: 1) If there's a gap between the "+"1st candlestick's and 
star's real bodies and then in the star's and 3rd "+"candlestick's real 
bodies; 2) If the 3rd candlestick closes deeply into the "+"1st 
candlestick's real body; 3) If there is light volume on the 1st 
"+"candlestick session and heavy volume on the 3rd candlestick 
session.  (This "+"shows a reduction of force for the prior trend and an 
increase in the force of "+"the new trend.)";
			Condition2 = True;			
		End;
	
		If CommentaryEnabled Then
			String2 = ("DJ = Doji "+newline+"Ha = Hammer"+Newline+"HM = 
HangingMan"+Newline+"SS = ShootingStar"+
			Newline + "BeE= BearishEngulfing"+ Newline+ "BuE= BullishEngulfing"+ 
NewLine+ "DC = DarkCloud"+ Newline+
			"MS = MorningStar"+ Newline+ "ES = EveningStar"+Newline+Newline);

		If Condition2 Then Begin
			String2 = String2 + String3;
			Plot1(High, "CndlPH");
			Plot2(Low, "CndlPL");
			Value1 = Text_New(Date, Time, High, String1);
			TextLoc = Text_SetStyle(Value1,  2, 1);
			Value2 = Text_SetColor(Value1, Tool_Black);
		End;

	If AtCommentaryBar Then
		Commentary(String2);
End;

Thanks for your kindness and helping hand.
Warmly,
Brian Voiles
</x-flowed>