Hello, I am trying that my EA would calculate automatically the proper lots based on available margin.
ContractSize=NormalizeDouble((((AccountFreeMargin()*AccountLeverage())/Ask)/10000),1);
Can anyone tell me WHY??? Txs
Free margin = 5000$
Account has leverage 1:100
Pair is AUDUSD -- Ask 0.7694
ContractSize=((5000*100)/0.7694)/10000= (500000/0.7694)/10000= 649857/10000 = 64. 98 lots...
Accountfreemargin is 5000 and believe me, you can't open 64.9 lots with that.
Pair EURUSD --> Ask 1.2800
Contractsize=((5000*100)/1.2800)/10000=390625/10000=39.0 lots
This formul could give some results for USDJPY --> Ask=116.30
ContractSize=(500000/116.30)/10000=0.42 lots
because USDJPY has 100 times bigger Ask.
If ask goes up to 117.55 then you get 0.42 lots... this means that your "proper" formula is giving you... nothing... take 9% of FreeMargin and you have a better system than this.
Hello, I am trying that my EA would calculate automatically the proper lots based on available margin.
ContractSize=NormalizeDouble((((AccountFreeMargin()*AccountLeverage())/Ask)/10000), 1);
Can anyone tell me WHY??? Txs
Free margin = 5000$
Account has leverage 1:100
Pair is AUDUSD -- Ask 0.7694
ContractSize=((5000*100)/0.7694)/10000= (500000/0.7694)/10000= 649857/10000 = 64. 98 lots...
Accountfreemargin is 5000 and believe me, you can't open 64.9 lots with that.
Pair EURUSD --> Ask 1.2800
Contractsize=((5000*100)/1.2800)/10000=390625/10000=39.0 lots
This formul could give some results for USDJPY --> Ask=116.30
ContractSize=(500000/116.30)/10000=0.42 lots
because USDJPY has 100 times bigger Ask.
If ask goes up to 117.55 then you get 0.42 lots... this means that your "proper" formula is giving you... nothing... take 9% of FreeMargin and you have a better system than this.
Thanks guys,
It looks like I´ve missed a 0, so dividing by 100000 would show 6.5 lots.
Also I don´t intend to use it in many pairs, so for this specific pair would do the trick.
Anyway, the pending order won´t be send and that´s my problem. You see, as a manual calculation it is ok, however
the EA doesn´t recognizes it.
As I´ve said before, I´ve placed the line inside the start().
I believe the problem is where to place AccountFreeMargin() and AccountLeverage()
or how to make it work to make it read the data from the account. Any thoughts
on this??
Thanks
Thanks guys,
It looks like I´ve missed a 0, so dividing by 100000 would show 6.5 lots.
Also I don´t intend to use it in many pairs, so for this specific pair would do the trick.
Anyway, the pending order won´t be send and that´s my problem. You see, as a manual calculation it is ok, however
the EA doesn´t recognizes it.
As I´ve said before, I´ve placed the line inside the start().
I believe the problem is where to place AccountFreeMargin() and AccountLeverage() or how to make it work to make it read the data from the
account. Any thoughts on this??
Thanks
start()....
pips=....
ordersend...
init()...
and then give a line what it is supposed to do... AccountFreeMArgin should be shortly before sending a order as this number changes with a time... I (or somebody else) can look what are you doing and help how to make a code to do what it is meant to do.
but look again your formula because it's not changing a lot with a time... sometimes keeping simple is better way to handle things...
zolero
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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