Candlestick Patterns: Part 2

Home > Education > Amibroker AFL > Candlestick Patterns: Part 2
Candlestick Patterns: Part 2

Trading without a candlestick pattern is like riding the car in the dark without lights. Candlestick patterns are helpful to find out the right entry, exit, and stop-loss at right time. Here we are going to discuss popular candlestick patterns that are used by traders to trade in the market.

Why is a candlestick pattern important?

Many traders trade simply using line charts only and some even don’t use the charts, they only watch bids and ask prices and trade accordingly.

There are countless methods to trade in the stock market, but if you are a gambler, you can trade based on some data or by watching the news, or with tips.

But, to stay for long-term in the market you need to understand candlestick patterns.

If you are a new trader, reading candlestick charts can be difficult for you but when you start learning about it you can find it easier. There is a proper way to read the charts and that is the pattern. The pattern shows the probabilities for price movements.

If you can get the right opportunity, you can make profits easily.

Candlestick patterns help to understand the patterns of the market. With sufficient practice in reading and understanding charts, you can easily become a chart reader. 

Who brings the concept of candlestick patterns?

Regarding Investopedia.com, a Japanese rice future trader named Muneshia Homa (18th Century) invented the candlestick charts. He traded on the Dojima rice exchange of Osaka, which is considered the first formal futures exchange in history.

He is known as the father of candlestick charts and he recognized the impact of the emotions of humans in the market. Thus, he develops a system of charting that helped him to understand the impact of emotion on rice’s future price.

He also wrote a book on trading psychology in 1775. After homa, Steve Nison became an expert on Japanese candlestick methods and he wrote a book: Beyond Candlesticks: New Japanese Charting Techniques Revealed, which became most popular. 

What does Candlestick exactly describe?

Trading psychology and emotions are two parameters of trading. Candlestick shows the battle of emotions between buyers and sellers.

So candlesticks are the best source to understand the emotions in the market, which helps to start trading effectively.

Formation of Candlestick

There are mainly two types of candlesticks: Bullish and Bearish. The third one is indecisive. The image below shows bullish and bearish candle and their elements.

Formation of Candlestick
Image Credited: Trading Fuel || Research Lab

Now let’s understand candlestick in detail.

What are Candlesticks?

 The candle is formed when the price moves over some time. The 5-minute candle is a plot of the price movement (Up or down) during 5 minutes of the trading day. 

Similarly, the weekly candle shows the price movement for 1 week, and the daily candle represents the price movement during the whole day.  

There are two prices in candlesticks open and close. Open price shows where the price opens for the particular candle and close indicates where the price closes for the candle. The tails (wicks) indicates high and low price from opening and close.

As per Nison’s opinion, the Japanese placed more weight on opening and closing prices. 

Don’t Miss: Candlestick Patterns: Part 1

1. Bullish Candle

When the price closed above the opening price, a bullish candle formed. For any bullish candle, 1 min or daily or 5 min all bullish candles closing will always be higher than the opening price.

Bullish Candle
Image Credited: Trading Fuel || Research Lab

2. Bearish Candle

A bearish Candle is exactly the opposite of a bullish candle. When the closing price is below the opening price, a bear candle forms.  For both candles, the highest and lowest points will be the same.

Bearish Candle
Image Credited: Trading Fuel || Research Lab

What does candle formation describe?

It is not enough to know about a candle is bullish or bearish, the study of candle formation helps traders to understand the price action and where the stock price can go next within the next few minutes.

The candle indicates the fight between buyers and sellers. Trades can get more advantages with the candle once he knows what the candle is telling.

The open and closing price of the Candle

The opening price of the candle is the price when trading starts. For example: for the 9:15 to 9:20 candle the opening price will be the price at which the market opens.

For the 9:20-9:25 candle, the opening price will be the different price as in the 5-minute chart after every 5 minutes new candles are made.

The closing price of the candle is very interesting. If the price is close above the opening price we say bulls are powerful and the opposite is if it closes below the opening price we can say sellers are in control.

The open and closing price of the Candle
Image Credited: Trading Fuel || Research Lab

Also, Learn: Top 10 Intraday Trading Techniques & Strategies

In this example, the three bullish candles (Three white soldiers) in a row are there. Now, what can we interpret from this formation?

With every candle, we can say that bulls are in control and there are high chances of the price moving up.

High Price of the candle

The high price of every candle is the top of the tail or weak. The high price represents the maximum buyer’s efforts to move the stock price up. But due to sellers, they can’t move the price up and close below its high point. The high price indicates the power of bulls. Sometimes the closing price is equal to the high price which confirms that there are buyers active in the market.

High Price of the candle
Image Credited: Trading Fuel || Research Lab

Low price of the candle

The low price indicates the power of sellers in the market. The lowest price of the candle is the point up to which the strong sellers were present during that particular time period.

The lower price shows there are active sellers in the market when the price close just above the low point that confirms sellers are there and the price may go down.

 But when the price takes support from the previous day’s low and moves upwards indicates that buyers are still there and the price may go up.

Low price of the candle
Image Credited: Trading Fuel || Research Lab

Body of the Candlestick 

 The body of the candlestick is the range between the opening and closing price. This part of the candle is very important to interpret. For day trading, price momentum is very important. 

 The body structure of the candle can tell us whether the price will go up or down and help us to decide whether to enter or exit the trade. 

Now let’s go to the example of candlestick patterns that are widely used by most traders for trading.

To interpret chart candles perfectly, you need to give time and practice for a long time. Different candlestick charting patterns can be helpful to anticipate the trend of the market.

Here are some patterns which can be useful for traders.

  • Hammer / Hanging Man 

The formation of both types of candlesticks is the same but the hammer occurs at the bottom and the hanging man occurs at the top.

Hammer / Hanging Man 
Image Credited: Trading Fuel || Research Lab

The hammer is a popular pattern for reversal. The location of the hammer should be at the bottom or support area or after a strong short rally, if the hammer appears we can interpret that there is a chance of the price moving up from the point.

When a hammer candle occurs with high volume, it confirms that buyers come into action and we can go for a long.

The hanging man looks the same as the hammer candle but it appears at the top after a strong bullish rally in the price. When you see this candle at resistance or top of the up-trend we can predict that the price may go down.

When hanging man candle forms we can say that sellers are in the action and it can be confirmed if a high volume is there.

  • Engulfing pattern

 Engulf means one candle covers the second last candle with the entire body. The benefit of this pattern is it can give high-probability signals with minimum risk.

Bullish engulfing patterns appear at the bottom or support level. Identifying this pattern is very easy. The Bearish candle was engulfed by the bullish candle.

Engulfing pattern
Image Credited: Trading Fuel || Research Lab

Know More: Bullish Engulfing Pattern Trading Strategy Guide

The bearish engulfing pattern appears at the top of the price or resistance level. When the big red candle engulfed the green candle there is a chance of the price going down.

bearish engulfing pattern
Image Credited: Trading Fuel || Research Lab
  • The morning star

The morning star pattern indicates a reversal of a downtrend. At the end of the downtrend, you can find this pattern and go for the buy.

morning star pattern
Image Credited: Trading Fuel || Research Lab

This pattern is made up of 3 candles as shown in the image.

  • To confirm this pattern the first candle should be a strong bearish candle,
  • The second candle should have a narrow body called a star candle.
  • The third candle must be a strong bullish candle which confirms the uptrend.
  • The evening star

The evening star pattern is exactly opposite to the morning star candle. The formation of this pattern at the top of the uptrend gives the signal for the reversal of the trend.

In this pattern, the first candle should be a strong bullish candle, the middle one is a star candle, and the third one is a strong bearish candle confirming the starting of the downtrend.

evening star pattern
Image Credited: Trading Fuel || Research Lab

Must Know: Top 10 Candlestick Pattern

To confirm the shooting star pattern, the bodies of candles should not overlap and the volume should increase from candle to candle.

  • Indecision candles

The spinning top, Doji, and marubozu candles are mainly found in consolidation where there is no confirmation of the trend.

Indecision candles
Image Credited: Trading Fuel || Research Lab
  • The Doji candle indicates a fight between buyers and sellers so we cannot predict the trend of the market. Doji creates confusion when it appears in the trending market.
  • So when indecision candles form it means that you need to stop thinking about taking the trade at that time.

How to practice with candlestick patterns?

Backtesting is one of the methods to practice different candlestick patterns, as it doesn’t involve real money. So you can easily get an idea about different patterns.

If you want to know more about how to do backtesting? You can visit our blog 

Another method is watching the chart live and trying to read it online by yourself. When you find a candlestick pattern you note down points such as:

  • Name of the candlestick pattern
  • Where did you find it? What is the location of the pattern- uptrend/downtrend/ sideways?
  • What are entry, exit, and stop loss levels?
  • What is a risk-to-reward ratio?
  • Which pattern is more suitable for you?

Practising the candlestick charting pattern can help you to select the best strategy for you. You can trade confidently once you get enough knowledge and practice.

Candlestick Pattern Finder for Amibroker (AFL)

// Downloaded From https://www.TradingFuel.com
SetChartOptions(0,chartShowArrows|chartShowDates);

/*Body Colors*/
whiteBody=C>=O;
blackBody=O>C;

/*Body Size*/
smallBodyMaximum=0.0025;//less than 0.25%
LargeBodyMinimum=0.01;//greater than 1.0%
smallBody=(O>=C*(1-smallBodyMaximum) AND whiteBody) OR (C>=O*(1-smallBodyMaximum) AND blackBody);
largeBody=(C>=O*(1+largeBodyMinimum) AND whiteBody) OR C<=O*(1-largeBodyMinimum) AND blackBody;
mediumBody=NOT LargeBody AND NOT smallBody;
identicalBodies=abs(abs(Ref(O,-1)-Ref(C,-1))-abs(O-C)) < abs(O-C)*smallBodyMaximum;
realBodySize=abs(O-C);


