What is type double?

Created at 19 Jan 2021, 18:33
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!
PR

prosteel1

Joined 04.07.2018

What is type double?
19 Jan 2021, 18:33


When assigning a position's stoploss or takeprofit to a double I need to convert it to a double because they are type "double?". Entry price is type "double" (without a ? at the end).

Not sure why, any ideas?


@prosteel1
Replies

Bots4Us
20 Jan 2021, 01:08

Hi prosteel1,

The EntryPrice cannot be null. By contrast, the Take Profit is in the above. A double cannot be nulled.
https://ctrader.com/forum/calgo-support/7806#post-2

Bots4Us

 


@Bots4Us

firemyst
20 Jan 2021, 08:07

It's a nullable type.

Anytype in C# that ends in a "?" is a nullable type.

This basically only applies to primitive types though, because objects (such as strings) are inherently nullable.

 

So a type of int? means it's nullable whereas a type of just plain int is not.

int x = 16 is fine.

int? x = 16 is fine.

int? x = null is fine.

int x = null is not fine.


@firemyst

prosteel1
20 Jan 2021, 08:37

RE:

Bots4Us said:

Hi prosteel1,

The EntryPrice cannot be null. By contrast, the Take Profit is in the above. A double cannot be nulled.
https://ctrader.com/forum/calgo-support/7806#post-2

Bots4Us

 

Thanks!


@prosteel1