how to know what is the minimum of stoploss

 

when I use "ordersend" to open orders as below:

OrderSend(Symbol(),OP_BUY,lots,OrderClosePrice()+100*Point,3,0,0,0,0,0,0);

Sometime MT4 will complain that the stoploss is too little, but I don't know how to know what is the minimum for some pair's stoploss.

another question: about messagebox

#property show_inputs
#include <WinUser32.mqh>

extern int open_time=0; // time of opening orders
extern int lots=0; // lots of new orders
extern int trade_sign=0; //mark "buy" or "sell" of new orders


int start()
  {
//warning if time of opening is not set at the beginning.
   if (open_time==0||lots==0)
   int note=MessageBox("Please set opening time and lots at first!","Alert Message",MB_YESNO|MB_ICONEXCLAMATION);
   if (note==IDOK) 
   return (0);
........
   }

when I execute this EA and without any assignment, then the messagebox will come out for complaining that"please set opening time and lots at first", then I click OK button and then i will get the complain again.

so my question is how I shall have a chance to assign variable--"open_time" and "lots" again after I have attached this EA.

 
vx0532:


so my question is how I shall have a chance to assign variable--"open_time" and "lots" again after I have attached this EA.


Click on the smiley face and amend the input parameters
 
vx0532:

when I use "ordersend" to open orders as below:

OrderSend(Symbol(),OP_BUY,lots,OrderClosePrice()+100*Point,3,0,0,0,0,0,0);

Sometime MT4 will complain that the stoploss is too little, but I don't know how to know what is the minimum for some pair's stoploss.

You need your code to check the open price, SL and TP comply with these requirements, that way you avoid errors rather than having to retry or miss a trade: Requirements and Limitations in Making Trades
 
vx0532: when I use "ordersend" to open orders as below:
OrderSend(Symbol(),OP_BUY,lots,OrderClosePrice()+100*Point,3,0,0,0,0,0,0);
when I execute this EA and without any assignment, then the messagebox will come out for complaining that"please set opening time and lots at first", then I click OK button and then i will get the complain again.
  1. You can NOT use OrderClosePrice() until you do a successful OrderSelect. How do you expect to select the order, when you haven't even sent it yet?
  2. Of course you get the complaint again. A tick comes in, lots=0, you put up the message. Once you press the OK button you have to call up the EA's parameters to change them BEFORE the next tick or you are right back at the message box. A) Add a time stamp on when you received the OK and stop opening the box to give the human time to do it, or B) have the EA open the parameter box via postMessage.
  3.    if (open_time==0||lots==0)
    {
       int note=MessageBox("Please set opening time and lots at first!","Alert Message",MB_YESNO|MB_ICONEXCLAMATION);
       if (note==IDOK) 
       return (0);
    }
    
    Missing braces
 
WHRoeder:
  1. You can NOT use OrderClosePrice() until you do a successful OrderSelect. How do you expect to select the order, when you haven't even sent it yet?
  2. Of course you get the complaint again. A tick comes in, lots=0, you put up the message. Once you press the OK button you have to call up the EA's parameters to change them BEFORE the next tick or you are right back at the message box. A) Add a time stamp on when you received the OK and stop opening the box to give the human time to do it, or B) have the EA open the parameter box via postMessage.
  3. Missing braces


yes, you are right.

but I can't understand "B) ", shall I get detail code for this?