Login Page - Create Account

Support Board


Date/Time: Sun, 12 May 2024 19:06:59 +0000



Runtime Error received while backtesting

View Count: 806

[2017-06-30 05:51:08]
User972044 - Posts: 154
I have received a runtime error while backtesting my ACSIL code. Please see attached screenshot of error. As per the screenshot, it asked me to contact you for further information. And Sierra Charts crashed afterwards due to this error.
imageRuntimeError_June292017.JPG / V - Attached On 2017-06-30 05:51:01 UTC - Size: 29.67 KB - 273 views
[2017-06-30 06:02:31]
Sierra Chart Engineering - Posts: 104368
The problem is this is almost 99 percent likely to be triggered by a problem in your own source code.

The general procedure is to run Sierra Chart in Safe Mode as explained in help topic 17:
Https://www.sierrachart.com/index.php?page=doc/helpdetails17.php

And if you do not encounter the problem, that means the problem is in your custom DLL study.


Try one of the Sierra Chart trading systems and see if you have the same problem. You definitely should not.

Refer to:
Automated Trading From an Advanced Custom Study: Example Trading Systems and Code
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
Date Time Of Last Edit: 2017-06-30 06:03:07
[2017-06-30 08:39:15]
User972044 - Posts: 154
I suspect so too but I thought I check with you just to be sure and the only thing that I can think of is for some very strange reason, my two integer variables Trade_PosL and Trade_PosS that I set up as persist variables that I mentioned in this ticket Persist Variables still shows up with value 1086121984 even after I have changed them to be just regular variables NOT persist variables of int data types as part of my troubleshooting attempts. I suspect it's those two integers that somehow overwhelmed the memory allocation and generated this error. Would you know what this value 1086121984 is? If you can let me know, it would give me a clue as to where I can look.

Thanks
Date Time Of Last Edit: 2017-06-30 08:47:50
[2017-06-30 17:17:44]
Sierra Chart Engineering - Posts: 104368
What this sounds like is there is a memory corruption occurring in your custom trading study which is leading to various issues.

I suspect it's those two integers that somehow overwhelmed the memory allocation and generated this error.
No, this would not 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
Date Time Of Last Edit: 2017-06-30 17:18:04
[2017-06-30 19:12:34]
User972044 - Posts: 154
Is there any ACSIL functions or commands that I can use to clean up the memory like de-allocate the memory perhaps to resolve this memory corruption? How do I resolve this memory corruption?
[2017-07-01 10:30:26]
User972044 - Posts: 154
Try one of the Sierra Chart trading systems and see if you have the same problem. You definitely should not.

Refer to:
Automated Trading From an Advanced Custom Study: Example Trading Systems and Code

I backtested one of your sample .cpp file tradingsystem.cpp, specifically the first SCSFExport scsf_TradingExample(SCStudyInterfaceRef sc) where it contained a persistent variable int& r_BuyEntryInternalOrderID = sc.GetPersistentInt(1); I backtested the code, not one order got generated, I put in

SCString Message1;

  Message1.Format("r_BuyEntryInternalOrderID: %d",r_BuyEntryInternalOrderID);

  sc.AddMessageToLog(Message1, 0);

in two different places, one at where the variable was initialized and another when an order was generated and the Message1 did NOT even get outputted into the Message Log and there were orders generated by this sample trading system. So I have no idea what was the value of this persistent variable r_BuyEntryInternalOrderID, whether it was at 0 when it was initialized or not or whether it was changed and what it was changed to.

As for my own codes, I tried resetting the persistent variables to 0 using sc.PersistVars->Integers[0] = 0;
sc.PersistVars->Integers[1] = 0; like you suggested in the other ticket Persist Variables I tried using the new GetPersistent* functions, NOTHING worked. The two persistent variables stayed as 1086121984 always. I even tried to put them into a brand new custom study file as you mentioned that it could be memory corruption with this particular custom study file, still EXACTLY the same result: 1086121984. I tried with sc.Autoloop = 1 and sc.Autoloop = 0, still the same results: 1086121984.

So I would appreciate it if you can investigate further to find out what could be the cause of this besides stating that it's my custom study files that's the problem. I created a brand new custom study file and setting persistent variables and it's still the same problem so it's NOT my custom study file anymore. The only outstanding problem is the persistent variables issue now.
Date Time Of Last Edit: 2017-07-03 23:43:38
[2017-07-03 22:26:48]
Sierra Chart Engineering - Posts: 104368
We will do some testing.
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
[2017-07-05 16:48:31]
Sierra Chart Engineering - Posts: 104368
Is there any ACSIL functions or commands that I can use to clean up the memory like de-allocate the memory perhaps to resolve this memory corruption? How do I resolve this memory corruption?
You need to locate the problem in your code and correct the code. How to do that is not within the scope of our support. We can refer you to a developer who can work for a reasonable price.

We have tested the scsf_TradingExample function and it worked flawlessly as would be expected.

We added logging of the internal order ID number put into a persistent variable when there is a buy entry. And here is the result:


Chart: Replay 960.0X: YMU17 5 Min #1 | Study: Trading Example: Using Moving Average and Target and Stop | BuyEntry Internal Order ID: 758174 | 2017-07-05 03:28:02

Anyone can test this study function just by following the instructions here:
Automated Trading From an Advanced Custom Study: Example Trading Systems and Code

If there is a problem, others can let us know but we would not expect that. No one has ever reported the problems you have. The issues are in your own code. Like we said we can refer you to a developer who can help you.
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
Date Time Of Last Edit: 2017-07-05 16:49:57
[2017-07-05 23:54:54]
User972044 - Posts: 154
I did NOT do anything to my codes; I did NOT change anything but it's working now. Please see Message Log below:

Chart: Replay 1.0X: UVXY 60 Min #2 | Study: Custom DLL Study | Buy PositionData Quantity: 0 TradeS_OrderQuantity: 7400 Trade_PosL: 0 | 2017-07-05 19:48:53
Chart: Replay 1.0X: UVXY 60 Min #2 | Study: Custom DLL Study | Sell PositionData Quantity: 0 TradeS_OrderQuantity: 7400 Trade_PosS: 0 | 2017-07-05 19:48:53

Glad it's working now but it really was NOT my codes.
Date Time Of Last Edit: 2017-07-06 00:23:58

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account