It's a minor problem, but i would like to clear it, can't figured out the logic computation, so I might need some help from the community.
Elaboration:
Test data starts with 0.01 min lot. I would have no problem if my test amount is $1000 or $100, 10% of these amount, it will still be sufficient to ordersend with a 0.01 min lot.
Test data starts with 0.1 min lot, I would have problem with $100, 10% of $100, it won't be sufficient to ordersend, and thus error 131 occurs. Invalid lot.
I would like to stop the error at the check lot size calculation before flowing it to ordersend for the error to occur.
Own theory:
I will need MinLot, I will need MarginFree, I will need to ensure (MarginFree * Risk) is able to open MinLot, if unable, means (MarginFree * Risk) is insufficient.
So either increase MarginFree or Risk to make the MinLot else, if Risk and MarginFree is already 100 (Max) and still insufficient to open MinLot, do something else.
Not sure if these checks are useful or just redundant, some advise will be good.
try this
if(LotSize <= MinLot)//LotSize < MinLot { LotSize = MinLot; return(LotSize); } //check with max lot if(LotSize >= MaxLots)//LotSize > MaxLots { LotSize = MaxLots; return(LotSize); }
if you it still insufficient, try to increase you leverage
try this
if you it still insufficient, try to increase you leverage
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
It's a minor problem, but i would like to clear it, can't figured out the logic computation, so I might need some help from the community.
Elaboration:
Test data starts with 0.01 min lot. I would have no problem if my test amount is $1000 or $100, 10% of these amount, it will still be sufficient to ordersend with a 0.01 min lot.
Test data starts with 0.1 min lot, I would have problem with $100, 10% of $100, it won't be sufficient to ordersend, and thus error 131 occurs. Invalid lot.
I would like to stop the error at the check lot size calculation before flowing it to ordersend for the error to occur.
Own theory:
I will need MinLot, I will need MarginFree, I will need to ensure (MarginFree * Risk) is able to open MinLot, if unable, means (MarginFree * Risk) is insufficient.
So either increase MarginFree or Risk to make the MinLot else, if Risk and MarginFree is already 100 (Max) and still insufficient to open MinLot, do something else.
Not sure if these checks are useful or just redundant, some advise will be good.