Is there a way to get the number of decimal places used by an instrument.
e.g. The ES would be 2, for GBP/USD it would be 4 etc.
Any suggestions?
Number of Decimal Places from Instrument [SOLVED]
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Number of Decimal Places from Instrument
Hello IT-Trader,
Here is a simple example that comes to my mind:
Here is a simple example that comes to my mind:
Code: Select all
var:NumOfDecDig(0);
if PriceScale=100 then NumOfDecDig=2;
if PriceScale=10000 then NumOfDecDig=4;
print (NumOfDecDig:0:0);
Re: Number of Decimal Places from Instrument
ah ha! a low tech solution! Didn't even think of that.
If someone has an automated answer then please let me know but I can use the low tech answer in the meantime.
Thanks for the quick reply Henry.
If someone has an automated answer then please let me know but I can use the low tech answer in the meantime.
Thanks for the quick reply Henry.
- TJ
- Posts: 7744
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
Re: Number of Decimal Places from Instrument
Is there a way to get the number of decimal places used by an instrument.
e.g. The ES would be 2, for GBP/USD it would be 4 etc.
Any suggestions?
Code: Select all
decimal = Log(PriceScale) / Log(10) ;