Download MetaTrader 5

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

To add comments, please log in or register
Join MQL5 Cloud Network. Improve your rating!
traderTT
103
traderTT 2009.10.29 08:10 

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?

Al W
173
Al W 2009.10.29 08:40  
replace 0.0005 with (5*Point())
traderTT
103
traderTT 2009.10.29 11:10  
circlesquares:
replace 0.0005 with (5*Point())

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

traderTT
103
traderTT 2009.10.29 11:17  
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)
traderTT
103
traderTT 2009.10.29 18:20  
tradertt:
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

Al W
173
Al W 2009.10.29 18:25  

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

traderTT
103
traderTT 2009.10.29 21:52  
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?

traderTT
103
traderTT 2009.10.30 05:27  
Thank you :) I think it works. Forward testing it now
whroeder1
14504
whroeder1 2009.10.30 15:40  
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)
Al W
173
Al W 2009.10.30 18:33  

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

traderTT
103
traderTT 2009.11.03 06:59  

Thank you all for your help.


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

12
To add comments, please log in or register