/*Shadows*/
smallUpperShadow=(whiteBody AND H<=C*(1+smallBodyMaximum)) OR (blackBody AND H<=O*(1+smallBodyMaximum));
smallLowerShadow=(whiteBody AND L>=O*(1-smallBodyMaximum)) OR (blackBody AND L>=C*(1-smallBodyMaximum));
largeUpperShadow=(whiteBody AND H>=C*(1+largeBodyMinimum)) OR (blackBody AND H>=O*(1+largeBodyMinimum));
largeLowerShadow=(whiteBody AND L<=O*(1-largeBodyMinimum)) OR (blackBody AND L<=C*(1-largeBodyMinimum));

/*Gaps*/
upGap= IIf(Ref(blackBody,-1)AND whiteBody AND O>Ref(O,-1),1,
IIf(Ref(blackbody,-1) AND blackBody AND C>Ref(O,-1),1,
IIf(Ref(whiteBody,-1) AND whiteBody AND O>Ref(C,-1),1,
IIf(Ref(whiteBody,-1) AND blackBody AND C>Ref(C,-1),1,0))));

downGap=IIf(Ref(blackBody,-1)AND whiteBody AND C<Ref(C,-1),1,
IIf(Ref(blackbody,-1) AND blackBody AND O<Ref(C,-1),1,
IIf(Ref(whiteBody,-1) AND whiteBody AND C<Ref(O,-1),1,
IIf(Ref(whiteBody,-1) AND blackBody AND O<Ref(O,-1),1,0))));

/*Maximum High Today - (MHT)
Today is the maximum High in the last 5 days*/
MHT= HHV(H,5)==H;

/*Maximum High Yesterday - (MHY)
Yesterday is the maximum High in the last 5 days*/
MHY= HHV(H,5)==Ref ( H, -1);

/*Minimum Low Today - (MLT)
Today is the minimum Low in the last 5 days*/
MLT= LLV(L,5)==L;

/*Minimum Low Yesterday - (MLY)
Yesterday is the minimum Low in the last 5 days*/
MLY= LLV(L,5)==Ref(L,-1);

/*DOJI definitions*/

/*Doji Today - (DT)*/
DT = abs(C-O) <= (C*smallBodyMaximum) OR (abs(O-C)<=((H-L)*0.1));

/* Doji Yesterday - (DY)*/
DY = abs(Ref ( C, -1)-Ref(O,-1)) <= Ref ( C, -1) *smallBodyMaximum OR abs (Ref ( O, -1)-Ref(C,-1)) <= (Ref ( H, -1 ) - Ref ( L, -1 ) )*0.1;


O1 = Ref(O,-1);O2 = Ref(O,-2); 
H1 = Ref(H,-1);H2 = Ref(H,-2); 
L1 = Ref(L,-1);L2 = Ref(L,-2); 
C1 = Ref(C,-1);C2 = Ref(C,-2); 
NearDoji = (abs(O-C)<= ((H-L)*0.1)); 
BlackCandle = (O>C); 
LongBlackCandle = (O>C AND (O-C)/(0.001+H-L)>0.6); 
SmallBlackCandle = ((O>C) AND ((H-L)>(3*(O-C)))); 
WhiteCandle = (C>O); 
LongWhiteCandle = ((C>O) AND ((C-O)/(0.001+H-L)>0.6)); 
SmallWhiteCandle = ((C>O) AND ((H-L)>(3*(C-O)))); 
BlackMaubozu = (O>C AND H==O AND C==L); 
WhiteMaubozu = (C>O AND H==C AND O==L); 
BlackClosingMarubozu = (O>C AND C==L); 
WhiteClosingMarubozu = (C>O AND C==H); 
BlackOpeningMarubozu = (O>C AND O==H); 
WhiteOpeningMarubozu = (C>O AND O==L); 
HangingMan = (((H-L)>4*(O-C)) AND ((C-L)/(0.001+H-L)>= 0.75) AND ((O-L)/(0.001+H-L)>= 0.75)); 
Hammer = (((H-L)>3*(O-C)) AND ((C-L)/(0.001+H-L)>0.6) AND ((O-L)/(0.001+H-L)>0.6)); 
InvertedHammer = (((H-L)>3*(O-C)) AND ((H-C)/(0.001+H-L)>0.6) AND ((H-O)/(0.001+H-L)>0.6)); 
ShootingStar = (((H-L)>4*(O-C)) AND ((H-C)/(0.001+H-L)>= 0.75) AND ((H-O)/(0.001+H-L)>= 0.75)); 
BlackSpinningTop = ((O>C) AND ((H-L)>(3*(O-C))) AND (((H-O)/(0.001+H-L))<0.4) AND (((C-L)/(0.001+H-L))<0.4)); 
WhiteSpinningTop = ((C>O) AND ((H-L)>(3*(C-O))) AND (((H-C)/(0.001+H-L))<0.4) AND (((O-L)/(0.001+H-L))<0.4)); 
BearishAbandonedBaby = ((C1 == O1) AND (C2>O2) AND (O>C) AND (L1>H2) AND (L1>H)); 
BearishEveningDojiStar = ((C2>O2) AND ((C2-O2)/(0.001+H2-L2)>0.6) AND (C2<O1) AND (C1>O1) AND ((H1-L1)>(3*(C1-O1))) AND (O>C) AND (O<O1)); 
DarkCloudCover = (C1>O1 AND ((C1+O1)/2)>C AND O>C AND O>C1 AND C>O1 AND (O-C)/(0.001+(H-L)>0.6)); 
BearishEngulfing = ((C1>O1) AND (O>C) AND (O>= C1) AND (O1>= C) AND ((O-C)>(C1-O1))); 
ThreeOutsideDownPattern = ((C2>O2) AND (O1>C1) AND (O1>= C2) AND (O2>= C1) AND ((O1-C1)>(C2-O2)) AND (O>C) AND (C<C1)); 
BullishAbandonedBaby = ((C1 == O1) AND (O2>C2) AND (C>O) AND (L2>H1) AND (L>H1)); 
BullishMorningDojiStar = ((O2>C2) AND ((O2-C2)/(0.001+H2-L2)>0.6) AND (C2>O1) AND (O1>C1) AND ((H1-L1)>(3*(C1-O1))) AND (C>O) AND (O>O1)); 
BullishEngulfing = ((O1>C1) AND (C>O) AND (C>= O1) AND (C1>= O) AND ((C-O)>(O1-C1))); 
ThreeOutsideUpPattern = ((O2>C2) AND (C1>O1) AND (C1>= O2) AND (C2>= O1) AND ((C1-O1)>(O2-C2)) AND (C>O) AND (C>C1)); 
BullishHarami = ((O1>C1) AND (C>O) AND (C<= O1) AND (C1<= O) AND ((C-O)<(O1-C1))); 
ThreeInsideUpPattern = ((O2>C2) AND (C1>O1) AND (C1<= O2) AND (C2<= O1) AND ((C1-O1)<(O2-C2)) AND (C>O) AND (C>C1) AND (O>O1)); 
PiercingLine = ((C1<O1) AND (((O1+C1)/2)<C) AND (O<C) AND (O<C1) AND (C<O1) AND ((C-O)/(0.001+(H-L))>0.6)); 
BearishHarami = ((C1>O1) AND (O>C) AND (O<= C1) AND (O1<= C) AND ((O-C)<(C1-O1))); 
ThreeInsideDownPattern = ((C2>O2) AND (O1>C1) AND (O1<= C2) AND (O2<= C1) AND ((O1-C1)<(C2-O2)) AND (O>C) AND (C<C1) AND (O<O1)); 
ThreeWhiteSoldiers = (C>O*1.01) AND (C1>O1*1.01) AND (C2>O2*1.01) AND (C>C1) AND (C1>C2) AND (O<C1) AND (O>O1) AND (O1<C2) AND (O1>O2) AND (((H-C)/(H-L))<0.2) AND (((H1-C1)/(H1-L1))<0.2) AND (((H2-C2)/(H2-L2))<0.2); 
DarkCloudCover = (C1>O1*1.01) AND (O>C) AND (O>H1) AND (C>O1) AND (((C1+O1)/2)>C) AND (C>O1) AND (MA(C,13)-Ref(MA(C,13),-4)>0); 
ThreeBlackCrows = (O>C*1.01) AND (O1>C1*1.01) AND (O2>C2*1.01) AND (C<C1) AND (C1<C2) AND (O>C1) AND (O<O1) AND (O1>C2) AND (O1<O2) AND (((C-L)/(H-L))<0.2) AND (((C1-L1)/(H1-L1))<0.2) AND (((C2-L2)/(H2-L2))<0.2);
eveningStar=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND Ref(upGap,-1) AND NOT Ref(largeBody,-1) AND blackBody AND NOT smallBody AND (MHT OR MHY);
morningStar =Ref(largeBody,-2) AND Ref(blackBody,-2) AND Ref(downGap,-1) AND whiteBody AND LargeBody AND C>Ref(C,-2) AND MLY;
Doji = (O == C); 
MATCHLOW = LLV(Low,8)==LLV(Low,2) AND Ref(Close,-1)<=Ref(Open,-1)*.99 AND abs(Close-Ref(Close,-1))<=Close*.0025 AND Open>Ref(Close,-1) AND Open<=(High-((High-Low)*.5));
GapUpx = GapUp(); 
GapDownx = GapDown(); 
BigGapUp = L>1.01*H1; 
BigGapDown = H<0.99*L1; 
HugeGapUp = L>1.02*H1; 
HugeGapDown = H<0.98*L1; 
DoubleGapUp = GapUp() AND Ref(GapUp(),-1); 
DoubleGapDown = GapDown() AND Ref(GapDown(),-1); 

c_Status = 
WriteIf(HangingMan, "Hanging Man",
WriteIf(ShootingStar, "Shooting Star",
WriteIf(DarkCloudCover, "Dark Cloud Cover", 
WriteIf(BearishEngulfing, "Bearish Engulfing",
WriteIf(BearishHarami, "Bearish Harami",
WriteIf(eveningStar, "Evening Star",
WriteIf(Hammer, "Hammer",
WriteIf(InvertedHammer, "Inverted Hammer",
WriteIf(PiercingLine, "Piercing Line",
WriteIf(BullishEngulfing, "Bullish Engulfing",
WriteIf(BullishHarami, "Bullish Harami",
WriteIf(morningStar, "Morning Star",
WriteIf(NearDoji, "Near Doji",
WriteIf(Doji, "Doji",
WriteIf(MATCHLOW,"MATCHING LOW",
"Zilch" )))))))))))))));
P_status =
WriteIf(GapUpx, "Gap Up", 
WriteIf(GapDownx, "Gap Down",
WriteIf(BigGapUp, "Big Gap Up",
WriteIf(BigGapDown, "Big Gap Down",
WriteIf(HugeGapUp, "Huge Gap Up",
WriteIf(HugeGapDown, "Huge Gap Down",
WriteIf(DoubleGapUp, "Double Gap Up",
WriteIf(DoubleGapDown, "DoubleGapDown",
"Zilch" ))))))));
/*Tweezer Top*/
TweezerTop=abs(H-Ref(H,-1))<=H*0.0025 AND O >C AND (Ref(C,-1) > Ref(O,-1))AND (MHT OR MHY);

/*Tweezer Bottom*/
tweezerBottom= (abs(L-Ref(L,-1))/L<0.0025 OR
abs(L-Ref(L,-2))/L<0.0025) AND O < C AND (Ref( O,-1) > Ref(C,-1)) AND (MLT OR MLY);
PATTERN = WriteIf(tweezerTop, "Tweezer Top",
WriteIf(tweezerBottom, "Tweezer Bottom","Zilch" ));

Filter = tweezerTop OR tweezerBottom;
/*Body Colors*/
whiteBody=C>=O;
blackBody=O>C;

/*Body Size*/
smallBodyMaximum=0.0025;//less than 0.25%
LargeBodyMinimum=0.01;//greater than 1.0%
smallBody=(O>=C*(1-smallBodyMaximum) AND whiteBody) OR (C>=O*(1-smallBodyMaximum) AND blackBody);
largeBody=(C>=O*(1+largeBodyMinimum) AND whiteBody) OR C<=O*(1-largeBodyMinimum) AND blackBody;
mediumBody=NOT LargeBody AND NOT smallBody;
identicalBodies=abs(abs(Ref(O,-1)-Ref(C,-1))-abs(O-C)) < abs(O-C)*smallBodyMaximum;
realBodySize=abs(O-C);


/*Shadows*/
smallUpperShadow=(whiteBody AND H<=C*(1+smallBodyMaximum)) OR (blackBody AND H<=O*(1+smallBodyMaximum));
smallLowerShadow=(whiteBody AND L>=O*(1-smallBodyMaximum)) OR (blackBody AND L>=C*(1-smallBodyMaximum));
largeUpperShadow=(whiteBody AND H>=C*(1+largeBodyMinimum)) OR (blackBody AND H>=O*(1+largeBodyMinimum));
largeLowerShadow=(whiteBody AND L<=O*(1-largeBodyMinimum)) OR (blackBody AND L<=C*(1-largeBodyMinimum));

/*Gaps*/
upGap= IIf(Ref(blackBody,-1)AND whiteBody AND O>Ref(O,-1),1,
IIf(Ref(blackbody,-1) AND blackBody AND C>Ref(O,-1),1,
IIf(Ref(whiteBody,-1) AND whiteBody AND O>Ref(C,-1),1,
IIf(Ref(whiteBody,-1) AND blackBody AND C>Ref(C,-1),1,0))));

downGap=IIf(Ref(blackBody,-1)AND whiteBody AND C<Ref(C,-1),1,
IIf(Ref(blackbody,-1) AND blackBody AND O<Ref(C,-1),1,
IIf(Ref(whiteBody,-1) AND whiteBody AND C<Ref(O,-1),1,
IIf(Ref(whiteBody,-1) AND blackBody AND O<Ref(O,-1),1,0))));

/*Maximum High Today - (MHT)
Today is the maximum High in the last 5 days*/
MHT= HHV(H,5)==H;

/*Maximum High Yesterday - (MHY)
Yesterday is the maximum High in the last 5 days*/
MHY= HHV(H,5)==Ref ( H, -1);

/*Minimum Low Today - (MLT)
Today is the minimum Low in the last 5 days*/
MLT= LLV(L,5)==L;

/*Minimum Low Yesterday - (MLY)
Yesterday is the minimum Low in the last 5 days*/
MLY= LLV(L,5)==Ref(L,-1);

/*DOJI definitions*/

/*Doji Today - (DT)*/
DT = abs(C-O) <= (C*smallBodyMaximum) OR (abs(O-C)<=((H-L)*0.1));

/* Doji Yesterday - (DY)*/
DY = abs(Ref ( C, -1)-Ref(O,-1)) <= Ref ( C, -1) *smallBodyMaximum OR abs (Ref ( O, -1)-Ref(C,-1)) <= (Ref ( H, -1 ) - Ref ( L, -1 ) )*0.1;


O1 = Ref(O,-1);O2 = Ref(O,-2); 
H1 = Ref(H,-1);H2 = Ref(H,-2); 
L1 = Ref(L,-1);L2 = Ref(L,-2); 
C1 = Ref(C,-1);C2 = Ref(C,-2); 
NearDoji = (abs(O-C)<= ((H-L)*0.1)); 
BlackCandle = (O>C); 
LongBlackCandle = (O>C AND (O-C)/(0.001+H-L)>0.6); 
SmallBlackCandle = ((O>C) AND ((H-L)>(3*(O-C)))); 
WhiteCandle = (C>O); 
LongWhiteCandle = ((C>O) AND ((C-O)/(0.001+H-L)>0.6)); 
SmallWhiteCandle = ((C>O) AND ((H-L)>(3*(C-O)))); 
BlackMaubozu = (O>C AND H==O AND C==L); 
WhiteMaubozu = (C>O AND H==C AND O==L); 
BlackClosingMarubozu = (O>C AND C==L); 
WhiteClosingMarubozu = (C>O AND C==H); 
BlackOpeningMarubozu = (O>C AND O==H); 
WhiteOpeningMarubozu = (C>O AND O==L); 
HangingMan = (((H-L)>4*(O-C)) AND ((C-L)/(0.001+H-L)>= 0.75) AND ((O-L)/(0.001+H-L)>= 0.75)); 
Hammer = (((H-L)>3*(O-C)) AND ((C-L)/(0.001+H-L)>0.6) AND ((O-L)/(0.001+H-L)>0.6)); 
InvertedHammer = (((H-L)>3*(O-C)) AND ((H-C)/(0.001+H-L)>0.6) AND ((H-O)/(0.001+H-L)>0.6)); 
ShootingStar = (((H-L)>4*(O-C)) AND ((H-C)/(0.001+H-L)>= 0.75) AND ((H-O)/(0.001+H-L)>= 0.75)); 
BlackSpinningTop = ((O>C) AND ((H-L)>(3*(O-C))) AND (((H-O)/(0.001+H-L))<0.4) AND (((C-L)/(0.001+H-L))<0.4)); 
WhiteSpinningTop = ((C>O) AND ((H-L)>(3*(C-O))) AND (((H-C)/(0.001+H-L))<0.4) AND (((O-L)/(0.001+H-L))<0.4)); 
BearishAbandonedBaby = ((C1 == O1) AND (C2>O2) AND (O>C) AND (L1>H2) AND (L1>H)); 
BearishEveningDojiStar = ((C2>O2) AND ((C2-O2)/(0.001+H2-L2)>0.6) AND (C2<O1) AND (C1>O1) AND ((H1-L1)>(3*(C1-O1))) AND (O>C) AND (O<O1)); 
DarkCloudCover = (C1>O1 AND ((C1+O1)/2)>C AND O>C AND O>C1 AND C>O1 AND (O-C)/(0.001+(H-L)>0.6)); 
BearishEngulfing = ((C1>O1) AND (O>C) AND (O>= C1) AND (O1>= C) AND ((O-C)>(C1-O1))); 
ThreeOutsideDownPattern = ((C2>O2) AND (O1>C1) AND (O1>= C2) AND (O2>= C1) AND ((O1-C1)>(C2-O2)) AND (O>C) AND (C<C1)); 
BullishAbandonedBaby = ((C1 == O1) AND (O2>C2) AND (C>O) AND (L2>H1) AND (L>H1)); 
BullishMorningDojiStar = ((O2>C2) AND ((O2-C2)/(0.001+H2-L2)>0.6) AND (C2>O1) AND (O1>C1) AND ((H1-L1)>(3*(C1-O1))) AND (C>O) AND (O>O1)); 
BullishEngulfing = ((O1>C1) AND (C>O) AND (C>= O1) AND (C1>= O) AND ((C-O)>(O1-C1))); 
ThreeOutsideUpPattern = ((O2>C2) AND (C1>O1) AND (C1>= O2) AND (C2>= O1) AND ((C1-O1)>(O2-C2)) AND (C>O) AND (C>C1)); 
BullishHarami = ((O1>C1) AND (C>O) AND (C<= O1) AND (C1<= O) AND ((C-O)<(O1-C1))); 
ThreeInsideUpPattern = ((O2>C2) AND (C1>O1) AND (C1<= O2) AND (C2<= O1) AND ((C1-O1)<(O2-C2)) AND (C>O) AND (C>C1) AND (O>O1)); 
PiercingLine = ((C1<O1) AND (((O1+C1)/2)<C) AND (O<C) AND (O<C1) AND (C<O1) AND ((C-O)/(0.001+(H-L))>0.6)); 
BearishHarami = ((C1>O1) AND (O>C) AND (O<= C1) AND (O1<= C) AND ((O-C)<(C1-O1))); 
ThreeInsideDownPattern = ((C2>O2) AND (O1>C1) AND (O1<= C2) AND (O2<= C1) AND ((O1-C1)<(C2-O2)) AND (O>C) AND (C<C1) AND (O<O1)); 
ThreeWhiteSoldiers = (C>O*1.01) AND (C1>O1*1.01) AND (C2>O2*1.01) AND (C>C1) AND (C1>C2) AND (O<C1) AND (O>O1) AND (O1<C2) AND (O1>O2) AND (((H-C)/(H-L))<0.2) AND (((H1-C1)/(H1-L1))<0.2) AND (((H2-C2)/(H2-L2))<0.2); 
DarkCloudCover = (C1>O1*1.01) AND (O>C) AND (O>H1) AND (C>O1) AND (((C1+O1)/2)>C) AND (C>O1) AND (MA(C,13)-Ref(MA(C,13),-4)>0); 
ThreeBlackCrows = (O>C*1.01) AND (O1>C1*1.01) AND (O2>C2*1.01) AND (C<C1) AND (C1<C2) AND (O>C1) AND (O<O1) AND (O1>C2) AND (O1<O2) AND (((C-L)/(H-L))<0.2) AND (((C1-L1)/(H1-L1))<0.2) AND (((C2-L2)/(H2-L2))<0.2);
eveningStar=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND Ref(upGap,-1) AND NOT Ref(largeBody,-1) AND blackBody AND NOT smallBody AND (MHT OR MHY);
morningStar =Ref(largeBody,-2) AND Ref(blackBody,-2) AND Ref(downGap,-1) AND whiteBody AND LargeBody AND C>Ref(C,-2) AND MLY;
Doji = (O == C); 
MATCHLOW = LLV(Low,8)==LLV(Low,2) AND Ref(Close,-1)<=Ref(Open,-1)*.99 AND abs(Close-Ref(Close,-1))<=Close*.0025 AND Open>Ref(Close,-1) AND Open<=(High-((High-Low)*.5));
GapUpx = GapUp(); 
GapDownx = GapDown(); 
BigGapUp = L>1.01*H1; 
BigGapDown = H<0.99*L1; 
HugeGapUp = L>1.02*H1; 
HugeGapDown = H<0.98*L1; 
DoubleGapUp = GapUp() AND Ref(GapUp(),-1); 
DoubleGapDown = GapDown() AND Ref(GapDown(),-1); 

