Mass Compile Strategies From Text Files

Questions about MultiCharts and user contributed studies.
User avatar
c0ntango
Posts: 70
Joined: 13 Sep 2018
Has thanked: 3 times
Been thanked: 16 times
Contact:

Mass Compile Strategies From Text Files

Postby c0ntango » 25 Mar 2020

Dear MC Seniors & Staff,

I have a situation with a client where I need to manage multiple portfolios of 600-800 strategies. They all come with PL source codes in individual text files.

It's a point where it's becoming unmanageable to copy & paste individual strategies into PL Editor and compile them individually.

I desperately need a solution that allows me to take an EL source code, and somehow get it "mass compiled" with PL Editor.

Here is what I have so far:

1.) Make sure the database has the entry - name the signals signal1, signal2, signalN, and compile the empty files in PL Editor,

2.) Go to StudyServer/Studies/SrcEl/Strategies and REPLACE the s_signal1.el, s_signal2.el, s_signalN.el with the source codes in individual files,

3.) Open them back up in PL Editor, and hit "Compile all Opened".

There's a problem with this approach, though: since PL Editor doesn't know about the change of the source code, the database is not marked as "uncompiled", and even though "compile all opened" is supposed to force recompilation, the compiler doesn't verify the source code is the same, and just goes to compile it from the outdated, cpp-transcoded version that is saved from before.

I know this is not necessarily a simple or typical thing to do, but I'd really appreciate your advice or ideas on how to achieve this by any hack necessary.

Thank you!

-Ben

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Mass Compile Strategies From Text Files

Postby Svetlana MultiCharts » 26 Mar 2020

Hello Ben,

In PowerLanguage Editor please go to File -> Open and press Ctrl+Shift+F5 in this dialogue to compile multiple studies.
image (9).png
(31.59 KiB) Not downloaded yet

User avatar
c0ntango
Posts: 70
Joined: 13 Sep 2018
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: Mass Compile Strategies From Text Files

Postby c0ntango » 26 Mar 2020

Hi Svetlana,

I have tried it. What exactly does Ctr + Shift + F5 do in this dialogue?

What I'm noticing is that now THE ENTIRE database of thousands of strategies, studies and functions, are all marked as "Uncompiled". I have to now run "Compile all", which will take me 4-5 hours, because everything that was already compiled needs to be re-compiled again.

I think we are on the right track with this - but is there a way to do it more selectively?

I might find myself in a situation, when multiple portfolios like these are running, thousands of strategies in the database, and now I have 150 or 200 that I have to replace, selectively, from those. Recompiling everything is going to stop the production environment for quite some time.

Thank you,

-Ben

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Mass Compile Strategies From Text Files

Postby Svetlana MultiCharts » 27 Mar 2020

Ben,

That is correct that Ctrl + Shift + F5 combination makes all studies uncompiled, and it is required to compile all after that.

Unfortunately, there is no other way to do it at the present moment.
Please post the corresponding feature request on our Project Management page so that other customers could vote for it:
https://www.multicharts.com/pm/public/multicharts

If you do not have a Project Management account please write us directly to our support email address.

trd001
Posts: 7
Joined: 25 Jan 2019
Has thanked: 1 time
Been thanked: 1 time

Re: Mass Compile Strategies From Text Files

Postby trd001 » 17 Apr 2020

I need that functionality too for Multicharts .NET!
It should be possible to get multiple .CS code files into the Multicharts .NET editor and compile then without copy & paste.

Best regards,
trd001

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Mass Compile Strategies From Text Files

Postby JoshM » 17 Apr 2020

I need that functionality too for Multicharts .NET! It should be possible to get multiple .CS code files into the Multicharts .NET editor and compile then without copy & paste.
If you move the .cs files into the folder with all the studies (on my pc it's C:\ProgramData\TS Support\MultiCharts .NET64\StudyServer\Techniques\CS), and then compile from inside the PowerLanguage.NET Editor, does that work? (You probably need to have the PowerLanguage.NET Editor closed when importing the files.)

(I would suggest a backup first in case it goes wrong. :) )

trd001
Posts: 7
Joined: 25 Jan 2019
Has thanked: 1 time
Been thanked: 1 time

Re: Mass Compile Strategies From Text Files

Postby trd001 » 18 Apr 2020

Hi JoshM,
thanks for your quick reply!

I found the solution, so it is indeed possible!
I had these issues:
1. The file name
I had the files in folder "C:\ProgramData\TS Support\MultiCharts .NET64\StudyServer\Techniques\CS", but the PowerLanguage .NET Editor did not show them in the Studies Overview Window. Therefore I could not select and compile them. The reason was, that apparently the type of study needs to be part of the file name if the study is not created within the the PowerLanguage .NET Editor. If the name of the file is "system_1.CS" one must change it to "system_1.Strategy.CS" if it is a signal. Then it shows up after a restart of the PowerLanguage.NET Editor.

2. The class name
I my case the class name and the constructor name were not the same as the first part of the file name ( the part before thr first dot without the study type), therefore the study did not compile. After changing that it worked.
So if your file name is "system_1.Strategy.CS", your program has to start like this:

namespace PowerLanguage.Strategy
{
public class system_1 : SignalObject
{
public system_1(object _ctx) : base(_ctx)
{
// default inputs
}
//
//
//

User avatar
c0ntango
Posts: 70
Joined: 13 Sep 2018
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: Mass Compile Strategies From Text Files

Postby c0ntango » 19 Apr 2020

Good for you guys, I still can't get this done in normal MC.

Now I have another idea on how to get this done: do you guys think it would be possible somehow to read only the conditions / rules from a file or database somehow with MC?

The problem is, there is no such function as "strtobool", and most of the time rules are specified as boolean conditions, and it might be really difficult to work around that.

Any ideas?


Return to “MultiCharts”