Pin Bar

Back to topics list To post a new topic, please log in or register
avatar
63
omissamf 2016.05.07 17: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.

avatar
13009
WHRoeder 2016.05.07 19: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
avatar
63
omissamf 2016.05.07 19:51 #
 
 Hello WHRoeder, thanks for your answer.
Tomorrow control your code, because now I can not.
Greetings, Massimo.
avatar
63
omissamf 2016.05.08 00: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.
avatar
8
awran5 2016.05.08 07: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];


avatar
63
omissamf 2016.05.08 11: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.
Back to topics list  

To add comments, please log in or register