c_Status = 
WriteIf(HangingMan, "Hanging Man",
WriteIf(ShootingStar, "Shooting Star",
WriteIf(DarkCloudCover, "Dark Cloud Cover", 
WriteIf(BearishEngulfing, "Bearish Engulfing",
WriteIf(BearishHarami, "Bearish Harami",
WriteIf(eveningStar, "Evening Star",
WriteIf(Hammer, "Hammer",
WriteIf(InvertedHammer, "Inverted Hammer",
WriteIf(PiercingLine, "Piercing Line",
WriteIf(BullishEngulfing, "Bullish Engulfing",
WriteIf(BullishHarami, "Bullish Harami",
WriteIf(morningStar, "Morning Star",
WriteIf(NearDoji, "Near Doji",
WriteIf(Doji, "Doji",
WriteIf(MATCHLOW,"MATCHING LOW",
"Zilch" )))))))))))))));
P_status =
WriteIf(GapUpx, "Gap Up", 
WriteIf(GapDownx, "Gap Down",
WriteIf(BigGapUp, "Big Gap Up",
WriteIf(BigGapDown, "Big Gap Down",
WriteIf(HugeGapUp, "Huge Gap Up",
WriteIf(HugeGapDown, "Huge Gap Down",
WriteIf(DoubleGapUp, "Double Gap Up",
WriteIf(DoubleGapDown, "DoubleGapDown",
"Zilch" ))))))));
/*Tweezer Top*/
TweezerTop=abs(H-Ref(H,-1))<=H*0.0025 AND O >C AND (Ref(C,-1) > Ref(O,-1));

/*Tweezer Bottom*/
tweezerBottom= (abs(L-Ref(L,-1))/L<0.0025 OR
abs(L-Ref(L,-2))/L<0.0025) AND O < C AND (Ref( O,-1) > Ref(C,-1));
PATTERN = WriteIf(tweezerTop, "Tweezer Top",
WriteIf(tweezerBottom, "Tweezer Bottom","Zilch" ));

Filter = tweezerTop OR tweezerBottom;
//AddTextColumn(PATTERN, "Tweezer Pattern", 5.6, colorWhite, IIf(TweezerTop, colorRed, 
//IIf(TweezerBottom, colorGreen, colorLightGrey)));

//AddTextColumn(C_Status, "Candle Pattern", 5.6, colorWhite, IIf(HangingMan OR ShootingStar OR DarkCloudCover OR BearishEngulfing OR BearishHarami OR eveningStar, colorRed, 
//IIf(Hammer OR InvertedHammer OR PiercingLine OR BullishEngulfing OR BullishHarami OR morningStar OR MATCHLOW, colorGreen, IIf( NearDoji OR Doji, colorBlue, colorLightGrey))));
AddTextColumn(P_Status, "Price Pattern", 5.6, colorWhite, IIf(GapDownx OR BigGapDown OR HugeGapDown OR DoubleGapDown, colorRed, 
IIf(GapUpx OR BigGapUp OR HugeGapUp OR DoubleGapUp, colorGreen, colorLightGrey)));
AddTextColumn(PATTERN + " And " + C_Status, "Tweezer Pattern" , 5.6, colorWhite, IIf(TweezerTop, colorRed, 
IIf(TweezerBottom, colorGreen, colorLightGrey)));
AddColumn(C," CURRENT PRICE",1.2, IIf(C >Ref(C,-1),colorGreen,colorRed));
AddColumn(V," VOL TODAY ",1.2, IIf(V > MA(V,20),colorGreen, colorLightGrey));
/************************************************** *****
Candlestick Commentary
Load this file into the Commentary Option of the Analysis tab. Green arrows indicate bullish candles.
Red arrows indicate bearish candles. Scroll down the commentary for comments. 
This is a work in progress. Thanks to all on this forum whose code I may have incorporated into this file. Comments are from Steve Nison "Japanese Candlestick Charting Techniques" and the LitWick web site.
************************************************** ********/

/*Body Colors*/
whiteBody=C>=O;
blackBody=O>C;

/*Body Size*/
smallBodyMaximum=0.0025;//less than 0.25%
LargeBodyMinimum=0.01;//greater than 1.0%
smallBody=(O>=C*(1-smallBodyMaximum) AND whiteBody) 
OR (C>=O*(1-smallBodyMaximum) AND blackBody);
largeBody=(C>=O*(1+largeBodyMinimum) AND whiteBody) 
OR C<=O*(1-largeBodyMinimum) AND blackBody;
mediumBody=NOT LargeBody AND NOT smallBody;
identicalBodies=abs(abs(Ref(O,-1)-Ref(C,-1))-abs(O-C)) < 
abs(O-C)*smallBodyMaximum;
realBodySize=abs(O-C);


/*Shadows*/
smallUpperShadow=(whiteBody AND H<=C*(1+smallBodyMaximum))
OR (blackBody AND H<=O*(1+smallBodyMaximum));
smallLowerShadow=(whiteBody AND L>=O*(1-smallBodyMaximum)) 
OR (blackBody AND L>=C*(1-smallBodyMaximum));
largeUpperShadow=(whiteBody AND H>=C*(1+largeBodyMinimum)) 
OR (blackBody AND H>=O*(1+largeBodyMinimum));
largeLowerShadow=(whiteBody AND L<=O*(1-largeBodyMinimum)) 
OR (blackBody AND L<=C*(1-largeBodyMinimum));

/*Gaps*/
upGap= IIf(Ref(blackBody,-1)AND whiteBody AND O>Ref(O,-1),1,
IIf(Ref(blackbody,-1) AND blackBody AND C>Ref(O,-1),1,
IIf(Ref(whiteBody,-1) AND whiteBody AND O>Ref(C,-1),1,
IIf(Ref(whiteBody,-1) AND blackBody AND C>Ref(C,-1),1,0))));

downGap=IIf(Ref(blackBody,-1)AND whiteBody AND C<Ref(C,-1),1,
IIf(Ref(blackbody,-1) AND blackBody AND O<Ref(C,-1),1,
IIf(Ref(whiteBody,-1) AND whiteBody AND C<Ref(O,-1),1,
IIf(Ref(whiteBody,-1) AND blackBody AND O<Ref(O,-1),1,0))));


/*Candle Definitions*/
spinningTop=mediumBody;
doji=CdDoji(threshold=0.05);/*abs(C-O) <= (C*smallBodyMaximum) OR
(abs(O-C)<=((H-L)*0.1));*/
dojiStar=doji AND (upgap OR downgap)AND Ref(LargeBody,-1);
marabuzu=LargeBody AND smallUpperShadow AND smallLowerShadow;

shootingStar=/*(NOT largeBody AND smallLowerShadow AND LargeUpperShadow) OR*/
smallLowerShadow AND NOT doji AND
((blackBody AND abs(O-H)>2*realBodySize) OR
(whiteBody AND abs(H-C)>2*realBodySize));

Hammer=smallUpperShadow AND NOT doji AND
((blackBody AND abs(C-L)>2*realBodySize) OR
(whiteBody AND abs(L-O)>2*realBodySize));

tweezerTop=abs(H-Ref(H,-1))<=H*0.0025;
tweezerBottom=abs(L-Ref(L,-1))<=L*0.0025;
engulfing=
IIf(blackBody AND Ref(blackbody,-1) AND C<Ref(C,-1) AND O>Ref(O,-1),1,
IIf(blackBody AND Ref(whiteBody,-1) AND O>Ref(C,-1) AND C<Ref(O,-1),1,
IIf(whitebody AND Ref(whitebody,-1) AND C>Ref(C,-1) AND O<Ref(O,-1),1,
IIf(whiteBody AND Ref(blackBody,-1) AND C>Ref(O,-1)AND O<Ref(C,-1),1,0))));
Harami=
IIf(blackbody AND Ref(blackBody,-1) AND O<Ref(O,-1) AND C>Ref(C,-1),1,
IIf(blackBody AND Ref(whiteBody,-1) AND C>Ref(O,-1) AND O<Ref(C,-1),1,
IIf(whiteBody AND Ref(whiteBody,-1) AND C<Ref(C,-1) AND O>Ref(O,-1),1,
IIf(whiteBody AND Ref(blackBody,-1) AND O>Ref(C,-1) AND C<Ref(O,-1),1,0))));


/*Maximum High Today - (MHT)
Today is the maximum High in the last 5 days*/
MHT= HHV(H,5)==H;

/*Maximum High Yesterday - (MHY)
Yesterday is the maximum High in the last 5 days*/
MHY= HHV(H,5)==Ref ( H, -1);

/*Minimum Low Today - (MLT)
Today is the minimum Low in the last 5 days*/
MLT= LLV(L,5)==L;

/*Minimum Low Yesterday - (MLY)
Yesterday is the minimum Low in the last 5 days*/
MLY= LLV(L,5)==Ref(L,-1);

/*DOJI definitions*/

/*Doji Today - (DT)*/
DT = abs(C-O) <= (C*smallBodyMaximum) OR
(abs(O-C)<=((H-L)*0.1));

/* Doji Yesterday - (DY)*/
DY = abs(Ref ( C, -1)-Ref(O,-1)) <= Ref ( C, -1) *smallBodyMaximum OR
abs (Ref ( O, -1)-Ref(C,-1)) <= (Ref ( H, -1 ) - Ref ( L, -1 ) )*0.1;

/**************************************************
BULLISH CANDLESTICKS
************************************************** * */

/* Abandoned Baby Bullish*/
abandonedBabybullish =Ref(largeBody,-2) AND Ref(blackBody,-2)//Large black candle
AND Ref(GapDown(),-1) 
AND whiteBody AND LargeBody AND GapUp();//Large white candle

/* Belt Hold*///Bad formula
beltHoldBullish = largeBody AND smallLowerShadow AND whiteBody AND MLT;


/*BreakAway Bullish*/
breakAwayBullish=Ref(Largebody,-4) AND Ref(blackBody,-4)
AND Ref(blackBody,-3) AND Ref(O,-3)<Ref(C,-4)
AND Ref(smallbody,-2) AND Ref(C,-2)<Ref(C,-3)
AND Ref(C,-1)<Ref(C,-2)
AND LargeBody AND whiteBody AND C>Ref(O, -3) 
AND C<Ref(C,-4);

/*Concealing Baby Swallow only one trade */
ConcealingBabySwallow=Ref(marabuzu,-3) AND Ref(blackbody,-3) AND
Ref(MArabuzu,-2) AND Ref(blackBody,-2) AND
Ref(blackBody,-1) AND Ref(downGap,-1) AND 
Ref(H,-1)>Ref(C,-2)AND Ref(blackbody,-1)AND 
blackBody AND engulfing;

/*Doji Star Bullish*/
dojiStarBullish=(dojiStar AND (MLT OR MLY))OR 
(doji AND (C<Ref(C,-1) OR O<Ref(C,-1))AND Ref(blackBody,-1)
AND Ref(LargeBody,-1));

/*Engulfing Bullish*/ 
engulfingBullish =
engulfing AND largeBody AND whiteBody AND 
(Ref(blackbody,-1) OR Ref(Doji,-1)) AND MLT;

/*Hammer Bullish*/
hammerBullish=Hammer AND (MLT OR MLY);

/*Dragonfly Doji Bullish*/
dragonflyDoji=smallBody AND LargeLowerShadow AND smallUpperShadow AND MLT;

/* Harami Bullish*/
haramiBullish = harami AND Ref (LargeBody,-1) AND Ref(blackBody,-1) AND
NOT LargeBody AND whiteBody;

/*Harami Cross*/
HaramiCross=harami AND Ref(LargeBody,-1) AND Ref(blackBody,-1) AND doji; 

/* Homing Pigeon*/
homingPigeon = Ref(largeBody,-1) AND Ref(blackBody,-1) AND
H<= Ref ( O, -1 ) AND L>=Ref( C, -1) AND C<O AND MLY;

/*Inverted Hammer*/
invertedHammer=shootingStar AND (MLT OR MLY);

/* Meeting LinesBullish*/
meetingLinesbullish= Ref(LargeBody,-1) AND Ref(blackBody,-1) AND
LargeBody AND whiteBody AND
C>Ref(C,-1)*0.9975 AND C< Ref(C,-1)*1.0025;

/*Morning Doji Star*/
morningDojiStar= Ref(LargeBody,-2) AND Ref(blackBody,-2) AND
Ref(doji,-1) AND Ref(O,-1)<Ref(C,-2) AND
whiteBody AND C>Ref(C,-2) AND MLY;

/* Morning Star*/
morningStar =Ref(largeBody,-2) AND Ref(blackBody,-2)//Large black candle 
AND Ref(downGap,-1)//Gap down yesterday
AND whiteBody AND LargeBody AND C>Ref(C,-2)//Large white candle today
AND MLY; //Yesterday was the low

/* Piercing Line*/
piercingLine= Ref(largeBody,-1) AND Ref(blackBody,-1)AND
O<Ref(L,-1) AND C>=(Ref(O,-1)+Ref(C,-1))/2 AND C<Ref(O,-1) AND MLT;

/* Stick Sandwich*/
stickSandwich=Ref(largeBody,-2) AND Ref(blackbody,-2) AND 
Ref(largeBody,-1) AND Ref(whiteBody,-1) AND
Ref(O,-1)>=Ref(C,-2) AND O>=Ref(C,-1) AND
abs(C-Ref(C,-2))<=C*0.0025;

/*Three Inside Up harami confirming*/
threeInsideUp =Ref(Haramibullish,-1) AND whiteBody AND 
largeBody AND C>Ref(C,-1);


/* Three Outside Up Engulfing confirmation*/
threeOutsideUp =Ref(engulfingBullish,-1) AND whiteBody AND C>Ref(C,-1);

/* Three Stars in the South*///Rewrite???
threeStarsInTheSouth=
Ref(LargeBody,-2) AND Ref(blackBody,-2) AND Ref(largelowerShadow,-2)
AND Ref(blackBody,-1) AND Ref(largeLowerShadow,-1) AND 
Ref(L,-1)>Ref(L,-2) AND blackBody AND smallUpperShadow AND
smallLowerShadow AND L>Ref(L,-1) AND H<Ref(H,-1);

/* Tri-Star Bullish*/
triStarBullish=Ref(doji,-2) AND Ref(doji,-1) AND doji AND MLY AND
Ref(downgap,-1) AND upGap;

/* Three River Bottom Bad formula*/
threeriverBottom=Ref(largeBody,-2) AND Ref(blackBody,-2) AND
Ref(blackbody,-1) AND Ref(Largelowershadow,-1) AND
Ref(O,-1)<Ref(O,-2) AND Ref(C,-1)>Ref(C,-2) AND
whiteBody AND C<Ref(C,-1) AND MLY; 

/* Mat Hold Bullish*/
MAtHoldBullish=Ref(LargeBody,-4) AND Ref(whiteBody,-4)//1st day
AND Ref(blackBody,-3) AND Ref(upGap,-3) AND NOT Ref(LargeBody,-3)
AND NOT Ref(LargeBody,-2) AND Ref(C,-2)<Ref(C,-3) AND Ref (O,-2)<Ref(O,-3) AND 
Ref(C,-2)>Ref(O,-4) AND NOT Ref(LargeBody,-1) AND Ref(C,-1)<Ref(C,-2)
AND LargeBody AND whiteBody AND C>Ref(C,-4); 

/*RisingThreeMethods*/
risingThreeMethods=Ref(LargeBody,-4) AND Ref(whiteBody,-4) AND NOT
Ref(LargeBody,-3) AND NOT Ref(LargeBody,-2)AND NOT Ref(LargeBody,-1) AND
Ref(C,-3)<Ref(C,-4) AND Ref(C,-2)<Ref(C,-3) AND Ref(C,-1)<Ref(C,-2) AND
LargeBody AND whitebody AND C>Ref(C,-4);

/* Seperating Lines Bullish*/
separatingLinesBullish=Ref(blackBody,-1) AND whiteBody AND LargeBody AND
smallLowerShadow AND MHT AND abs(O-Ref(O,-1))<=O*0.0025;

