Multicurrency advisor question - page 8

 

write, my email is in the #property link indicator

 

probably the last question before the start!

All the restrictions have been taken into account. And lots, and orders, and testing time, and so on.

I have only FreeMargin to consider. I have done it:

 if(AccountFreeMargin()<(500*Lots))
        {
         Print("We have no money. Free Margin = ", AccountFreeMargin());
         return(0);  
        }

I estimated that if my deposit falls to 5000$, my lot will fall to about 0.5

But my Expert Advisor keeps trying to open a position! But it keeps trying to do it! Until the end of the deposit.

Please, tell me how I may set a ban on this event. What can I do?

p.s Please, do not tell me how it is done in the ProtoType.mq4 Expert Advisor.

I did.

 
rid:
 if(AccountFreeMargin()<(500*Lots))
        {
         Print("We have no money. Free Margin = ", AccountFreeMargin());
         return(0);  
        }

500 is not enough, and in your version the exert will complain about the lack of funds in the log on every tick. But when they are not enough, it won't matter for you - you will only spam the trading server with unnecessary requests, and the terminal won't let them pass to the server...

 
rid:

Please advise how to put a ban on the case stipulated in the championship conditions. What to add?

Which case do you mean exactly?
 

At least this way:

as soon as the deposit funds drop below 50% - so that the expert would elementary switch off!

 
if(AccountFreeMargin()<5000)return;
 
rid:

At least this way:

as soon as the deposit funds drop below 50% - so that the expert would elementary switch off!

What is the point?

The most unprofitable position will be forcibly closed by the stop out broker. Or is it necessary for the Expert Advisor to stop trading? Then who will raise or try to raise the deposit?

 

Yeah... it's not that simple.... A problem came up at the end, which I didn't expect!

The way I understand it: Whenever a position is opened, the deposit amount from lots should be less than half of the current funds in the account. And it doesn't matter how many positions are opened. In my multicurrency one works with up to five pairs. Among them there is the pound - the most expensive.

But for simplicity let's assume that the total number of lots decreases (like in my case) with the size of the deposit. Let's assume that 1 lot on average costs $1,500 of deposit.

If the deposit falls to 5000$, then I have the right to open three positions with no more than 2500$ of deposit. In other words I can open three positions with max 0.5 lots each

3*0.5*1500=2250$<2500$

If the deposit has fallen to 3000, then I can open only three positions of 0.3 lots each, etc.

I hope I have now correctly formulated the problem. So, what should I do?

 

I beg your pardon! I withdraw all questions! It turns out that the way I described above is exactly how my Expert Advisor works!

Using the lot calculation library.

 
rid:

The way I see it: Whenever a position is opened, the deposit amount from lots should be less than half of the current account balance. No matter how many positions are opened. In my multicurrency one works with up to five pairs. Among them there is the pound - the most expensive.

But for simplicity let's assume that the total number of lots decreases (like in my case) with the size of the deposit. Let's assume that 1 lot on average costs $1,500 of deposit.

If the deposit falls to 5000$, then I have the right to open three positions with no more than 2500$ of deposit. In other words I can open three positions with max 0.5 lots each

3*0.5*1500=2250$<2500$

If the deposit has fallen to 3000, then I can open only three positions of 0.3 lots each, etc.

I hope I have now correctly formulated the problem. So what should I do?

Not quite right: there is no such (highlighted) limit. This level of stopout occurs when the amount of deposit is more than twice the funds in the account. I.e. when your deposit has fallen to 5K and there are no open positions, you can open 10.0 lots, if your funds = 3K, you can open with 6 lots (total). All this at 100:1 leverage (like in the contest). Correct your calculations.

Reason: