# calculate maximus lot size?

25
2015.06.28 15:28

hi... I'm not a trader: I'm a programmer and, starting from there, I created a nice little neural EA, tested it, and it work great!

My problem is in the lot size: the original example program use the minimum size, like this

`lot_size=SymbolInfoDouble(my_symbol,SYMBOL_VOLUME_MIN);`

that was good enough for testing, but not for actual work.

how can I tell the advisor "take the maximum possible lot size, based on the available money and leverage"?

I looked for an answer for a few day now, but I think I used the wrong search terms...

thanks :-)

Moderator
4729
2015.06.28 15:56

it depends and i am not sure about the leverage but i always use something like

```if(AccountBalance() > X ){ lots= XX;}//gear up 1
if(AccountBalance() > Y ){ lots= YY;}//gear up 2
if(AccountBalance() > Z ){ lots= ZZ;}//gear up 3

if(AccountBalance() < A ){ lots= AA;}//gear down 1
if(AccountBalance() < B ){ lots= BB;}//gear down 2
if(AccountBalance() < C ){ lots= CC;}//gear down 3```

the lowest value at the bottom so it will always gear down to minimum lot size if need be.

Hope you get the idea and it usually 10 steps or so.