Number of trades control problem-Hit Margin red?

 

One week ago I turned on a new EA that scaled in about 15 Lots very quickly. Too much for a small acct. This did have a Lots Optimizer on it.

I thought I had it under control by using: extern MaxTrades. Since then I have completely removed the Lots Optimizer.

Would like to learn how to Override it if possible through boolean or ? In other words, at some point I want to use it

but at this point for now I would be happy to just manually control the lots and NUMBER OF TRADES. The number of Lots

seems to be Ok. I just can't seem to stop it from making all these trades. I have reduced the risk settings, tried Total Orders()<MaxTrades,

Static_Lots, and HAVE been reading the manual. Oh yes, there is Margin control in place also. Need to get this corrected soon or I

just remain in cash indefinitely.

JimTrader1

 
I usually control my number of trades by counting the number of open trades. If its >= the max then I return(0) from the top of my ordersend() function.
 

It isn't the number of open order that is the problem. IBFX's limit is 1000

It is the margin used through the SL.

You must make sure that you will have free margin even when the market approaches your SL.

see my code

 
WHRoeder:

It isn't the number of open order that is the problem. IBFX's limit is 1000

It is the margin used through the SL.

You must make sure that you will have free margin even when the market approaches your SL.

see my code


Thanks, I am sending a code with the 2 things that I am trying to do and having a rough time with. What I am trying to do is have some control over the number

of trades. I told about this problem in the last message. It is a small acct. Also I am trying to get an Order Delay to work using stoch & RSI overbought & oversold.

Most important right now is the trades number control. I will keep studying your code also.

JimsTradingMachine

Reason: