Trading volumes where lot step size is 0.01 when API says volume is of type long?
Trading volumes where lot step size is 0.01 when API says volume is of type long?
09 Oct 2016, 17:07
Hi Folks
Building a bot that works with a micro account.
Currently I have an automated lot size calculator. The issue here is as follows:
I have X amount of money equating to 5.34 lots in lot steps of 0.01.
When I convert this to a long type(because the cAlgo API insists volume to be of type long) - I lose the 0.34 lots I wanted to trade. Obviously the cast truncates the precision.
Example:
Decimal this_is_a_decimal = 5.34 (long)this_is_a_decimal == 12 // long types don't have precision
But I don't want 5 lots I want 5.34 lots?
Any ideas - Also the "Normalize" method returns a "long" type. Hence no 0.01 precision either.
Thanks
David
Replies
kdcp999
09 Oct 2016, 17:11
RE:
haha you can't edit you own post! O_O
There is obviously a typo in my example. sorry about that.
The example code should read:
Decimal this_is_a_decimal = 5.34 (long)this_is_a_decimal == 5 // long types don't have precision
kdcp999 said:
Hi Folks
Building a bot that works with a micro account.
Currently I have an automated lot size calculator. The issue here is as follows:
I have X amount of money equating to 5.34 lots in lot steps of 0.01.
When I convert this to a long type(because the cAlgo API insists volume to be of type long) - I lose the 0.34 lots I wanted to trade. Obviously the cast truncates the precision.
Example:Decimal this_is_a_decimal = 5.34 (long)this_is_a_decimal == 5 // long types don't have precisionBut I don't want 5 lots I want 5.34 lots?
Any ideas - Also the "Normalize" method returns a "long" type. Hence no 0.01 precision either.
ThanksDavid
@kdcp999
kdcp999
09 Oct 2016, 17:11
RE:
haha you can't edit you own post! O_O
There is obviously a typo in my example. sorry about that.
The example code should read:
Decimal this_is_a_decimal = 5.34 (long)this_is_a_decimal == 5 // long types don't have precision
kdcp999 said:
Hi Folks
Building a bot that works with a micro account.
Currently I have an automated lot size calculator. The issue here is as follows:
I have X amount of money equating to 5.34 lots in lot steps of 0.01.
When I convert this to a long type(because the cAlgo API insists volume to be of type long) - I lose the 0.34 lots I wanted to trade. Obviously the cast truncates the precision.
Example:Decimal this_is_a_decimal = 5.34 (long)this_is_a_decimal == 5 // long types don't have precisionBut I don't want 5 lots I want 5.34 lots?
Any ideas - Also the "Normalize" method returns a "long" type. Hence no 0.01 precision either.
ThanksDavid
@kdcp999
... Deleted by UFO ...
kdcp999
09 Oct 2016, 21:48
@kdcp999
lezdoria
03 Mar 2017, 14:25
Hello kdcp999,
did you find a solution for that problem?
More brokers are offering micro-lots, not only to exponentially expand their customer base to enormous low-budget retail traders market, but also because it opens to a mutch better money-risk management.
According to my tests, at the moment cAlgo does not support micro-lots (cTrader does) but we are all here to automate our trading and not to step back to manual
This is why cAlgo API wants long volume type
So, for example, it's impossible to open 0.1 or 0.01 Germany30 index that is the micro-accounts value-added
I personally think Spotware should support micro-accounts because of the huge benefits for traders, brokers and Spotware itself
Any plan about it ?
Thanks
Lorenzo
@lezdoria
kdcp999
09 Oct 2016, 17:11
RE:
haha you can't edit you own post! O_O
There is obviously a typo in my example. sorry about that.
The example code should read:
kdcp999 said:
@kdcp999