Login Page - Create Account

Support Board


Date/Time: Wed, 01 Jan 2025 14:07:01 +0000



SubgraphRef - CPU exception

View Count: 922

[2016-05-20 00:32:30]
User754985 - Posts: 109
Why would the following piece of code generate a CPU exception?

........
SCSubgraphRef CurrentPosition   = sc.Subgraph[8]
.............
sc.Autoloop=1;
...............
................
int Result=0;

Result=sc.BuyOrder(NewOrder);

if (Result>0)
{
CurrentPosition[sc.Index]+=Result;
.....
....
}

And if CurrentPosition is defined as a Persistent Variable - all works fine..
[2016-05-20 00:35:55]
Sierra Chart Engineering - Posts: 104368
This is not safe:

CurrentPosition[sc.Index]+=Result;

Should be:

CurrentPosition[sc.Index] = Result + CurrentPosition[sc.Index];
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
[2016-05-20 00:46:50]
User754985 - Posts: 109
This did not work either...
[2016-05-20 00:54:18]
Sierra Chart Engineering - Posts: 104368
This means there is some other unidentified problem which we cannot see.

You will have to find it and resolve it on your own.
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: 2016-05-20 00:54:33
[2016-05-20 00:57:10]
User754985 - Posts: 109
What are the typical causes of "CPU exception"?

division by zero, wrong type casting, ...?
[2016-05-20 02:10:17]
Sierra Chart Engineering - Posts: 104368
Access violations and integer divide by zero are the most common exceptions.

Access violations can be caused by a memory corruption in one area of code causing a problem with other code that has no problem to begin with.

Once an exception occurs, the process is no longer in a stable state and has to be restarted. Otherwise exceptions can continue to occur even though the problem has been solved in the custom studies DLL.
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: 2016-05-20 02:11:29

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

Login

Login Page - Create Account