Download MetaTrader 5
To add comments, please log in or register
Do you want to become a well-known developer? Execute the orders of traders in the Freelance service!
Mehrdad Shiri
4450
Mehrdad Shiri 2013.10.11 01:00 

hi,

if you have information about :

best setting for identify Pinbar Candle & The relative percentage of body components & other nessecary condition for it's body or Adjacent candle, can use it in a code , can you please talk about it here ?

thank you.

Mehrdad Shiri
4450
Mehrdad Shiri 2013.10.11 01:00  

start with pinbardetector.mq5 in  https://www.mql5.com/en/code/1595.

Description:

The indicator which fixes Pin Bars in the chart. You can read about Pin Bars here.

Pin Bar's pattern consists of three bars: "left eye", "nose" and "right eye". The "left eye" must be the growing bar for the bearish Pin Bar or falling bar for the bullish Pin Bar. "Nose" must be opened and closed inside the "left eye", but its maximum (or minimum for the bullish pattern) must protuberate far from the maximum (or minimum) of the left eye. Open and close levels of the "nose" must be located in the upper quarter of the bar:

Fig.1 Pin Bar Pattern

Fig.1 Pin Bar Pattern 

An additional condition for a good pattern is the presence of strong support/resistance lines behind the "eyes" or near the tip of the "nose". The stronger these levels, the more exact the pattern. 

Entry conditions:

  • An aggressive entry point is the price rollback out of the close level of the "left eye".
  • Conservative point is the price fall below the"nose" level (higher for the bullish pattern).

Exit conditions:

  • Conservative Stop Loss can be set behind the proximate support/resistance level and "eyes". It would be less conservative approach to place Stop Loss on the tip of the "nose" (in this case profit/risk ratio is affected).
  • Conservative Take Profit can be set immediately behind the minimum of the "left eye" (maximum, for the bullish pattern). Aggressive level of Take Profit can be set further on the next support/resistance level.

Indicator input parameters:

input bool UseAlerts=true; // Permission for alerts
input bool UseEmailAlerts=false; // Permission for email alerts
input double MaxNoseBodySize = 0.33; // maximum allowed ratio of Nose body to the whole bar length
input double NoseBodyPosition = 0.4; // extreme position of Nose body inside the bar. The upper part is for the bullish figure, the lower is for the bearish one
input bool   LeftEyeOppositeDirection=true; // Left eye must be bearish for the bullish Pin Bar and bullish for the bearish Pin Bar
input bool   NoseSameDirection=false; // Nose must be of the same direction as the figure itself
input bool   NoseBodyInsideLeftEyeBody=false; // Nose body must be placed in Left eye body
input double LeftEyeMinBodySize=0.1; // minimum Left eye body size relative to bar length
input double NoseProtruding=0.5; // minimum protuberance of Nose relative to bar length
input double NoseBodyToLeftEyeBody=1; // maximum Nose body size relative to Left eye body
input double NoseLengthToLeftEyeLength=0; // minimum Nose length relative to Left eye
input double LeftEyeDepth=0.1; //  minimum Left eye depth relative to its length. Depth — length of the part of bar behind Nose 

if you have any other idea please write it here.

thank you.

Pinbar Detector
Pinbar Detector
  • votes: 23
  • 2013.03.18
  • Nikolay Kositsin
  • www.mql5.com
The indicator which fixes Pin Bars in the chart
Alain Verleyen
Moderator
30298
Alain Verleyen 2013.10.11 01:35  

There is also this one https://www.mql5.com/en/code/1768. I didn't test it though, did you ?

About Pin bar I suggest you the site of Nial Fuller, who is a professional trade. One of his favorites setup is the Pin bar.

PinBar
PinBar
  • votes: 17
  • 2013.07.31
  • Andrew
  • www.mql5.com
