What happens when a signal is recompiled?

Questions about MultiCharts .NET and user contributed studies.
mt99
Posts: 18
Joined: 24 Mar 2014
Has thanked: 1 time
Been thanked: 1 time

What happens when a signal is recompiled?

Postby mt99 » 06 Jun 2014

Hi,

Can you please tell me what happens to an existing signal object that is currently running when it is recompiled in the PowerLanguage .NET editor? I have noticed the following piece of behaviour:

My signal has a static object that is instantiated in the static contructor of the signal class and everything works fine when this signal is attached to one or several charts. Then, when I recompile the signal (while it is still running), the static initialiser runs again, which means that the old signal objects and even the already initialised static variables within them get destroyed in the process of recompilation. This is quite reasonable apart from one thing: there is seemingly no event or callback that I can hook into to detect when this is happening, so my static object that exists in my running signals doesn't get the chance to clean up various resources that it needs to clean up...

Can you either explain a little bit as to what happens under the hood when I press F7 in the PowerLanguage .NET editor with respect to the running signals, or advise me on any event or callback I can use to detect when such a brutal purge of existing objects is about to take place?

Thank you.

User avatar
Alex MultiCharts
Posts: 194
Joined: 09 Aug 2013
Has thanked: 43 times
Been thanked: 77 times

Re: What happens when a signal is recompiled?

Postby Alex MultiCharts » 09 Jun 2014

Hello mt99.

You can use the following methods: StopCalc, Destroy, Dispose.
Please see details in our .NET Guide: https://www.multicharts.com/trading-sof ... ming_Guide or built-in Help in PowerLanguage .NET Editor.


Return to “MultiCharts .NET”