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:
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
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.
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.
- 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?
- 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.
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:
- 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?
- 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.
-
Missing braces
yes, you are right.
but I can't understand "B) ", shall I get detail code for this?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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
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.