Passing data stream > data2 causes error (DLL)  [SOLVED]

Questions about MultiCharts and user contributed studies.
javamarket
Posts: 55
Joined: 10 Jul 2014
Has thanked: 10 times
Been thanked: 18 times

Passing data stream > data2 causes error (DLL)

Postby javamarket » 31 Aug 2014

MultiCharts64 Version 9.0 Beta 2 (Build 9505)

I have found that when passing a data stream higher than data2 to a DLL function I (often) get an error from the MC charting application. If I attach from VS and step through at times no error is produced.

The error language is effectively "Message: Error in study "yourDLL (Contract / barperiod)".

Passing data1 (int 0), and data2 (int 1) work as expected and do not cause an issue.

Mark

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Passing data stream > data2 causes error (DLL)

Postby Henry MultiСharts » 03 Sep 2014

Hello Mark,

Please send us the DLL, it's source code, PowerLanguage study and workspace you are using for replicating this behavior to support@multicharts.com

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

Re: Passing data stream > data2 causes error (DLL)  [SOLVED]

Postby javamarket » 22 Sep 2014

In the event anyone happens to search this down, after significant testing it was identified that although each indicator passed to a DLL is given its own thread, strategies are aggregated per chart in order to handle the logic. The lesson here is that a DLL that works in a thread safe way on an indicator may not inherently also be safe on a strategy.

Initially I used thread local storage which suffices for indicators. If you are going to use DLL based analysis for strategies you may find you need to more atomically manage the context. Moving all objects to a Class working in the DLL that was causing this issue.


Return to “MultiCharts”