Label not working properly

Created at 08 Sep 2014, 12:38
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!
OB

obial

Joined 03.09.2014

Label not working properly
08 Sep 2014, 12:38


Dear Support

As I cannot find a way to know if the last of my orders closed in TP, I'm trying to limit  the number of positions via using the the Label.

I put the following into my cbot , but the problem is that it looks like the LabelOK bool, never comes true !!.

Can you please explain what is the default value for Label in positions and if the label documentation is correct.

 

                    bool LabelOK = false;
                    string TargetLabel = "NewOrderTargetLable";
                    if (position.Label == null || position.Label == Strategy1 + "1" || position.Label == Strategy1 + "2" || position.Label == Strategy1 + "3")
                    {
                        LabelOK = true;
                        if (position.Label == null)
                            TargetLabel = Strategy1 + "1";
                        if (position.Label == Strategy1 + "1")
                            TargetLabel = Strategy1 + "2";
                        if (position.Label == Strategy1 + "3")
                            TargetLabel = Strategy1 + "3";
                    }

 

Regards
Oltion bregu


@obial
Replies

Invalid
09 Sep 2014, 09:19

RE:

Print position.Label before if block. What will you get?

 

 

obial said:

Dear Support

As I cannot find a way to know if the last of my orders closed in TP, I'm trying to limit  the number of positions via using the the Label.

I put the following into my cbot , but the problem is that it looks like the LabelOK bool, never comes true !!.

Can you please explain what is the default value for Label in positions and if the label documentation is correct.

 

                    bool LabelOK = false;
                    string TargetLabel = "NewOrderTargetLable";
                    if (position.Label == null || position.Label == Strategy1 + "1" || position.Label == Strategy1 + "2" || position.Label == Strategy1 + "3")
                    {
                        LabelOK = true;
                        if (position.Label == null)
                            TargetLabel = Strategy1 + "1";
                        if (position.Label == Strategy1 + "1")
                            TargetLabel = Strategy1 + "2";
                        if (position.Label == Strategy1 + "3")
                            TargetLabel = Strategy1 + "3";
                    }

 

Regards
Oltion bregu

 


@Invalid