Automated increasing of lots in EA

 

Hello,

I am trying that my EA would calculate automatically the proper lots based on available margin.

ContractSize=NormalizeDouble((((AccountFreeMargin()*AccountLeverage())/Ask)/10000),1);

I've placed this line after the start() and before the ordersend. Of course the ordersend takes the lot size from here.

This is supposed to do it, but it doesn't works. Can anyone tell me WHY???

Txs

 

I don't know about your particular question but i found library file inside my computer (attached). Unzip it and place to /include folder. Don't compile.

And in your EA do the following:

- place

#include [/CODE]

after the settings of EA but before deinit(), init() and start()

- place

Lots=GetSizeLot();

before OrderSend(Symbol(), ...

- delete this line in your EA:

[CODE]extern double Lots=1;

And you will have several kinds of Money management:

LotsWayChoice = 1; // 0-fixed lot size.

// 1-% from deposit,

// 2-the other kind of MM

// 3-different kind of MM

Files:
b-lots.zip  1 kb
 
newdigital:
I don't know about your particular question but i found library file inside my computer (attached). Unzip it and place to /include folder. Don't compile.

And in your EA do the following:

- place

#include [/CODE]

after the settings of EA but before deinit(), init() and start()

- place

Lots=GetSizeLot();

before OrderSend(Symbol(), ...

- delete this line in your EA:

[CODE]extern double Lots=1;

And you will have several kinds of Money management:

LotsWayChoice = 1; // 0-fixed lot size.

// 1-% from deposit,

// 2-the other kind of MM

// 3-different kind of MM

This library includes just one function so u can just copy/paste it to your ea and it will work in the same way as it it work with external file.

 
Kalenzo:
This library includes just one function so u can just copy/paste it to your ea and it will work in the same way as it it work with external file.

Yes forexfordinner can do it.

 

Thanks a lot guys, I went to bed yesterday at 3 in the morning trying to figure this out.

Thaks again

 
 
 

Thanks a lot Kalenzo, it is working just great now. And you too newdigital, thanks.

Reason: