10pips above upper band

 

Hi I am trying code EA it should open position once price goes 10-15 above 3 bands

but not able to figure out how to check # of pips after its above upper band


like below code will confirm that its above upper band but after this condition I want to wait till it goes 15pips up and then open position

how do I check that condition ?

if ((Ask > iBands(NULL, NULL,5,2,0,PRICE_OPEN,MODE_UPPER,0)) && (Ask > iBands(NULL, NULL,10,2,0,PRICE_OPEN,MODE_UPPER,0)) && (Ask > iBands(NULL, NULL,30,2,0,PRICE_OPEN,MODE_UPPER,0)))

{


}



any help is appreciated

Thank You

 

double level1 = iBands(.....) + 10*Point

double level2 = iBands(.....) - 10*Point

...

if(Ask > level1)

{

///// orderSend...

}

 
rfbudhwani:

Hi I am trying code EA it should open position once price goes 10-15 above 3 bands

but not able to figure out how to check # of pips after its above upper band

like below code will confirm that its above upper band but after this condition I want to wait till it goes 15pips up and then open position

how do I check that condition ?

if ((Ask > iBands(NULL, NULL,5,2,0,PRICE_OPEN,MODE_UPPER,0)) && (Ask > iBands(NULL, NULL,10,2,0,PRICE_OPEN,MODE_UPPER,0)) && (Ask > iBands(NULL, NULL,30,2,0,PRICE_OPEN,MODE_UPPER,0)))

any help is appreciated -Thank You
Hi rfbudhwani,

To start with...Close(0) Price is different than Ask Price. Make sure you are using the right one for your formulas.

Here's some suggestions to help with your questions...

Not able to figure out how to check # of pips after its above upper band

There are a number of ways to check # of pips above or below the bands

1) Compare Close(0) with iBands and Print or Comment the values to see the difference.
2) Calculate the difference directly ---> Close(0) - iBands = Pip Difference.
3) You can use Ask instead of Close(0) per your example.

After this condition I want to wait till it goes 15pips up and then open position

1) First you need to decide which iBand Period you will use, because your 15 pips will be different for the different iBand Periods, and they all cannot hit 15 pips above/below the bands at the same time. One iBand Period will hit the 15 pips before the others... Decide which one to use first.

a) Add the pips as a NUMBER into your statement ( + .000015 [4digit] -or- +.000150 [5 digit] ).
b) Add the pips as a VALUE into your statement (double Difference = 0.00015 [4digit] -or- double Difference = .000150 [5 digit] ).

So the formula will now read -- shortened for example:

if (Ask > iBands + 0.00015)
if (Ask > iBands + Difference)

Hope this helps,
Robert

 
abstract_mind:

double level1 = iBands(.....) + 10*Point

double level2 = iBands(.....) - 10*Point

OP asked for 10 pips above, not 10 points. A pip is not a point on a 5 digit broker.
//++++ These are adjusted for 5 digit brokers.
int     pips2points;    // slippage  3 pips    3=points    30=points
double  pips2dbl;       // Stoploss 15 pips    0.015      0.0150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
int     init(){
     if (Digits % 2 == 1){      // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262
                pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
    } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
    // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
//---- These are adjusted for 5 digit brokers.
    /* On ECN brokers you must open first and THEN set stops
    int ticket = OrderSend(..., 0,0,...)
    if (ticket < 0)
       Alert("OrderSend failed: ", GetLastError());
    else if (!OrderSelect(ticket, SELECT_BY_TICKET))
       Alert("OrderSelect failed: ", GetLastError());
    else if (!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0)
       Alert("OrderModify failed: ", GetLastError());
     */
Reason: