Add 50 pips to something

 

Hello,

I have one line i my EA that looks like this:

if (Close[1] < Close[5]) then something

I want to add 50pips to Close[5] so i did this:

extern int AddPips = 50;

if (Close[1] < Close[5] + AddPips), but it doesn't work.

What am i doin wrong ?

Thanks for your reply in advance.

 

It's because you're adding 50 to the price and not 50 pips. Ex if the EURUSD is @ 1.3000 when you add 50 to it it becomes 51.3000.

Try using this instead:

(Close[1] < Close[5] + AddPips*Point)

That would yield 1.3050 instead of the 51.3000 example.

 
techinvest:

That would yield 1.3050 instead of the 51.3000 example.

Or 1.30050 for a 5 digit broker
 
Viffer:
Or 1.30050 for a 5 digit broker

True.

If it's a 5 digit broker you could either change 50 to 500 or use (Close[1] < Close[5] + AddPips*Point*10)

 

Sorry Viffer and techinvest for not getting back to you.

I haven't got a mail that you two had answered my question even though i have subscribed to this topic. Strange!!

Never the less i have done it the way you have described and it works perfect.

Thanks!

 
The subscribe button doesn't get you emailed on post update - like on other forums. You have to check them yourself by entering your profile & click the subscribe link.
 
techinvest:

It's because you're adding 50 to the price and not 50 pips. Ex if the EURUSD is @ 1.3000 when you add 50 to it it becomes 51.3000.

Try using this instead:

(Close[1] < Close[5] + AddPips*Point)

That would yield 1.3050 instead of the 51.3000 example.

That won't work on a 5 digit broker
//++++ 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; }
    // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
Reason: