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

Re: Indicators for candlestick patterns...



PureBytes Links

Trading Reference Links

Hi Ian, here is the code for the indicator and the functions:

Regards,

Barry Silberman

============================================================================
=========
{*******************************************************************
Description : This Indicator plots CandleStick Patterns
Provided By :  Omega Research, Inc. (c) Copyright 1999

MODIFIED BY BSS-- IE: HANGING MAN;  also added gaps: up gap with blue dot;
down gap with magenta dot
********************************************************************}

Inputs: Tolernce(5), Length(5), Tail(3);
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 = "";

  Condition1 = false;  {for bullish patterns}
  Condition2 = false;  {for bearish patterns}
     Condition3 = false;  {for hangman}
  Condition4 = false;  {for doji}


   If Doji(tolernce) Then Begin
   String1 = "Dj";
   String3 = "A \hbDOJI\he pattern has been identified.  ";
   Condition4 = True;
  End;

  If _Hammer(Length, tail) Then Begin
   String1 = "Ha";
   String3 = "A \hbHAMMER\he pattern has been identified.  ";
   Condition1 = True;
  End;

  If _HangingMan(Length, tail) Then Begin
   String1 = "HM";
   String3 = "A \hbHANGING MAN\he pattern has been identified.  ";
   Condition3 = True;
  End;

     If _ShootingStar(Tail, Length) Then Begin
   String1 = "SS";
   String3 = "A \hbSHOOTING STAR\he pattern has been identified.  ";
   Condition2 = True;
  End;

  If _BearishEngulfing(length) Then Begin
   String1 = "BeE";
   String3 = "A BEARISH ENGULFING pattern has been identified.  "+"Please
see \hbBullish & Bearish Engulfing Lines\he.  ";
   Condition2 = True;
  End;

  If _BullishEngulfing(length) Then Begin
   String1 = "BuE";
   String3 = "A BULLISH ENGULFING pattern has been identified.  "+"Please
see \hbBullish & Bearish Engulfing Lines\he.  ";
   Condition1 = True;
  End;

  If _DarkCloud(length) Then Begin
   String1 = "DC";
   String3 = "A \hbDARK CLOUD cover\he pattern has been identified.  ";
   Condition2 = True;
  End;

  If MorningStar(length) Then Begin
   String1 = "MS";
   String3 = "A \hbMORNING STAR\he pattern has been identified.  ";
   Condition1 = True;
  End;

  If _EveningStar(length) Then Begin
   String1 = "ES";
   String3 = "A \hbEVENING STAR\he pattern has been identified.  ";
   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 Condition1 Then Begin
   String2 = String2 + String3;
  { Plot1(High, "CndlPH");
   Plot2(Low, "CndlPL");  }
   Value1 = Text_New(Date, Time, High, String1);
   TextLoc = Text_SetStyle(Value1,  2, 1);
   If GetBackGroundColor = Tool_White Then
    Value2 = Text_SetColor(Value1, Tool_Red)
   Else
    Value2 = Text_SetColor(Value1, Tool_cyan);
  End;


   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);
   If GetBackGroundColor = Tool_White Then
    Value2 = Text_SetColor(Value1, Tool_Red)
   Else
    Value2 = Text_SetColor(Value1, Tool_magenta);
  End;


  If Condition3 Then Begin
   String2 = String2 + String3;
  { Plot1[1](High[1], "CndlPH");
   Plot2[1](Low[1], "CndlPL");  }
   Value1 = Text_New(Date[1], Time, High, String1);
   TextLoc = Text_SetStyle(Value1,  2, 1);
   If GetBackGroundColor = Tool_White Then
    Value2 = Text_SetColor(Value1, Tool_Red)
   Else
    Value2 = Text_SetColor(Value1, Tool_magenta);
  End;


        If Condition4 Then Begin
   String2 = String2 + String3;
  { Plot1(High, "CndlPH");
   Plot2(Low, "CndlPL");  }
   Value1 = Text_New(Date, Time, High, String1);
   TextLoc = Text_SetStyle(Value1,  2, 1);
   If GetBackGroundColor = Tool_White Then
    Value2 = Text_SetColor(Value1, Tool_Red)
   Else
    Value2 = Text_SetColor(Value1, Tool_white);
  End;


 If AtCommentaryBar Then
  Commentary(String2);
 End;


{gap up}
Condition5 = Low > High of 1 bar ago;

{gap down}
Condition6 = High < Low of 1 bar ago;

Inputs: PLOTINCR(1);

If condition5 then
 plot3(low - PLOTINCR*MINMOVE POINTS, "Gap Up", yellow, default, 2);

If condition6 then
 plot4(high + PLOTINCR*MINMOVE POINTS, "Gap down", yellow, default, 2);

============================================================================
=========
{*******************************************************************
Description : This Function returns Dark Cloud
Provided By : Omega Research, Inc. (c) Copyright 1999
Added additional criteria per page 258 of Steve Nison's book "Beyond
Candlesticks"
********************************************************************}

Input: Length(Numeric);
Variables: LongBody(False), OCRange(0);

OCRange = AbsValue(Open - Close);
LongBody = OCRange > Average(OCRange, Length);
_DarkCloud = False;

Condition1 = average(close, length)[1]  > average(close, length)[3];
{there is an uptrend}


If Condition1 and Close[1] > Open[1] AND Close[1] - Open[1] >
MaxList(High[1] - Close[1], Open[1] - Low[1]) Then Begin
 If LongBody[1] AND Open > High[1] AND Close <= MedianPrice[1] Then
  _DarkCloud = True;
End;

============================================================================
========
{*******************************************************************
Description : This Function returns HangingMan
Provided By : Omega Research, Inc. (c) Copyright 1999

Added additional criteria per page 258 of Steve Nison's book "Beyond
Candlesticks"
********************************************************************}

Inputs: Length(Numeric), Tail(Numeric);
Variables: Min(0), Max(0);

Min = Minlist(Close, Open);
Max = Maxlist(Close, Open);
_HangingMan = False;

Condition1 = close < Min[1];   {close is under real body of hangingman}
Condition2 = average(close, length)[1]  > average(close, length)[3];
{there is an uptrend}

If Condition1 and condition2 and Min[1] > MedianPrice[1] AND Open[1] <>
Close[1] Then Begin
 If Min[1] - Low[1] > (Max[1] - Min[1]) * Tail AND High[1] - Max[1] <
Max[1] - Min[1]  Then
  _HangingMan = True;
End;

============================================================================
========
{*******************************************************************
Description : This Function returns Shooting Star
Provided By : Omega Research, Inc. (c) Copyright 1999

BSS added a requirement for an uptrend
********************************************************************}

Input: Tail(Numeric), Length(Numeric);
Variables: Min(0), Max(0);

Min = Minlist(Close, Open);
Max = Maxlist(Close, Open);

_Shootingstar = false;

Condition1 = Average(Close, Length)[1] > Average(Close,Length)[3] ;


If Currentbar > 1 Then Begin
 If Condition1 and Max < MedianPrice AND Open <> Close Then Begin
  If High - Max > (Max - Min) * Tail AND Min - Low < Max - Min Then
   _ShootingStar = true;

 End;
End;

============================================================================
========

{ *******************************************************************
Description : This Function returns Bearish Engulfing
Provided By : Omega Research, Inc. (c) Copyright 1999

BSS changed particular days on the average
*********************************************************************}

Inputs: Length(Numeric);

If Average(Close, Length)[1] > Average(Close,Length)[3] AND Close < Open AND
Close[1] > Open[1] AND Close < Open[1] AND Open > Close[1] then
 _BearishEngulfing = True
Else
 _BearishEngulfing = False;

============================================================================
=========
{*******************************************************************
Description : This Function returns Bullish Engulfing
Provided By : Omega Research, Inc. (c) Copyright 1999

BSS changed particular days in average
*********************************************************************}

Inputs: Length(Numeric);

If Average(Close, Length)[1] < Average(Close, Length)[3] AND Close > Open
AND Close[1] < Open[1] AND Close > Open[1] AND Open < Close[1] Then
 _BullishEngulfing = True
Else
 _BullishEngulfing = False;

============================================================================
========

{*******************************************************************
Description : This Function returns Evening Star
Provided By : Omega Research, Inc. (c) Copyright 1999
Added additional criteria per page 258 of Steve Nison's book "Beyond
Candlesticks"
********************************************************************}

