Support Board
Date/Time: Sun, 24 Nov 2024 08:00:24 +0000
Issue: Custom study having custom object does not update once been added to the chart.
View Count: 1440
[2013-09-27 19:52:18] |
SherKhan - Posts: 19 |
Hello, I've built a custom class, which is declared in my custom study. If I declare the instance of the class inside the scsf_MainFunction(), the values calculated within the classs dont persist and the study does not display any results. If I declare the instance outside of the scsf_MainFunction() the study works fine and displays results. However, it works only when the study is added to the chart or chart values are recalculated (cntrl+insert). The values with in the class persist during this initial cycle. Any further updates to the chart such as new bars being added, the custom object does not persist any values and is not even initialized. I haved referenced Dynamic Memory allocation example given in the help section but that did not help (Study did not display at all). I have tried setting Free DLL = 0 as well but no luck. Is there any particular function/method I need follow ? Thank you! |
[2013-09-28 08:13:37] |
Sierra Chart Engineering - Posts: 104368 |
It sounds as though you have a problem with your class maintaining the data. If it is defined globally outside of the function and you have sc.FreeDLL = 0, then it will be created and not go out of scope as soon as a study within the DLL is added to the chart. If I declare the instance of the class inside the scsf_MainFunction(), the values calculated within the classs dont persist
This does make sense. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2013-09-30 16:23:38] |
SherKhan - Posts: 19 |
Thanks for the response. I have been able to get it to work when declared globally above the main() function. But the other problem I see here is when I add this study to another chart under the same workbook, I am having issues with the values getting off their correct calculation. Is it possible that the global declaration (variables declared within the class as Private) would have interfered with the same study calculations on the other chart ? I have seen your sample code http://www.sierrachart.com/index.php?l=doc/doc_ACSILProgrammingConcepts.html#DynamicMemoryAllocations If you could share any other example of managing dynamic memory and using declared class functions and using class variablse would be great. Thanks Date Time Of Last Edit: 2013-09-30 16:24:07
|
[2013-10-01 22:10:11] |
Sierra Chart Engineering - Posts: 104368 |
Refer to the updated example here: https://www.sierrachart.com/index.php?l=doc/doc_ACSILProgrammingConcepts.html#DynamicMemoryAllocations Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2013-10-01 22:11:33] |
Sierra Chart Engineering - Posts: 104368 |
A globally defined object will be shared among all study instances. The updated example shows how to create class objects dynamically. It is necessary to use new and delete.
Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
To post a message in this thread, you need to log in with your Sierra Chart account: