var RobotName

Created at 13 Nov 2012, 01:27
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!
RK

rkokerti

Joined 28.06.2012

var RobotName
13 Nov 2012, 01:27


Hello, 

How can I put...

1, the name of the robot "Test" (public class Test : Robot) into a variable?

2, and the file name of the robot (..\Robots\Test.algo) into a variable? (with / without extension)

var RobotName = ????

Thanks for your help!


@rkokerti
Replies

admin
14 Nov 2012, 11:44

You may do it this way:

 

        private string GetClassName()

        {

            var name = GetType().ToString(); // returns cAlgo.Robot.ClassName

            return name.Substring(name.LastIndexOf('.') + 1);   //  returns ClassName

        }

 


@admin

rkokerti
14 Nov 2012, 13:52

Thanks for your help, it works!


@rkokerti