An indicator of pin bars, to be used as a built-in indicator in Expert Advisors. Shows levels specified by the pattern for the open price and stop-loss.
Mehrdad Shiri
4450
Mehrdad Shiri 2013.10.11 01:47  
angevoyageur:

There is also this one https://www.mql5.com/en/code/1768. I didn't test it though, did you ?

About Pin bar I suggest you the site of Nial Fuller, who is a professional trade. One of his favorites setup is the Pin bar.

thank you to reply.

i have it on chart but i have most signal from "pinbardetector.mq5" .

i will check them all in deep.

thank you.

Mehrdad Shiri
4450
Mehrdad Shiri 2013.10.15 03:40  

I searched about this , some of important i found are this:

-------------------------------------------------------------------------

Pin Bar  "Pinocchio Bar"

Body Lengt, 33

The body is at least 33 percent of the candle.     <----- 2

Body Position, 33
The body is in the first 33 percent of candle.      <----- 3
(this can be top or bottom percent)

Nose Leng, 33

Nose or Wick,is at least 33 percent of candle.    <----- 4

-------------------------------------------------------------------------

A Pin Bar formation must have the following:
- Open and close within previous bar                                                                    <----- 5
- Candle wick minimum 3 times the length of the candle body                                 <----- 6

- Long nose protruding from all other bars (must stick out from all other candles)     <----- 7

Pin Bars The best Pin Bars are the ones that form after a pullback in the market.

Pin Bars that form without a pullback in the market can be dangerous.                         <----- 8

Pring felt like the long upside wick was akin to Pinnochio’s nose growing when he lied.

Not All Pin Bars Are Created Equal Pins must form at the top and bottoms of an extended move;

when they form in the middle of consolidation, they are not nearly as reliable.

Pins must have a small head and long wick. If the head is too big it is not a pin bar.

There should be a very clear difference in the length of the wick and the length of the body.

Location

The location of the pin bar is essential. Ideally they should be in line with the overall currency trading trend,

and they should form at areas of strong support/resistance.                                                                        <----- 9

Entry & Exit

Entry is always on break of nose, and stop is always just beyond tip of the wick.                                          <----- 10

the best Pin bar is considered to be a candle where the wick is 2/3 of the whole candle                                <----- 11

. First we must draw Support and Resistance levels and then, if we see a Pin bar forming at one of our previously drawn levels,

we must determine if it’s formed in the direction of the trend or counter-trend.

Pin Bar strategy summary:
Entry rules:
1.Determine the trend.
2.Draw Support and Resistance levels.
3.Wait for the a retracement to begin (counter trend move).                                                                  <----- 12
4.If in a downtrend, during the retracement, a Pin Bar appears at a Resistance level, go short.
5.If in an uptrend, during the retracement, a Pin Bar appears at a Support level, go long.

Pin Bar
This is a bar that has long, long tail and small head. looks like a pin. perfect pin would be

1. it should be obvious from very far off distance. it should be bigger than the previous bar.                      <----- 13

if previous bar is dominating, then most likely this pin bar would be some kind of profit booking bar. also be aware of friday, low volume pin bars that would most likely be profit booking bars

2. it should close within previous bar body. if it closes below prev bar in a down trend, then it doesnt tell us that it has reversed its direction.       <----- 14
3. pin head should be at the top/bottom as much as possible. if it closes around middle of the bar, its more like a doji, indecision bar.

Confluence

1. one of the above signals
2. location. this is THE most important thing in this system. we take pin bars at swing high or low. this means there is a series of bars going down, down and then we find a pin, then thats a signal for reversal and we may take long position. if you find a pin in a ranging market, then its not good enough as it could be one of those profit taking bars. we need a good swing. how good it should be ? it should be obvious even if we look at a distance from your screen. pin bar at swing low tells that bears have pushed the bar low, it has breached previous low, but the bulls have taken over and the reversal might be coming. same with swing high. so location plays a major role. location can be at swing high/low or major support/resistance zones. if we are looking at daily chart, we need to look for atleast 3 months of data or more. every small support/resistence or swing can be a trigger.

4. ema 150, 365. if we are near any of these 2 EMAs, then it adds strength.

At a minimum I am looking for a wick that is three times the length of the body,                       <----- 15

but the longer the better. A Pin Bar with a wick that is ten times the length of the body has a much higher probability than one with much less.

Location, location, location is just as true for a  Pin Bar Candlestick as it is for real estate. I will get into this later in the article but it is just as important as the reversal pattern itself.

The wick must stick out from the surrounding price action

Stop placement when trading the Pin Bar Candlestick

Stop Loss placement is the simplest part of the whole equation. In my opinion there is only one place to put your stop when taking a Pin Bar play and that is at the extreme of the long wick, I generally place mine the distance of the spread plus five pips.                   <----- 16

-------------------------------------------------------------------------

Not All Pin Bars Are Created Equal

Pins must form at the top and bottoms of an extended move; when they form in the middle of consolidation,

they are not nearly as reliable.

Pins must have a small head and long wick. If the head is too big it is not a pin bar. There should be a very clear

difference in the length of the wick and the length of the body.

Location, Location, Location

The location of the pin bar is essential. Ideally they should be in line with the overall currency trading trend, and they

should form at areas of strong support/resistance.

Entry & Exit

Entry is always on break of nose, and stop is always just beyond tip of the wick.               <----- 17

--------------------------------------------------------------------------------------------------------------------------------------------------

pinbardetector.mq5

input double CustomMaxNoseBodySize = 0.33; // Max. Body / Candle length ratio of the Nose Bar          <----- 18
input double CustomNoseBodyPosition = 0.4; // Body position in Nose Bar (e.g. top/bottom 40%)          <----- 19     
input bool   CustomLeftEyeOppositeDirection = true;  <----- 20 // true = Direction of Left Eye Bar should be opposite to pattern (bearish bar for bullish Pinbar pattern and vice versa)
input bool   CustomNoseSameDirection = false;  <----- 21// true = Direction of Nose Bar should be the same as of pattern (bullish bar for bullish Pinbar pattern and vice versa)
input bool   CustomNoseBodyInsideLeftEyeBody = false;  <----- 22// true = Nose Body should be contained inside Left Eye Body
input double CustomLeftEyeMinBodySize = 0.1;  <----- 23// Min. Body / Candle length ratio of the Left Eye Bar
input double CustomNoseProtruding = 0.5;  <----- 24// Minmum protrusion of Nose Bar compared to Nose Bar length
input double CustomNoseBodyToLeftEyeBody = 1;  <----- 25// Maximum relative size of the Nose Bar Body to Left Eye Bar Body
input double CustomNoseLengthToLeftEyeLength = 0;  <----- 26// Minimum relative size of the Nose Bar Length to Left Eye Bar Length
input double CustomLeftEyeDepth = 0.1;  <----- 27// Minimum relative depth of the Left Eye to its length; depth is difference with Nose's back

-------------------------------------------------------------------------

pinbar.mq5

//Bear pinbar must have bear body, bull pinbar must have a bull body
input bool     UseBodyDirection=false;    <----- 28         
//Bar is divided into 3 equal parts. Bear pinbar must close in the lower part, bull pin bar -- in the upper one
input bool     UseCloseThirds=true;       <----- 29     
//Bear(bull) pinbar must be higher(lower) then several previous. Can be zero to disable extremum check 
input int      ExtremumOfBars=10;         <----- 30  

in next comment will change them to Relations :

Mehrdad Shiri
4450
Mehrdad Shiri 2013.10.15 03:40  

summary : with use this fig.


--------------------------------------------------

1)   S >= 2B

--------------------------------------------------

2)  B <= 0.33 C

3)  The body is in the first 33 percent of candle

4)  S >= 0.33 C

5)  Open and close within previous bar

6)  S >= 3 B

