Download MetaTrader 5

Pin Bar

To add comments, please log in or register
They are already making profit from their signals. Publish your signal and join them!
Massimo
478
Massimo 2016.05.07 15:48 

Hi guys, I have a problem with the code.


Pin Bar


I want to find the Pinbar (1) as in the picture excluding the Pinbar (2).
I would say that the length of the shadow must be> = 3 times the length of the Candlestick Body.

I wrote this code but it does not work.


   ....... myPoint *= 10;

       if(MathAbs(Open[i] - Close[i]) <= 0.3 * myPoint 
       && Open[i] < Close[i]
       && High[i] >=  MathAbs(Open[i] - Close[i]) * 3
      )
       ..................        
    



I need your help, thank you all, Massimo.

whroeder1
13620
whroeder1 2016.05.07 17:01  
omissamf: I would say that the length of the shadow must be> = 3 times the length of the Candlestick Body.
  1.  if(MathAbs(Open[i] - Close[i]) <= 0.3 * myPoint
               |1.23450 - 1.23490 | <= 0.3 * 0.0001
                 0.00040            <= 0.00003
    o-c <= 3 points? That's not your definition.

  2. && Open[i] < Close[i]
    What does the color of the candle have to do with it? That's not your definition.
  3. Code it exactly what you said:
    double upperBody   = MathMax(Open[i], Close[i]);
    double bodySize    = MathAbs(Open[i] -Close[i]);
    double upperShadow = High[i] - upperBody;
    if(upperShadow >= 3 * bodySize)
    Write self-documenting code. The == operand. - MQL4 forum
Massimo
478
Massimo 2016.05.07 17:51  
 Hello WHRoeder, thanks for your answer.
Tomorrow control your code, because now I can not.
Greetings, Massimo.
Massimo
478
Massimo 2016.05.07 22:41  

Hello WHRoeder, I tried your code and it works well. But I would also define the length of the lower shadow. I thought to use your modified code, but do not understand where I'm wrong.

 

 

      double upperBody   = MathMax(Open[i], Close[i]);
      double downBody   = MathMin(Open[i], Close[i]);
      double bodySize    = MathAbs(Open[i] -Close[i]);
      double upperShadow = High[i] - upperBody;
      double downShadow  = Low[i] - downBody;
     if(upperShadow >= 3 * bodySize
     && downShadow <= 1 * bodySize
     && bodySize > 0
     )

 

Thanks for everything, Massimo.
awran5
2685
awran5 2016.05.08 05:53  
omissamf:

Hello WHRoeder, I tried your code and it works well. But I would also define the length of the lower shadow. I thought to use your modified code, but do not understand where I'm wrong.

Thanks for everything, Massimo.

just put downBody before Low[i]

double downShadow  = downBody -Low[i];
Massimo
478
Massimo 2016.05.08 09:20  
awran5:

just put downBody before


 

Hello awran5,  I'm a wimp !!!!
I tried to do as you suggested and it works well.
Thanks for everything, Massimo.
/
To add comments, please log in or register