/*Side by Side White Lines*/
sideBySideWhiteLines=NOT Ref(smallBody,-2) AND Ref(whiteBody,-2) 
AND Ref(upGap,-1) AND Ref(whitebody,-1)AND whiteBody AND
identicalBodies AND abs(O-Ref(O,-1))<O*0.0025;


/*Three White Soldiers*/
threeWhiteSoldiers=NOT Ref(smallbody,-2) AND Ref(whiteBody,-2) AND NOT
Ref(smallBody,-1) AND Ref(whiteBody,-1) AND NOT
smallBody AND whiteBody AND C>Ref(C,-1) AND Ref(C,-1)>Ref(C,-2) AND
Ref(O,-1)>Ref(O,-2) AND Ref(O,-1)<Ref(C,-2) AND O<Ref(C,-1) AND
O>Ref(O,-1) AND Ref(smallUpperShadow,-2) AND
Ref(smallUpperShadow,-1) AND smallUppershadow AND LLV(L,12)==Ref(L,-2);

/*Upside Gap Three Methods not very good*/
upsideGapThreeMethods=Ref(Largebody,-2) AND Ref(whiteBody,-2) AND
Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND Ref(upGap,-1) AND
blackBody AND O>Ref(O,-1) AND C<Ref(C,-2)AND C>Ref(O,-2) AND 
MHY;

/*Three Line Strike not good signals*/
threeLineStrike=NOT Ref(smallBody,-3) AND NOT Ref(smallBody,-2) AND 
NOT Ref(smallBody,-1) AND Ref(whiteBody,-3) AND Ref(whiteBody,-2) AND
Ref(whiteBody,-1) AND Ref(C,-1)>Ref(C,-2) AND Ref(C,-2)>Ref(C,-3) AND
blackBody AND O>Ref(C,-1) AND C<Ref(O,-3);

/*Tweezer Bottom*/
tweezerBottom= (abs(L-Ref(L,-1))/L<0.0025 OR
abs(L-Ref(L,-2))/L<0.0025) AND O < C AND (Ref( O,-1) > Ref(C,-1));

/*Upside Tasuki Gap*/
upsideTasukiGap=Ref(largeBody,-2) AND Ref(largeBody,1) AND
Ref(whiteBody,-2) AND Ref(whiteBody,-1) AND Ref(upGap,-1) AND
blackBody AND O>Ref(O,-1) AND C<Ref(O,-1) AND C>Ref(C,-2) AND
identicalBodies AND O<Ref(C,-1);
//AND HHV(H,5)==Ref(H,-1); Do not use this line


/*****************************************
BEARISH CANDLESTICKS
******************************************/

/*Abandoned Baby Bearish*/
AbandonedBabyBearish=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND
Ref(smallBody,-1) AND Ref(GapUp(),-1) AND GapDown() AND 
NOT smallBody AND blackBody AND MHY;

/*Advance Block Bearish*/
AdvanceBlockBearish=Ref(LargeBody,-2) AND Ref(whiteBody,-2) 
AND Ref(whiteBody,-1) AND
whiteBody AND Ref(O,-1)>Ref(O,-2) AND Ref(O,-1)<Ref(C,-2) AND
Ref(C,-1)>Ref(C,-2) AND C>Ref(C,-1) AND
O<Ref(C,-1) AND O>Ref(O,-1) AND Ref(LargeUpperShadow,-1) AND LargeUpperShadow
AND C-O<Ref(C,-1)-Ref(O,-1) AND Ref(C,-1)-Ref(O,-1) < Ref(C,-2)-Ref(O,-2);

/*Belt Hold Bearish*/
beltHoldBearish=LargeBody AND BlackBody AND smalluppershadow AND MHT;

/*Breakaway Bearish*/
breakAwayBearish=Ref(LargeBody,-4) AND Ref(whiteBody,-4) AND
Ref(GapUp(),-3) AND Ref(whiteBody,-3) AND 
Ref(smallbody,-2) AND Ref(smallBody,-1) AND
blackBody AND O>Ref(O,-3) AND C<Ref(C,-4);

/*Dark Cloud Cover*/
darkCloudCover=Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND
blackBody AND O>Ref(H,-1) AND C>Ref(O,-1) AND C<(Ref(O,-1)+Ref(C,-1))/2
AND MHT;

/*Deliberation Bearish: needs confirmation*/
deliberationBearish=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND
Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND Ref(C,-1)>Ref(C,-2) AND
smallbody AND upGap;

/*CounterAttackBearish*/
CounterAttackBearish=MHT AND LargeBody AND blackbody AND
Ref(largeBody,-1) AND Ref(whiteBody,-1) AND
C<Ref(C,-1)*1.0025 AND C>Ref(C,-1)*0.9975;;

/*Doji Star Bearish*/
dojiStarBearish=(dojiStar AND (MHT OR MHY))OR 
(doji AND (C>Ref(C,-1) OR O>Ref(C,-1))AND Ref(whiteBody,-1)
AND Ref(LargeBody,-1));

/*Engulfing Bearish*/
engulfingBearish=engulfing AND largeBody AND blackBody AND 
(Ref(whitebody,-1) OR Ref(Doji,-1))AND (MHT OR MHY);

/*Evening Doji Star check formula???*/
eveningDojiStar=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND
Ref(dojiStar,-1) AND Ref(GapUp(),-1) AND (MHY OR MHT);

/*Evening Star*/
eveningStar=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND
Ref(upGap,-1) AND NOT Ref(largeBody,-1) AND blackBody AND NOT smallBody AND
(MHT OR MHY);

/*Hammer Bearish*/
HammerBearish=Hammer AND HHV(H,8)==H;

/*hangingMan*/
HangingMan=NOT largeBody AND smallUpperShadow AND LargeLowerShadow AND MHT;

/*dragonfly Doji Bearish*/
dragonflyDojiBearish=doji AND smallUpperShadow AND LargeLowerShadow AND MHT;

/*Harami Bearish-*/
HaramiBearish=harami AND Ref(Largebody,-1) AND Ref(whiteBody,-1)AND blackBody 
AND (MHY OR MHT);

/*HaramiCross Bearish*/
HaramiCrossBearish=harami AND doji AND Ref(whiteBody,-1) AND Ref(Largebody,-1);

/*Identical three black crows*/
idendicalThreeBlackCrows=Ref(blackBody,-2) AND Ref(blackBody,-1) AND blackBody AND
abs(Ref(C,-2)-Ref(O,-1))<Ref(C,-1)*0.0025 AND abs(Ref(C,-1)-O)<O*0.0025 AND
HHV(H,20)==Ref(H,-2) AND NOT Ref(doji,-2) AND NOT Ref(doji,-1) AND NOT doji AND
Ref(smallLowerShadow,-2) AND Ref(smallLowerShadow,-1) AND smallLowerShadow;

/*Kicking Bearish No trades*/
kickingBearish=Ref(whiteBody,-1) AND Ref(MArabuzu,-1) AND blackBody AND MArabuzu AND GapDown();

/*Meeting Lines Bearish*/
MeetingLinesBearish=Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND
HHV(C,8)==Ref(C,-1) AND LargeBody AND blackBody AND 
abs(C-Ref(C,-1))<C*0.0025;

/*ShootingStar*/
shootingStarGap=shootingStar AND GapUp() AND MHT;

/*Gravestone Doji*/
gravestoneDoji=doji AND largeUpperShadow AND smallLowerShadow AND GapUp()AND MHT;

/*Three Inside Down Bearish*/
threeInsideDownBearish=Ref(HaramiBearish,-1) AND blackBody AND C<Ref(C,-1)AND smallUpperShadow;

/*Three Outside Down Bearish*/
threeoutsideDownBearish=Ref(engulfingBearish,-1) AND blackBody AND C<Ref(C,-1)AND
NOT LargeUpperShadow;

/*Tri Star Bearish*/
triStarBearish=Ref(doji,-2) AND Ref(doji,-1) AND doji AND MHY AND Ref(upGap,-1)AND downGap;

/*Two Crows Bearish*/
twoCrows=Ref(whiteBody,-2) AND Ref(LargeBody,-2) //first day
AND Ref(blackBody,-1) AND Ref(upGap,-1)//Second Day
AND blackBody AND O<Ref(O,-1) AND O>Ref(C,-1)AND C<Ref(C,-2) AND 
C>Ref(O,-2) AND MHY;//Third day

/*Upside Gap Two Crows*/
upsideGapTwoCrows= Ref(whiteBody,-2) AND Ref(LargeBody,-2)// first day
AND Ref(upGap,-1) AND Ref(blackBody,-1) // 2nd day
AND blackbody AND O>Ref(O,-1) AND C<Ref(C,-1) AND C>Ref(C,-2);

/*Doji Star Bearish needs confirmation
dojiStarBearish=Ref(LargeBody,-1) AND Ref(whiteBody,-1) // first day
AND doji AND upGap AND MHT;*/

/* Downside Gap Three Methods*/
downsideGapThreeMethods=
Ref(LargeBody,-2) AND Ref(blackBody,-2) AND Ref(downGap,-2) //first day
AND Ref(LargeBody,-1) AND Ref(blackBody,-1)//2nd day
AND whitebody AND O<Ref(O,-1) AND C>Ref(C,-2)
AND LLV(L,8)==Ref(L,-1);

/*Downside Tasuki Gap*/
downsideTasukiGap=
Ref(blackBody,-2)//first day
AND Ref(blackbody,-1) AND Ref(downgap,-1) //2nd day
AND whiteBody AND O<Ref(O,-1) AND O>Ref(C,-1) AND C>Ref(O,-1) AND C<Ref(C,-2)
AND Ref(identicalBodies,-1) 
AND LLV(L,15)==Ref(L,-1);


/*Falling Three Meothods*/
fallingThreeMethods=Ref(LargeBody,-4) AND Ref(blackBody,-4) AND
/*Ref(doji,-3) AND Ref(doji,-2) AND Ref(doji,-1) AND*/ Ref(C,-1)>Ref(C,-2) 
AND Ref(C,-2)>Ref(C,-3) AND LargeBody AND blackBody AND O>Ref(C,-4) AND
O<Ref(O,-4) AND C<Ref(O,-4)AND C<Ref(C,-4);

/*In Neck Bearish not good*/
inNeckBearish=Ref(LargeBody,-1) AND Ref(blackBody,-1) AND
whiteBody AND O<Ref(L,-1) AND C<Ref(C,-1)*1.0005 AND C>=Ref(C,-1);

/*On Neck Bearish not good*/
OnNeckBearish=Ref(LargeBody,-1) AND Ref(blackBody,-1) AND
whiteBody AND O<Ref(L,-1) AND C<Ref(L,-1)*1.0025 AND C>=Ref(L,-1)*0.9975;

/*separating Lines Bearish*/
separatingLinesBearish=Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND
blackBody AND O>Ref(O,-1)*0.9975 AND O<=Ref(O,-1)*1.0025;

/*Side By Side White Lines Bearish*/
sideBySideWhiteLinesBearish=NOT Ref(smallBody,-2) AND Ref(blackBody,-2) AND 
Ref(whiteBody,-1) AND whiteBody AND Ref(downGap,-1) AND identicalBodies
AND abs(C-Ref(C,-1)<C*0.0025);

/*Three Black Crows*/
threeBlackCrows=Ref(blackBody,-2) AND Ref(blackBody,-1) AND blackBody AND Ref(C,-1)<Ref(C,-2) AND C<Ref(C,-1) AND HHV(H,8)==Ref(H,-2) AND NOT Ref(doji,-2) AND NOT Ref(doji,-1) AND NOT doji;;

/*Three Line Strike no trades*/
threeLineStrike=threeBlackCrows AND whiteBody AND O<Ref(C,-1) AND C>Ref(O,-3);

/*Thrusting Bearish*/
thrustingBearish=Ref(blackBody,-1) AND Ref(LargeBody,-1) AND LargeBody AND
whitebody AND O<Ref(L,-1) AND C<(Ref(O,-1)+Ref(C,-1))/2 AND C>Ref(C,-1);

/*Tweezer Top*/
TweezerTop=abs(H-Ref(H,-1))<=H*0.0025 AND O >C AND (Ref(C,-1) > Ref(O,-1));




/* ***********************************************
Buy Rules
**************************************************/
Buy=
abandonedBabybullish OR
beltHoldBullish OR
breakAwayBullish OR
ConcealingBabySwallow OR 
engulfingBullish OR
hammerBullish OR
dragonflyDoji OR
dojiStarBullish OR
haramiBullish OR
HaramiCross OR
homingPigeon OR
invertedHammer OR
meetingLinesbullish OR
morningDojiStar OR
morningStar OR
piercingLine OR
stickSandwich OR
threeInsideUp OR
threeOutsideUp OR
threeStarsInTheSouth OR 
triStarBullish OR
threeriverBottom OR
MAtHoldBullish OR
risingThreeMethods OR
separatingLinesBullish OR
sideBySideWhiteLines OR
threeWhiteSoldiers OR
upsideGapThreeMethods OR
threeLineStrike OR
tweezerBottom OR
upsideTasukiGap;

/************************************
Sell Rules
*************************************/
Sell=
AbandonedBabyBearish OR
advanceBlockBearish OR
beltHoldBearish OR
breakAwayBearish OR
darkCloudCover OR
deliberationBearish OR
CounterAttackBearish OR
engulfingBearish OR
eveningDojiStar OR
eveningStar OR
HangingMan OR
dragonflyDojiBearish OR
HammerBearish OR
HaramiBearish OR
HaramiCrossBearish OR
idendicalThreeBlackCrows OR
kickingBearish OR
MeetingLinesBearish OR
shootingStarGap OR
gravestoneDoji OR
threeInsideDownBearish OR
threeoutsideDownBearish OR
triStarBearish OR
twoCrows OR
upsideGapTwoCrows OR
dojiStarBearish OR
downsideGapThreeMethods OR
downsideTasukiGap OR
fallingThreeMethods OR
inNeckBearish OR
OnNeckBearish OR
separatingLinesBearish OR
sideBySideWhiteLinesBearish OR
threeBlackCrows OR
threeLineStrike OR
thrustingBearish OR
tweezerTop;


/***************************************
Commentary
***************************************
Bullish Candles
****************************************/
C_sta =
WriteIf(abandonedBabybullish,"Abandoned Baby Bullish. A reversal pattern.\nLiWick reliability : High.",
WriteIf(beltHoldBullish,"Belt Hold Bullish. A reversal pattern.\nNison:The larger the candlestick, the more significant it is.\nLitWick Reliability: Low.",
WriteIf(breakAwayBullish,"Break Away Bullish. A reversal pattern.\nLitWick reliability: moderate.",
WriteIf(ConcealingBabySwallow,"Concealing Baby Swallow. A reversal pattern.\n LitWick reliability: high.",
WriteIf(dojiStarBullish,"Bullish doji Star. A reversal pattern.\nNison: Needs confirmation. Better at calling tops.\nLitWick reliability: moderate.",
WriteIf(engulfingBullish,"Bullish Engulfing. a reversal pattern.\nNison: Factors increasing the pattern's effectiveness are\n1) The first day has a small real body and the second day has a large real body.\n2) Pattern appears after protracted or very fast move.\n3) Heavy volume on second real body.\n4) The second day engulfs more than one real body.\nLitWick reliability: moderate",
WriteIf(hammerBullish,"Bullish Hammer. A reversal pattern.\nNison: The longer the lower shadow, the smaller the upper shadow, and the smaller the real body, the more significant the pattern.White real body more bullish than black body.\nLitWick reliability: low.",
WriteIf(dragonflyDoji,"Dragonfly Doji. LitWick reliability: moderate.",
WriteIf(haramiBullish, "Harami Bullish. A reversal pattern.\nNison: Less significant. Pattern needs confirmation.\nLitWick reliability: low.",
WriteIf(HaramiCross,"Harami Cross. A reversal pattern.\nNison: Better indicator than Harami. Better at calling tops than bottoms.\nLitWick reliability: low.",
WriteIf(homingPigeon,"Homing Pigeon. A reversal pattern.\nLitWick reliability: moderate.",
WriteIf(invertedHammer,"Inverted Hammer. A reversal pattern.\nNison:Needs bullish verification.\nLitWick reliability: low.",
WriteIf(meetingLinesbullish,"Meeting Lines bullish. A reversal pattern.\nLitWick reliability: moderate.",
WriteIf(morningDojiStar,"Morning Doji Star. A reversal pattern.\nImportant reversal signal.\nLitWick reliability: high.",
WriteIf(morningStar,"Morning Star. A reversal pattern.\nNison: The stronger the white third body the better.\nLitWick reliability: high.",
WriteIf(piercingLine,"Piercing Line. A reversal pattern.\nNison: A stron reversal pattern.\nLitWick reliability: moderate.",
WriteIf(stickSandwich,"Stick Sandwich. A reversal pattern.\nLitWick reliability: moderate.",
WriteIf(threeInsideUp,"3 Inside Up. A reversal pattern.\nLitWick reliability: high.",
WriteIf(threeOutsideUp,"3 Outside Up. A reversal pattern.\nLitWick reliability: high.",
WriteIf(threeStarsInTheSouth,"3 Stars in the South. A reversal pattern.\nLitWick reliability: moderate.",
WriteIf(triStarBullish,"Tri-Star Bullish. A reversal pattern.\nNison: Significant reversal pattern.\nLitWick reliability: moderate.",
WriteIf(threeriverBottom,"3 River Bottom. A reversal pattern.\nNison: Selling pressure drying up.\nLit Wick reliability: moderate.",
WriteIf(MAtHoldBullish,"Mat Hold Bullish. A continuation pattern.\nNison: May have 2-4 black candles.\nLitWick reliability: high. ",

WriteIf(risingThreeMethods,"Rising Three Methods. A continuation pattern>\nNison: Has more significance if volume of white candle sticks is greater than on black candlesticks.\nLitWick reliability: high.",
WriteIf(separatingLinesBullish,"Separating Lines Bullish. A continuation pattern.\nNison: \nLitWick reliability: low.",
WriteIf(sideBySideWhiteLines,"Side by Side White Lines. A continuation pattern.\nNison: If occurring during a downtrend may only be short covering.\nLitWick reliability: high.",
WriteIf(threeWhiteSoldiers,"3 White Soldiers. A continuation pattern.\nNison: Positive, but be aware of negative similar stalled pattern and advance block pattern.\nLitWick reliability: high.",
WriteIf(upsideGapThreeMethods,"Upside Gap 3 Methods. A continuation pattern.\nLitWick reliability: moderate.",
WriteIf(threeLineStrike,"3 Line Strike. A continuation pattern.\nLitWick reliability: low.",
WriteIf(tweezerBottom,"Tweezer Bottom.a reversal pattern. With other reversal candles it could indicate a support level.\nNison: Needs confirmation.",
WriteIf(upsideTasukiGap,"Upside Tasuki Gap. A continuation pattern.\nNison: the real bodies of the two candlesticks in the gap should be about the same size.\nLitWick reliability: moderate.",
"No Commentary..." )))))))))))))))))))))))))))))));

