Methods, Subroutines ?????

Questions about MultiCharts and user contributed studies.
skan

Methods, Subroutines ?????

Postby skan » 18 Aug 2011

Hello
How can I code subroutines on Multicharts?
I need to reuse part of my code several times.

Somebody advised me to you use something like:

Code: Select all

Method double Subroutine1(double dou) begin
if t=1200 then Buy this bar;
Return dou*2;
end;
value1=Subroutine1(c);
setexitonclose;
But I could find any documentation on "method".

Can I use sell and buy orders within the subroutine?, How do I invoke it?

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Methods, Subroutines ?????

Postby arjfca » 18 Aug 2011

Hello Skan

You could code your routine in a function. It will have the same result as a sub-routine. As example, you could open any function in your editor and see how it is designed.

Martin

rondot samuel ws
Posts: 103
Joined: 05 Sep 2007
Has thanked: 8 times
Been thanked: 6 times

Re: Methods, Subroutines ?????

Postby rondot samuel ws » 19 Aug 2011

Hi,

I think you can pout order only in strategy, not in function.

So, in the example given initialy with a "Buy oder", function is not possible

In my opinion, there is no solution for making a "subroutine" with order inside.

Order are possible only in Strategy

Laurent
Hello Skan

You could code your routine in a function. It will have the same result as a sub-routine. As example, you could open any function in your editor and see how it is designed.

Martin

skan

Re: Methods, Subroutines ?????

Postby skan » 19 Aug 2011

That's why I was advised to use "method"
Where can I find info on this command?

rondot samuel ws
Posts: 103
Joined: 05 Sep 2007
Has thanked: 8 times
Been thanked: 6 times

Re: Methods, Subroutines ?????

Postby rondot samuel ws » 20 Aug 2011

You right.

Seems to be really new. never heard before.

Powerlanguage editor : (MC 7.0 last relase)
type method, hit F1 :

Method
Supported by PowerLanguage.
A detailed description and usage examples will be presented in the documentation accompanying the next release of MultiCharts.

Hope MC support will answer you...




That's why I was advised to use "method"
Where can I find info on this command?


Return to “MultiCharts”