Methods, Subroutines ?????  [SOLVED]

Questions about MultiCharts and user contributed studies.
skan

Aug 18 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: Nov 23 2010
Has thanked: 725 times
Been thanked: 223 times

Aug 18 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: Sep 05 2007
Has thanked: 8 times
Been thanked: 6 times

Aug 19 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

Aug 19 2011

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

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

Aug 20 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?