kennyhubbard:
In your function that makes the actual trade, place this line right before the OrderSend(...............)
Thank you very much for your quick reply. However, it says that "Return" is a variable not defined. How should I define it?
Thanks!
Just to make sure I did it correctly, I pasted the code like this:
if(OrdersTotal>=10) Return;
int ticket = OrderSend(Symbol(),type,lots,price,Slippage,sl,tp,ExpertName,MagicNumber,0,col);
Thanks!
return should have lowercase r
Thanks! Although it fixed that problem, now it says this as an error:
'>=' - left parenthesis expected
Should I put extra parentheses somewhere?
yes it should be like this
if(OrdersTotal() >= 10) return;
PERFECT! it's works exactly how I want it to. Thanks!
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
Hello, I was just wondering if someone could help me out with a small script problem.
Right now my EA puts one trade for each period that the entry criteria matches AND has no max orders open at a given time. However, I would like it if the EA would put in continuous trades (lets say up to 10 open orders at one time). If the target profit is reached, an extra trade will open until the max 10 is reached.
For example: Right now, when the EMAs cross over once at 0800, only one trade will open. However, between 0800 and 0801 the EMAs may cross back and for 15 times. I would like to keep on adding a position each time it crosses. But, I want there to be a 10 order max that are open. No more trades will open until some of the 10 reaches its stoploss or limit. In my original code, the trade will only open once in a given period, and has no max open orders.
Can anyone help?
// Manage open order
for(int i = OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS))
if(OurOrder())
if(!ManageExits())
PrintError();
}
Thanks
james