Buy Limit orders are very different between brokers

 

Hello, I would very much appreciate if someone could share some simple lines of code they use with Alpari to request a Buy Limit order. I have been able to do this with other demo brokers, but the code is always a little different, and I have not been able to come up with a variation that would work with Alpari. I would appreciate anyone's examples for how they make this request.

Trying to include a stoploss, and take profit request, along with the Buy limit order is also proving to be very difficult to say the least, and if anyone has successful examples of this, I would really like to use that as well.

Thank you very much,

Jane

 

Use this OrderSend() with this OP_BUYLIMIT

Perhaps you could be specific about the issues you are having ? error codes ? code samples ?

 

If someone could share the buy limit order code that works for them, that is perfect.

Thank You,

Jane

 
OrderSend(Symbol(),OP_BUYLIMIT,1,Bid-100*Point,3,0,0,"",0,0,Green);
 

I did not realize that 'Bid-100*Point' was the exact syntax needed to enter a value in the stoploss and takeprofit fields.

Thanks Zzeugg!

 
Bid-100*Point is only the open price, the values for stoploss and takeprofit are something different. btw, Bid-200*Point works too, so there is no exact syntax when it comes to openprice/stoploss/takeprofit, as long as they are all valid.
 
Mom_markets:

I did not realize that 'Bid-100*Point' was the exact syntax needed to enter a value in the stoploss and takeprofit fields.

Thanks Zzeugg!

It isn't . . . the syntax for open price, TP and SL is an expression or variable that equates to a double type that represents price in the chosen pair, in other words double

You would spend time well by reading this . . . Requirements and Limitations in Making Trades

 
RaptorUK:

It isn't . . . the syntax for open price, TP and SL is an expression or variable that equates to a double type that represents price in the chosen pair, in other words double

You would spend time well by reading this . . . Requirements and Limitations in Making Trades


Yes, I see. That was a simple solution. I figured the problem had to be pretty basic. Thanks a lot!
 
Bid-100*Point
Do you really want to open 100 points below? That's 10 pips on a 5 digit broker and 100 pips on a 4 digit broker. EA's should adjust for 4/5 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());
     */