7)  Long nose protruding from all other bars (must stick out from all other candles)

8)  Pin Bars that form without a pullback in the market can be dangerous

9)  Location   support/resistance

10)  Entry & Exit  EN, EX

11)  S >= 2C/3

12)  Wait for the a retracement to begin (counter trend move). ====> 5

13)  it should be obvious from very far off distance. it should be bigger than the previous bar.

14)  it should close within previous bar body

15)  S >= 3 B

16)  Stop Loss : EX+Spread+5 pips

17)  Entry  @ EN  &   Stop Loss is EX

--------------------------------------------------

18)  Max. Nose Body / Candle Size    B / C <= 0.33

19)  Nose Body Position <= 0.4

20)  Left Eye Opposite Direction = true

21)  Nose Same Direction = false

22)  Nose Body Inside Left Eye Body = false

23)  Left Eye Min Body Size = 0.1

24)  Min, Nose Protruding = 0.5

25)  Max. Nose Body To Left Eye Body = 1

26)  Min. Nose Length To Left Eye Length = 0

27)  Min. Left Eye Depth = 0.1    Minimum relative depth of the Left Eye to its length; depth is difference with Nose's back

--------------------------------------------------

28)  Use Body Direction=false;

29)  Use Close Thirds=true;

30)  Extremum Of Bars=10;  //Bear(bull) pinbar must be higher(lower) then several previous. Can be zero to disable extremum check

--------------------------------------------------

in next comment i will remove similar Relations or try to find best setting:

and then we have a few important settingو and can Comment about it here ;

Mehrdad Shiri
4450
Mehrdad Shiri 2013.10.15 10:49  

summary for parameter :

 

A)  S >= 2B , S >= 3 B , S >= 0.33 C , S >= 0.67 C

B)  B <= 0.33 C

C)  Pin Bar Body Position :  in the first 33 percent of candle , Nose Body Position <= 0.4 , Use Close Thirds=true

D)  within previous bar : Open and close within previous bar , Pin Bars that form without a pullback in the market can be dangerous ,

                                        Wait for the a retracement to begin (counter trend move) ,   it should close within previous bar body

                                        Left Eye Opposite Direction = true , Nose Body Inside Left Eye Body = false

E) Pin Bar should be the same as of pattern (bullish/bearish)  :  Nose Same Direction = false , Use Body Direction=false

F)  Entry :  EN

G)  Exit/Stop Loss :   EX ,  EX+Spread+5 pips

H) Location :  support/resistance

I)  Left Eye Min Body Size = 0.1

J) Minmum protrusion : Min, Nose Protruding = 0.5   ( Minmum protrusion of Nose Bar compared to Nose Bar length )

K) it should be obvious from very far off distance. it should be bigger than the previous bar ,

     Long nose protruding from all other bars (must stick out from all other candles) ,

     Extremum Of Bars=10;  //Bear(bull) pinbar must be higher(lower) then several previous. Can be zero to disable extremum check

L)  Maximum relative size of the Nose Bar Body to Left Eye Bar Body :  Max. Nose Body To Left Eye Body = 1


M)  Minimum relative depth of the Left Eye to its length : Min. Left Eye Depth = 0.1 ,  ( depth is difference with Nose's back )

N)  Minimum relative size of the Nose Bar Length to Left Eye Bar Length :   Min. Nose Length To Left Eye Length = 0

CAN YOU PLEASE SHARE your opinion about this  parameter and the suggestion value  for them , or is there anotere important parameter must use it ?

please comment  about  it ,

thank's in advance.

evertonzn
28
evertonzn 2016.10.16 16:13  

Im using this indicator but when i call it in my EA with Icustom() i cant get the right values to signal the buy and sell order correctly

 

pinbar_handle= iCustom(NULL,0,"pinbar",0,true,false,false,0.33,0.4,true,false,false,0.1,0.5,1,0,0.1);


 Can anyone help me?

/
To add comments, please log in or register