/***************************************
Bearish Candles
********************************************/
C_be = 
WriteIf(AbandonedBabyBearish,"Abandoned Baby Bearish. A reversal pattern.\nNison: Extremely rare.\nLitWick reliability: high.",
WriteIf(advanceBlockBearish,"Advancing Block Bearish. A reversal pattern.\nNison: Rally is in trouble. Signs of weakening could be progressively smaller white read bodies or relatibvely long upper shadows on the last two white candlesticks.Not necessarily a reversal pattern.\nLitWick Reliability: moderate.",
WriteIf(beltHoldBearish,"Belt Hold Bearish. A reversal pattern.\nNison: The longer the height of the belt-hold candle the more significant the pattern.\nLitWick reliability: low.",
WriteIf(breakAwayBearish,"Break Away Bearish. A reversal pattern.\nLitWick reliability: moderate.",
WriteIf(darkCloudCover,"Dark Cloud Cover. A reversal pattern.\nNison: Factors indicating the importance of this signal are/n1)The greater the penetration of the first candle by the second.\n2)Both candles are marabozus.\n3)The second body opens above a major resistance level.\n4)High volume on the second day.\nLitWick Reliability: high.",
WriteIf(deliberationBearish,"Deliberation Bearish. A reversal pattern.\nNison: Not a reversal pattern, but a sign the rally is weakening.\nLitWick reliability: moderate.",
WriteIf(CounterAttackBearish,"Counter Attack Bearish.\nNison: A potential stalling of the rally.",
WriteIf(engulfingBearish,"Engulfing Bearish. A reversal pattern.\nNison: Major reversal signal. Factors increasing patterns importance are\n1) The first day has a very small real body and the second day a very large real body.\n2) The pattern apears after a protracted or very fast move.\n3) Heavy volume on the second day.\n4) The second day engulfs more than one real body.\nLitWick reliability: moderate.",
WriteIf(eveningDojiStar,"Evening Doji Star A reversal pattern.\nNison: Must be confirmed by long black candle.\nLit Wick reliability: high",
WriteIf(eveningStar,"Evening Star. a reversal pattern.\nNison: Gap between second and third bodies does not always occur.\nLitWick reliability: high.",
WriteIf(HammerBearish,"Bearish Hammer. a reversal pattern.\nNison: More bearish if hammer is black. Needs bearish confirmation. A large gap down on the following day would be a good confirmation.",
WriteIf(HangingMan,"Hanging Man. A reversal pattern.\nNison: Same as bearish hammer with a large gap down the following day.\nLitWick reliability: low.",
WriteIf(dragonflyDojiBearish,"Dragonfly Bearish. A reversal pattern.\nNison: Same as Hanging Man.\nLitWick reliability: moderate.",
WriteIf(HaramiBearish,"Harami Bearish. A reversal pattern.\nNison: Not as significant a reversal pattern as hanging man or engulfing.\nLitWick reliability: low.",
WriteIf(HaramiCrossBearish,"Harami Cross Bearish. A reversal pattern.\nNison: More significant reversal pattern than Harami. Second day can be white or black.\nLitWick reliability: moderate.",
WriteIf(idendicalThreeBlackCrows,"Identical 3 Black Crows. A reversal pattern in an uptrend.\nNison:Very bearish.\nLitWick reliability: high. ",
WriteIf(kickingBearish,"Kicking Bearish. A reversal pattern.\nLitWick reliability: high.",
WriteIf(MeetingLinesBearish,"Meeting Lines Bearish. A reversal pattern.\nNison: \nLitWick reliability: moderate, but not as strong as Dark cloud Cover.",
WriteIf(shootingStarGap,"Shooting Star. a reversal pattern.\nNison:Not major reversal signal as evening star. Ideally real body would gap away from previous body. Needs to appear after an uptrend.\nLitWick reliability: low.",
WriteIf(gravestoneDoji,"Gravestone Doji A reversal pattern.\nNison: more significant if it hits new high.\nLitWick reliability: moderate.",
WriteIf(threeInsideDownBearish,"3 Inside Down. A reversal pattern.\nNison: \nLitWick reliability: high.",
WriteIf(threeoutsideDownBearish,"3 Outside Down. A reversal pattern.\nLitWick reliability: high.",
WriteIf(triStarBearish,"Tri-Star Bearish. A reversal pattern.\nNison: Very significant reversal pattern.\nLitWick reliability: moderate.",
WriteIf(twoCrows,"2 Crows A reversal pattern.\nLitWick reliability: moderate.",
WriteIf(upsideGapTwoCrows,"Upside Gap 2 Crows. A reversal pattern.\nNison:Needs confirmation of a continued reversal on third day.\nLitWick reliability: high.",
WriteIf(dojiStarBearish,"Doji Star Bearish. A reversal pattern.\nNison: needs confirmation.\nLitWick reliability: moderate.",
WriteIf(downsideGapThreeMethods,"Downside Gap 3 Methods. A continuation pattern.\nNison: \nLitWick reliability: moderate.",
WriteIf(downsideTasukiGap,"Downside Tasuki Gap. A continuation method.\nNison: If last day closes window, continuation pattern is negated.\nLitWick reliability: moderate.",
WriteIf(fallingThreeMethods,"Falling 3 Methods. A continuation pattern.\nNison: \nLitWick reliability: high.",
WriteIf(inNeckBearish,"In Neck Bearish. A continuatin pattern.\nNison: Similar to piercing pattern but bearish because there is no penetration of second day.\nLitWick reliability: moderate.",
WriteIf(OnNeckBearish,"On Neck Bearish. A continuation pattern. Similar to piercing pattern but bearish beccause there is no penetration of the second day.\nLitWick reliability: moderate.",
WriteIf(separatingLinesBearish,"Separating Lines Bearish",
WriteIf(sideBySideWhiteLinesBearish,"Side by Side White Lines Bearish. A continuation pattern.\nNison: very rare.\nLitWick reliability: moderate.",
WriteIf(threeBlackCrows,"3 Black Crows. A reversal pattern.\nNison: Need to appear after a mature advance.\nLitWick reliability: high.",
WriteIf(threeLineStrike,"3 Line Strike. A continuation pattern.\nLitWick reliability: low.",
WriteIf(thrustingBearish,"Thrusting. A continuation pattern.\nNison: Not a reversal day because second day does not pierce midpoint of first day.\nLitWick reliability: low.",
WriteIf(tweezerTop,"Tweezer Top. A reversal pattern.\nNison: Needs confirmation.",
"No Commentary..." )))))))))))))))))))))))))))))))))))));


/***********************************************
End Commentary
************************************************/
Plot(C,"Price", IIf(C> Ref(C,-1),colorGreen,colorRed), styleCandle ); 
Title = EncodeColor(colorWhite)+ FullName()+"\n"+EncodeColor(colorGold)+ " Ngay:"+ Date() +StrFormat(" - Open %g, Hi %g, Lo %g, Close %g " , O,H,L,C )+"Volume : " + V +"\n"+ "_____ Candlestick Commentary _____" +"\n"+ "_ Bullish Candles:"+
EncodeColor(colorGreen)+
C_sta + "\n"+EncodeColor(colorGold)+"_ Bearish Candles :"+EncodeColor(colorRed)+
C_be +"\n"+EncodeColor(colorBrightGreen)+ "_____ praveen _____";
Plot(EMA(C,20)," ", colorGreen,1);
Plot(EMA(C,50)," ", colorYellow,1);
Plot(EMA(C,200)," ", colorRed,1);
Plot(EMA(C,100)," ", colorWhite,1);
//PlotVAPOverlay( Param("lines",300,10,1000,1), Param("width",10,1,99,1), ParamColor("color", colorDarkBlue), Param("style",0,0,7,1) );
//PlotVAPOverlayA( Param("Lines", 300, 100, 1000, 1 ), Param("Width", 80, 1, 200, 1 ), ParamColor("Color", colorGold ), ParamToggle("Side", "Left|Right" ) | 2 * ParamToggle("Style", "Fill|Lines", 0) | 4*ParamToggle("Z-order", "On top|Behind", 1 )) ; 
//Plot(segments, "", colorLightGrey, styleHistogram | styleOwnScale ); 
PlotVAPOverlay( Param("lines",300,10,1000,1), Param("width",10,1,99,1), ParamColor("color", colorDarkBlue), Param("style",0,0,7,1) |4*ParamToggle("Z-order", "On top|Behind", 1 ));
_SECTION_BEGIN("Background text");

GfxSelectFont("Time news roman", Status("pxheight")/6 );
GfxSetTextAlign(6 );// center alignment
GfxSetOverlayMode(1 ) ;
//GfxSetTextColor( ColorRGB( 200, 200, 200 ) );
GfxSetTextColor( ColorHSB( 42, 42, 42 ) );
GfxSetBkMode(0); // transparent
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/19 );
GfxSelectFont("Time news roman", Status("pxheight")/30 );
GfxTextOut(FullName(), Status("pxwidth")/2, Status("pxheight")/3.8 );
GfxSelectFont("Time news roman", Status("pxheight")/25 );
GfxTextOut("Market: " + MarketID(1), Status("pxwidth")/2, Status("pxheight")/3 );
_SECTION_BEGIN("Volume");
Plot( Volume, _DEFAULT_NAME(), ParamColor("Color", colorLavender ), styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram ), 2 );
_SECTION_END(); 

Contain & Image ©️ Copyright By, Trading Fuel Research Lab

Author

Tradingfuel © 2024 | All Rights Reserved

    Join Free Class





    Join Free Class