Global variable question

 

Hello to all,

When building the Global variable, and useing a 5 digit broker:

extern int Slippage =1;

would mean 1 pip or 1 point?

Thanks

Huckleberry

 

Take the slippage value that you use in the OrderSend() to a 4 digit broker and multiply it by 10 for use in the OrderSend() to a 5 digit broker.


CB

 
cloudbreaker wrote >>

Take the slippage value that you use in the OrderSend() to a 4 digit broker and multiply it by 10 for use in the OrderSend() to a 5 digit broker.

CB

Hello CB,

Thank you for your reponse. Your answers are helping to build a better foundation for my learning curve. After reading the book, the doors are not as hard to open. Navigating has become easier and more of a pleasure then before.

May I trouble you or other educated MQL4 programmers with another question?

Or should I open another thread?

Huckleberry

 

Better open another thread.


CB

 
Huckleberry:

Hello to all,

When building the Global variable, and useing a 5 digit broker:

extern int Slippage =1;

would mean 1 pip or 1 point?

This can not be determined. You posted a int of one. If your orderSend() uses just the variable the unit is points. If the EA modifies the variable (times 1 or times 10 depending on the broker) then it is in pips.

I define my variable as Slippage.Pips = 3 so there is no doubt.

//++++ These are adjusted for 5 digit brokers.
double  pips2points,    // slippage  3 pips    3=points    30=points
        pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
int init() {
    if (Digits == 5 || Digits == 3) {   // Adjust for five (5) digit brokers.
                pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
    } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0;
    }
//...
ticket	= OrderSend(Symbol(),	operation,		size,	now.open,
		    SlippagePips * pips2points,		0, 0,	// SL,TP
//...
Reason: