Free margin issue - error 134

 
Hi all

I'm new to writing in mql4, I've been getting the error 134 code when running my ea for extended period of time on the tester however when I run it for a month or 2 back testing it works fine. Any one had this issue before? 
 
Ajay Patel:
Hi all

I'm new to writing in mql4, I've been getting the error 134 code when running my ea for extended period of time on the tester however when I run it for a month or 2 back testing it works fine. Any one had this issue before? 

Hi Ajay... I think it is because your EA blew the account on tests longer than 2 months.... You were basically lucky that your EA survived the last 2 months... ;-) But hang in there... we've all been thru this at one point or another...

Either that or your "Lot Size" calc. is wrong... but then you would not have been successful over the last 2 months...

If you think about it... you get the error_134 IF your "Free-Margin" is less than the Brokers required Margin to place the Order ie. You don't have enough money in your account...


Another issue might be that your are using a "Hedging" strategy... so you have multiple trades open (reducing your Free-Margin)... If you are... then you should change your "Lot Size" calculation to be based on your AccountFreeMargin() and not your Balance or Equity.... I know this from experience.... and it wasn't pretty

...a good test would be to reduce your "Lot Size" (Volume) ie. make it really small...like 0.01... then run the "Longer Time" test again and see if you still get that error... 

 
Mike Tanton:

Hi Ajay... I think it is because your EA blew the account on tests longer than 2 months.... You were basically lucky that your EA survived the last 2 months... ;-) But hang in there... we've all been thru this at one point or another...

Either that or your "Lot Size" calc. is wrong... but then you would not have been successful over the last 2 months...

If you think about it... you get the error_134 IF your "Free-Margin" is less than the Brokers required Margin to place the Order ie. You don't have enough money in your account...


Another issue might be that your are using a "Hedging" strategy... so you have multiple trades open (reducing your Free-Margin)... If you are... then you should change your "Lot Size" calculation to be based on your AccountFreeMargin() and not your Balance or Equity.... I know this from experience.... and it wasn't pretty

...a good test would be to reduce your "Lot Size" (Volume) ie. make it really small...like 0.01... then run the "Longer Time" test again and see if you still get that error... 

Thanks! I'll give that a go.

I don't think it'll be hedging as I've put a limit to make sure only 1 trade is running at a time just while if get more proficcient with the language.

Cheers!
Reason: