Login Page - Create Account

Support Board


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



[Programming Help] - sc.StorageBlock limitations

View Count: 1400

[2016-05-20 00:22:07]
User754985 - Posts: 109
sc.StorageBlock is said to be of 512b.

Yet, I cannot fit all of the following variables into it:

struct s_PermData
  {
    int ChartPosition;
    double Lastentryprice; //or reduced to float
    int Lastentrybar;
    
    int LastIntOrderId;
    int LastPTargetOrderId;
    int LastSLOrderId;
    
  };
s_PermData* PermData;
PermData = (s_PermData*)sc.StorageBlock;

in the beginning of my code I retrieve these values and at the end- save into sc.StorageBlock.

CurrentPosition=PermData->ChartPosition;  
        
      if (CurrentPosition==0)
      {
        entrybar=i;
        entryprice=(double)sc.Close[i];
        TargetOrderID=0;
        StopOrderID=0;
        IntOrderID=0;
      }
      else
      {
        entrybar=PermData->Lastentrybar;
        entryprice=PermData->Lastentryprice;
        IntOrderID=PermData->LastIntOrderId;
        TargetOrderID=PermData->LastPTargetOrderId;
        StopOrderID=PermData->LastSLOrderId;
      }

....................................
...................................

PermData->ChartPosition=CurrentPosition;  
      PermData->Lastentryprice=entryprice;
      PermData->Lastentrybar=entrybar;
      PermData->LastIntOrderId=IntOrderID;
      PermData->LastPTargetOrderId=TargetOrderID;
      PermData->LastSLOrderId=StopOrderID;[/i]

A double and 1 int - work. 5 ints - work. A float and 2 ints - work...All of them together - generate a CPU exception at runtime.

Why would this be?

Is there a way to define a second StorageBlock for the study instance?
[2016-05-20 00:39:31]
Sierra Chart Engineering - Posts: 104368
All we can say is you must be doing something wrong if you are getting an exception.

There is only one StorageBlock per study.
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:54:41]
User754985 - Posts: 109
If I do not assign/retrieve them, just declare - all works fine..

But i commented/uncommented each single statement of usage to corner the error and each of them works by itself..or in combination (like described)...but not all of them together...that's why i thought of a Storageblock memory limitation..

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

Login

Login Page - Create Account