Rounding problem?

Questions about MultiCharts and user contributed studies.
Rick Webber
Posts: 47
Joined: 04 Jan 2008
Has thanked: 21 times
Been thanked: 3 times

Rounding problem?

Postby Rick Webber » 17 May 2017

lineA= 53.47
Close= 53.47

If Close < LineA then
Sell next bar at market;

Position is responding as if code had <= in it and is getting closed. Both Commentary and Data Window give the price and indicator as 53.47. I'd like to to get more precision on LineA by increasing decimal places from 2 to 3 or 4. I'm playing around with it but could use an example as no luck so far. Here is a simple function code that is putting out 2 decimal places. How would one go about getting 4 decimal places out of this?

inputs:
PriceValue( numericseries ),
Len( numericsimple ) ;


AverageFC = SummationFC( PriceValue, Len ) / Len ;

Thanks.

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Rounding problem?

Postby ABC » 18 May 2017

Rick,

you can either print the values to the output and add the required decimal spaces as described here:

https://www.multicharts.com/trading-sof ... .php/Print

Or you can change the number of decimals a plot will show on a chart. You'll find the setting under General (No. of digits after the decimal) on the "Scaling" tab of the Format Study dialog for the particular study.

Regards,

ABC

Rick Webber
Posts: 47
Joined: 04 Jan 2008
Has thanked: 21 times
Been thanked: 3 times

Re: Rounding problem?

Postby Rick Webber » 19 May 2017

Thanks for taking the time ABC, I don't think this is going to solve my problem though. I've got to have the increased decimal output available to the "Strategy". I can't get the function to assign 4 decimal places to a variable and then view its output in Commentary as 4 decimal places. No problem seeing it in a indicator or data box.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Rounding problem?

Postby TJ » 19 May 2017

MultiCharts uses Double Precision.

That means MultiCharts is doing your calculations internally using 15 decimal places.

(unless you specified the variable is an integer)


Return to “MultiCharts”