Inputs: Length(Numeric);
Variables: LongBody(False), OCRange(0), Hollow(False), Filled(False),
Shortbody(false);

Hollow = Close > Open;
Filled = Close < Open;

OCRange = AbsValue(Open-Close);
LongBody = OCRange > Average(OCRange,Length);
ShortBody = OCRange < Average(OCRange, Length);
_EveningStar = False;

Condition1 = shortbody[1];    {the second bar must be a shortbody}

Condition2 = average(close, length)[1] > average(close, length)[3];   {there
is an uptrend}

Condition3 =  Minlist(close[1], Open[1]) > open;         {the current
candle's real body is below the previous bodies real body}

If CurrentBar >= Length Then Begin
 If condition1 and condition2 and condition3 and Hollow[2] AND
Minlist(Close[1],Open[1]) > Close[2] AND Filled AND LongBody[2] AND Close <
Close[2] Then
 _EveningStar = True;
End;

============================================================================
=========
{ *******************************************************************
Description : This Function returns Hammer
Provided By : Omega Research, Inc. (c) Copyright 1999
********************************************************************}

Inputs: Length(Numeric), Tail(Numeric);
Variables: Min(0), Max(0);

Min = Minlist(Close, Open);
Max = Maxlist(Close, Open);
_Hammer = False;

Condition1 = average(close, length)[1]  < average(close, length)[3];
{there is an downtrend}


If Min > MedianPrice AND Open <> Close Then Begin
 If Min - Low > (Max - Min) * Tail AND High - Max < Max - Min AND Condition1
then
  _Hammer = True;
End;

============================================================================
=========

{*******************************************************************
Description : This Function returns Doji
Provided By : Omega Research, Inc. (c) Copyright 1999
********************************************************************}

Inputs: Tolernce(Numeric);

If Open = Close OR AbsValue(Open - Close) <= Range * (Tolernce / 100) Then
 Doji = True
Else
 Doji = False;
============================================================================
=========

{*******************************************************************
Description : This Function returns the MorningStar pattern
Provided By : Omega Research, Inc. (c) Copyright 1999
********************************************************************}

Inputs: Length(Numeric);
Variables: LongBody(False), OCRange(0), Hollow(False), Filled(False);

Hollow = Close > Open;
Filled = Close < Open;

OCRange = AbsValue(Open-Close);
LongBody = OCRange > Average(OCRange,Length);
MorningStar = False;

If Filled[2] AND Maxlist(Close[1], Open[1]) < Close[2] AND Hollow AND
LongBody[2] AND Close > Close[2] Then
 MorningStar = True;

============================================================================
=========

----- Original Message -----
From: "Ian Waugh" <ianwaugh@xxxxxxxxxxxxxxxxxxx>
To: <Omega-List@xxxxxxxxxx>
Cc: <ianwaugh@xxxxxxxxxxxxxxxxxxx>
Sent: Saturday, August 03, 2002 6:09 PM
Subject: RE: Indicators for candlestick patterns...


> In-Reply-To: <NNEBIPNECDEILJFBGFLJMENBCBAA.cwest@xxxxxxxxxxxx>
> Is there a converter to convert between ELD and ELS/ELA files...? I
> suspect not... If so, would some kind person post or email the plain
> text code for this, please?
>
> Thanks.
>
> Cheers,
> Ian
>
> > Search www.traders2traders.com for "candlesticks." I believe there are
> > enhanced versions posted there.
> >
> >  -----Original Message-----
> > From:         Nigel Bahadur [mailto:nbahadur@xxxxxxxxxxxxxxxx]
> > Sent: Saturday, August 03, 2002 10:47 AM
> > To:   Omega-List@xxxxxxxxxx
> > Subject:      Indicators for candlestick patterns...
> >
> > Hi All:
> >
> > Does anyone know where I can get a set of TS6 indicators/showmes for
> > the
> > most common candlestick reversal and continuation patterns?  I'd hate
> > to
> > go write them only to find out that someone else has already done so.
> >
> > Thanks.
> >
> > Sincerely,
> >
> > Nigel
> > ______________________________________________________________________
> > __
> > ____
> > The real glory is being knocked to your knees and then coming back.  -
> > Vince Lombardi.
> >
> >
> >
> >
> > ---
> >
>