Help with setting label or comment

Created at 25 Apr 2019, 22:45
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!
MA

Marin0ss

Joined 07.06.2014

Help with setting label or comment
25 Apr 2019, 22:45


Hi cTrader Community,

I need some help with the following; I want to set a certain label or comment during the creation of a position. A fixed one is easy to do, but I want it to be dynamic.

So now I have it set during start of Cbot:

         [Parameter("Label", DefaultValue = "m5")]
        public string LabelTrade { get; set; }

I am calculating a certain value, a currency strenght High and Low. Values vary from -7 to 7. I want to add these values to the label of the position; so for example:

"EUR = 7, USD = -7"

So for this I have:

double EURvalue;

double USDvalue;

How can I get these calculated values as TEXT in the label of a position?

for example: string LabelTrade = ("EUR =" + EURvalue "& USD =" + USDvalue);

Hope this makes sense!

Thanks in advance.


@Marin0ss
Replies

sascha.dawe
26 Apr 2019, 10:10

RE - Help with setting label or comment

Hi,

 

You could try something like this:

string LabelTrade = string.Format("EUR = {0} & USD = {1}", EURvalue, USDvalue);

Is this what you are looking for?

I don't think you can change the label on an existing position (Correct me if I am wrong), buy you could use this created string on a new position.

If you are looking to change add a description to an existing position, you could alter the position 'comment' field as opposed to 'label'.

Best Regards,

Sascha

 


@sascha.dawe

Marin0ss
26 Apr 2019, 23:59

Thanks Sascha! :D

This helped me out very well! Got it working! As I only need it when creating it's ok, changing afterwards is indeed not possible for label.

Have a nice weekend!

 


@Marin0ss