Problem with OrderSend

 

Hi, so I've been working on this EA and trying to test it but I've run into a problem. When I set lots to a high number, instead of buying/ selling the volume I am putting into the volume field, it just buys/sells 5.0 lots every time. Am I doing something wrong, is there some other way to enter this large volume amount? I would appreciate any help with this matter.


(p.s I have put 10 lots into the field and it worked)

 

Post your code.


CB

 
if(Sell condition)
{
res=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"",MAGICMA,0,Red);
return;
}
//

if(buy condition)
{
res=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"",MAGICMA,0,Blue);
return;

}


Straight forward enough.


 
fxCal:

When I set lots to a high number, instead of buying/ selling the volume I am putting into the volume field, it just buys/sells 5.0 lots every time.

Have you checked the value of MarketInfo(Symbol(), MODE_MAXLOT) ?

 
IBFX demo/mini reports EURUSD TICKVALUE=0.1 MAXLOT=50 LOTSIZE=10,000
 
fxCal:
if(Sell condition)
{
res=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"",MAGICMA,0,Red);
return;
}
//

if(buy condition)
{
res=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"",MAGICMA,0,Blue);
return;

}


Straight forward enough.


We'll need to see all the code that gets executed on "Lots" little journey from declaration to use in the OrderSend() function.


CB

 
No other code is executed on lots, it is just declared as an extern double and used in that one part of code. Anyway, it randomly started working today for no reason I can see (don't you love programming for this very reason?) so I guess I no longer need help with it. Thanks for trying though guys, I appreciate the quick responses. I've just been working with MQL4 for a couple weeks now, so I appreciate the help here.
 

No worries. Lots directly set by user eh? Next step - add Money Management & Risk to your strategy. Good luck.


CB

 

Yea, I've played around with code for money management, but for this particular experiment I wanted to be able to set lots directly. The main problem for me is that I am a programmer, and Forex trading is new to me, so it is frustrating having code that "works" but still ending up a loser, because I haven't ironed out the kinks of a solid trading system yet.


I guess this can only come with experimentation and experience though.


Thanks for everything.