# Trying to code an indicator that detects GAP - 5 pips gaps - But cannot solve the problem of JPY crosses 2 decimal and Non Jpy crosses 4 decimals - 0.0005

103

Hi guys,

I coded a simple indicator that will send me an email when:

1) Open of Current bar < Low of Previous bar - 0.0005 (5pips)

But This does not work for JPY crosses as it is 0.05 for JPY crosses. How do I solve it?

Can I make it work for 3 and 5 decimals too?

173

replace 0.0005 with (5*Point())
103

circlesquares:
replace 0.0005 with (5*Point())

Do I have to do any of the INT = blah blah blah stuff?

103

if (iOpen(NULL, ble_84[tu_88], be_8) < (iLow(NULL, ble_84[tu_88], be_8 + 1) - (5*Point())) &&
iTime(NULL, ble_84[tu_88], be_8) > ble_80[tu_88]) {
if (be_8 == 0) {
if (tu_88 >= 1 && tu_88 <= 9) Sleep(1000.0 * (0.95 * (60 * ble_84[tu_88])));
else Sleep(600000);

}

When I tried this, I got errors

Compiling '#forex.mq4'...
'(' - unexpected token C:\Program Files\MetaTrader 4 at FOREX.com\experts\indicators\#forex.mq4 (341, 97)
'&&' - unexpected token C:\Program Files\MetaTrader 4 at FOREX.com\experts\indicators\#forex.mq4 (341, 102)
'>' - semicolon expected C:\Program Files\MetaTrader 4 at FOREX.com\experts\indicators\#forex.mq4 (342, 46)
'>' - unexpected token C:\Program Files\MetaTrader 4 at FOREX.com\experts\indicators\#forex.mq4 (342, 46)
')' - assignment expected C:\Program Files\MetaTrader 4 at FOREX.com\experts\indicators\#forex.mq4 (342, 61)
103

if (iOpen(NULL, ble_84[tu_88], be_8) < (iLow(NULL, ble_84[tu_88], be_8 + 1) - (5*Point())) &&
iTime(NULL, ble_84[tu_88], be_8) > ble_80[tu_88]) {
if (be_8 == 0) {
if (tu_88 >= 1 && tu_88 <= 9) Sleep(1000.0 * (0.95 * (60 * ble_84[tu_88])));
else Sleep(600000);

}

When I tried this, I got errors

Compiling '#forex.mq4'...
'(' - unexpected token C:\Program Files\MetaTrader 4 at FOREX.com\experts\indicators\#forex.mq4 (341, 97)
'&&' - unexpected token C:\Program Files\MetaTrader 4 at FOREX.com\experts\indicators\#forex.mq4 (341, 102)
'>' - semicolon expected C:\Program Files\MetaTrader 4 at FOREX.com\experts\indicators\#forex.mq4 (342, 46)
'>' - unexpected token C:\Program Files\MetaTrader 4 at FOREX.com\experts\indicators\#forex.mq4 (342, 46)
')' - assignment expected C:\Program Files\MetaTrader 4 at FOREX.com\experts\indicators\#forex.mq4 (342, 61)

Anyone can help on this? Thank you

173

Oh, I believe its Point without the (). sorry. Not sure why I remember using it with parenthesis. So replace if with (5*Point)

103

circlesquares:

Oh, I believe its Point without the (). sorry. Not sure why I remember using it with parenthesis. So replace if with (5*Point)

Cannot seem to get it coded correctly. Can I send you the whole code in a PM?

103

Thank you :) I think it works. Forward testing it now
16096

circlesquares:

Oh, I believe its Point without the (). sorry. Not sure why I remember using it with parenthesis. So replace if with (5*Point)

On a five digit broker this won't work

```//---- These are adjusted for 5 digit brokers.
double  pips2points         = 1,
pips2dbl,       //  = Point
slippagePoints; //  = SlippagePips * pips2points;
int init()
{
pips2dbl         = Point;
if (Digits == 3 || Digits == 5) {
pips2points *= 10;
pips2dbl    *= 10;
}
slippagePoints  = SlippagePips * pips2points;
}
// ...
// Replace 0.0005 with (5*pips2dbl)```
173

you're correct. I actually use something similar in my code.

103

Thank you all for your help.

Circlesquares code does work in 5 digits brokers and 4 :) Great job thank you