Decimals instead of whole numbers in parameter

Created at 28 Feb 2024, 21:18
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
JI

jimmy.strid81

Joined 07.04.2019

Decimals instead of whole numbers in parameter
28 Feb 2024, 21:18


Hi!

I don´t now much at all about coding but i just want to do a little tweak in my code. I want to be able to use decimals in my parameter “Limit range pips”.

Right now the code is:

[Parameter("Limit Range Pips", Group = "General", DefaultValue = 10, MinValue = 1, Step = 1)]
public int LimitRangePips { get; set; }

I want this instead:

[Parameter("Limit Range Pips", Group = "General", DefaultValue = 0.1, MinValue = 0.01, Step = 0.01)]
public double LimitRangePips { get; set; }

The build is successful. Might this lead to other problems in the execution of the code? Whats the difference between using “public int” and “public double”?

I am greatful for any guidience :)

 

 

 


@jimmy.strid81
Replies

PanagiotisCharalampous
29 Feb 2024, 08:06

Hi there,

int is used for integers and double for numerical values with decimals. I don't have the complete code to assess if there could be any problem but I do not see any reason to have one.

Best regards,

Panagiotis


@PanagiotisCharalampous

jimmy.strid81
29 Feb 2024, 10:49 ( Updated at: 29 Feb 2024, 14:10 )

RE: Decimals instead of whole numbers in parameter

PanagiotisCharalampous said: 

Hi there,

int is used for integers and double for numerical values with decimals. I don't have the complete code to assess if there could be any problem but I do not see any reason to have one.

Best regards,

Panagiotis

Thx! I will test it out on demo account.


@jimmy.strid81