Pin Bar

479

Hi guys, I have a problem with the code.

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.

16110

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;
Write self-documenting code. The == operand. - MQL4 forum
479

Tomorrow control your code, because now I can not.
Greetings, Massimo.
479

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;
&& downShadow <= 1 * bodySize
&& bodySize > 0
)```

Thanks for everything, Massimo.
4074

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];`
479

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.