Is there an equivalent to the TS "method" keyword

Questions about MultiCharts and user contributed studies.
bruce.mtpredictor
Posts: 9
Joined: 20 Oct 2014

Is there an equivalent to the TS "method" keyword

Postby bruce.mtpredictor » 21 Oct 2014

[Tag] TS OOEL

I have an Easy Language TS indicator that uses a lot of methods to structure the code. Is there an equivalent keyword in Power Language. I know I could use functions but one of the reasons not to use a lot of "functions" in TS is because they are not that efficient. Also most of my methods do very simple things and it seems like over kill to create a function for each.

Thanks

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 558 times

Re: Is there an equivalent to the TS "method" keyword

Postby Andrew MultiCharts » 21 Oct 2014

Hello bruce.mtpredictor,

Are you referring to object-oriented EasyLanguage?

bruce.mtpredictor
Posts: 9
Joined: 20 Oct 2014

Re: Is there an equivalent to the TS "method" keyword

Postby bruce.mtpredictor » 21 Oct 2014

I do not believe that this is part of the OOEL. I believe it is part of Easy Language itself. It is a reserved keyword.

Below is from TS's documentation:
The method reserved word allows you to create a named subroutine within an EasyLanguage document that consists of a sequence of statements to perform an action, a set of input parameters to customize those actions, and possibly a return value.

Remarks
Methods are local to the EasyLanguage document and variables declared within a method are active only within the scope of that method. A method can be called from anywhere within the EasyLanguage document.

The variable declaration rules in a local method are slightly different than for a variable declaration in the main body of an EasyLanguage document (see above). In a method, the data type is required and no initial value is allowed after the variables name.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 558 times

Re: Is there an equivalent to the TS "method" keyword

Postby Andrew MultiCharts » 22 Oct 2014

The method reserved word allows you to create a named subroutine within an EasyLanguage document that consists of a sequence of statements to perform an action, a set of input parameters to customize those actions, and possibly a return value.

Remarks
Methods are local to the EasyLanguage document and variables declared within a method are active only within the scope of that method. A method can be called from anywhere within the EasyLanguage document.

The variable declaration rules in a local method are slightly different than for a variable declaration in the main body of an EasyLanguage document (see above). In a method, the data type is required and no initial value is allowed after the variables name.
It looks like it is the same as DefineDLLFunc, isn't it?

User avatar
ABC
Posts: 636
Joined: 16 Dec 2006
Has thanked: 120 times
Been thanked: 359 times
Contact:

Re: Is there an equivalent to the TS "method" keyword

Postby ABC » 22 Oct 2014

As far as I know methods were introduced together with OOEL and one could argue if it's a part of it or not. In my opinion it's a concept used in object oriented programming, comparable to a method within a MC.NET code.
Apart from that it would still be great to have it implemented into MC and there is a request for it: https://www.multicharts.com/pm/viewissu ... no=MC-1757

Regards,
ABC

javamarket
Posts: 55
Joined: 10 Jul 2014
Has thanked: 10 times
Been thanked: 18 times

Re: Is there an equivalent to the TS "method" keyword

Postby javamarket » 22 Oct 2014

I posted a very similar question in the forums some time ago with the kind replies very similar when I asked. In having a look at how the code is used in the original EL, it is indeed a "call and return" construct like standard ObjectO and I too cannot claim if it is or isn't part of OOEL.

For my needs I found no other alternative other than to move my entire code to C++ / DLL as MC hasn't any similar construct in PL as of this writing.

bruce.mtpredictor
Posts: 9
Joined: 20 Oct 2014

Re: Is there an equivalent to the TS "method" keyword

Postby bruce.mtpredictor » 27 Oct 2014

Well I don't agree that this is an object oriented construct. This basically a subroutine. I currently have a DLL function that is called from various places in my code. After calling the function I have a common routine ( in TS)that processes the return code. I can get around this issue by duplicating the logic that is in this routine. I just find it odd that the basic Multicharts ( not the .NET version) program does not implement such basic language constructs. Anyway, thanks for everyone's help.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 558 times

Re: Is there an equivalent to the TS "method" keyword

Postby Andrew MultiCharts » 27 Oct 2014

After calling the function I have a common routine ( in TS)that processes the return code. I can get around this issue by duplicating the logic that is in this routine. I just find it odd that the basic Multicharts ( not the .NET version) program does not implement such basic language constructs.
Please leave us such feature request.


Return to “MultiCharts”