The result of the method is units, which is what you need as an input for all the order methods of the API. There is no reason to convert it to lots and then back to units. But if you need to convert it to Lots, you can use the Symbol.VolumeToQuantity() method.
Best regards,
Panagiotis
Thank you very much for this information. It is well appreciated. I will try that function. I also noticed that I was very ignorant regarding the messagebox respond. It actually has an E-05 at the end of the number, which basically means 0,0000912. But for some reason I ignored that fact.
When I tried to use the result in form of units, the following error occured:
24/07/2024 07:10:09.957 | → Order OID0 is REJECTED with error "Order volume 54217.50 must be multiple of stepVolume=1000.00."
I solved this problem by converting it back and forth with Math.Round()
But I noticed that depending on the symbol the order volume has to be multiple of different step volumes. The code above will not work for US30 for example.
24/07/2024 09:01:56.395 | → Order OID0 is REJECTED with error "Order volume 4.25 must be multiple of stepVolume=1.00."
Andrelein
24 Jul 2024, 06:50 ( Updated at: 24 Jul 2024, 10:44 )
RE: Calculations With Symbol.PipValue
PanagiotisCharalampous said:
Thank you very much for this information. It is well appreciated. I will try that function. I also noticed that I was very ignorant regarding the messagebox respond. It actually has an E-05 at the end of the number, which basically means 0,0000912. But for some reason I ignored that fact.
When I tried to use the result in form of units, the following error occured:
I solved this problem by converting it back and forth with Math.Round()
But I noticed that depending on the symbol the order volume has to be multiple of different step volumes. The code above will not work for US30 for example.
I decided to solve this problem this way:
A more clean and universal approach would be nice, but this temporary solution does work.
Best regards
@Andrelein