Login Page - Create Account

Support Board


Date/Time: Thu, 28 Mar 2024 13:58:07 +0000



sc.GetContainingIndexForSCDateTime() qstn

View Count: 3799

[2013-04-25 06:35:13]
ganz - Posts: 1048
Dear Support.

1. Maybe it's not a big deal but

v967

This is the very simple study:


#include "sierrachart.h"

SCDLLInit("indx_b1");

SCSFExport scsf_indx_b1(SCStudyInterfaceRef sc)
{
  SCSubgraphRef indx_b1     = sc.Subgraph[0];

  if (sc.SetDefaults)
  {
    sc.GraphName       = "indx_b1";
    sc.StudyDescription   = "indx_b1 >>beta 1<< @ganz";

    indx_b1.Name       = "indx_b1";
    indx_b1.DrawStyle     = DRAWSTYLE_BAR;
    indx_b1.PrimaryColor  = RGB(255,255,0);
    indx_b1.LineWidth     = 4;
    
    sc.GraphRegion       = 1;    
    sc.AutoLoop       = 1;    
    sc.FreeDLL         = 1;    
  }

  SCDateTime   NextDate;
  int     NextIndex;
  
  sc.DataStartIndex = 100;
  
  if ( sc.DailyDataBarPeriod == 1 ) {  
      
    for ( int count = 1 ; count <= 3; count ++ )
    {          
      NextDate  = sc.BaseDateTimeIn[sc.Index] - count*7*DAYS;
      
      NextIndex   = sc.GetContainingIndexForSCDateTime(sc.ChartNumber, NextDate);
                  
      indx_b1[sc.Index] = NextIndex;
    }  
}
  else return;
}



It works well without NextIndex   = sc.GetContainingIndexForSCDateTime(sc.ChartNumber, NextDate); this indx_b1[sc.Index] = NextDate.GetDate(); works fine

It works very well if sc.GetContainingIndexForSCDateTime() has been added to the code and the study is on a daily chart already

but it crashes SC if I try to add the study on the clean daily chart

so I assume there is some issue w sc.GetContainingIndexForSCDateTime()


2. Second question is I'm not able to change the periodicity from an intraday to historical w Chart Settings.

Thank you for any assistance.

ps: {code}{/code} transfers > and < to &lt;
Date Time Of Last Edit: 2013-04-25 06:40:13
[2013-04-25 07:29:54]
Sierra Chart Engineering - Posts: 104368
1. There is a small change we have made which will be in the next release which should solve this hopefully. Let us know if you still see the problem with 968 after you have recompiled the study on that version.

2. This is probably because it is being referenced by another chart which is forcing it back.

3. We will solve this.
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-04-25 07:50:07]
ganz - Posts: 1048

2. No. I did FS-> Open Intraday Chart -> F5-> to Historical w no success

The only one chart on the fresh *.cht

Also FYI http://www.bigmiketrading.com/sierra-chart/27124-switching-intraday-historical-chart-type-sierra-chart.html

Thank you.
[2013-04-25 08:15:21]
Sierra Chart Engineering - Posts: 104368
1. If the solution we are going to release in 968 actually resolves this, this does indicate the compiler we provide with Sierra Chart, is not handling the SCDateTime passed by reference properly which will require changes to all of the functions that take that type. This will require a recompile of all user studies using functions that take these as reference.

2. We will fix this.


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-04-25 11:28:13]
ejtrader - Posts: 688
SC Team - Now that the latest version of gcc is 4.8 - wondering if you can start bundling 4.8 version instead of 4.7. Seems like decent improvements from GCC 4.7 to 4.8.

Thanks
[2013-04-25 14:41:40]
ganz - Posts: 1048
hi

I'm sorry to interrupting you

MinGW 4 windoze distributes the packages through mingw-get and 4.7.2 is available only at this moment

do you know another way?

also did you check this issue has resolved in v 4.8?

thank you
[2013-04-25 15:43:04]
ejtrader - Posts: 688
I have a custom 4.8 build and when I test the above code in SC 967 - it works for me.

I have opened the daily chart and inserted the indicator based on the above code as is..


imageSC_Daily_NO_Issue.png / V - Attached On 2013-04-25 15:42:54 UTC - Size: 29.83 KB - 627 views
[2013-04-25 15:54:26]
ganz - Posts: 1048
thanks a lot for this info.
[2013-04-25 16:23:46]
ganz - Posts: 1048
I've compiled the study w v 4.8 from here http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.0/32-bit/threads-win32/dwarf/ w no success - SC still crashes because of the study

btw: trying this on win 2008 r2 x64
[2013-04-25 16:36:50]
ejtrader - Posts: 688
ganz - Does it crash after sometime for you ? If so - how long you need to keep it running before it crashes?
[2013-04-25 16:42:22]
ganz - Posts: 1048
It crashes w no chance to see it on a chart.

F6 -> Add -> Apply -> Boom! :)
[2013-04-25 16:44:57]
ejtrader - Posts: 688
Can you paste the cpp& dll file here for 967? I would check first with compiled code and then with dll code to see if it can be isolated to specific compiler. I have tested with MS compiler as well and it works fine for me..

PS: I have win 7 64 bit..

Thanks
Date Time Of Last Edit: 2013-04-25 16:54:27
[2013-04-25 16:58:52]
ganz - Posts: 1048
yes, sure.

thank you for your time.


attachmentindx_b1.cpp - Attached On 2013-04-25 16:58:17 UTC - Size: 925 B - 594 views
attachmentindx_b1.dll - Attached On 2013-04-25 16:58:33 UTC - Size: 35.5 KB - 589 views
[2013-04-25 17:10:58]
ejtrader - Posts: 688
Well - I have tried both the options - compiling cpp file with built-in SC compiler as well as using the dll file you have.. worked fine for me.

I couldn't compile the cpp file as is - had to change the dll line ( not that it would matter but - wanted to mention ).
old value:
//SCDLLInit("indx_b1");

New value:
SCDLLName("indx_b1")

Attached is the image & chartbook/cpp/dll(same as the one you sent me).

Edit - I am NOT using continuous contract and my data only goes back to Mar'2013 - and potentially could be the difference..

Thanks






Date Time Of Last Edit: 2013-04-25 17:12:43
attachmentindx_b1.cpp - Attached On 2013-04-25 17:09:50 UTC - Size: 949 B - 590 views
attachmentTest_Chartbook.cht - Attached On 2013-04-25 17:10:01 UTC - Size: 24.57 KB - 568 views
attachmentindx_b1.dll - Attached On 2013-04-25 17:10:09 UTC - Size: 35.5 KB - 575 views
imageSC_Daily_NO_Issue2.png / V - Attached On 2013-04-25 17:10:53 UTC - Size: 99.73 KB - 601 views
[2013-04-25 17:16:42]
ganz - Posts: 1048
hmm it's puzzled a bit

are you using CLR or NoCLR ver967? I'm w noCLR.

Anyway thanks a lot for the assistance.

[2013-04-25 17:17:49]
ejtrader - Posts: 688
Regular version of Sierra.. ( which is CLR version )..
[2013-04-25 17:32:30]
ejtrader - Posts: 688
Looking further at the source.. One more change I did for compilation( there was no error but when it complained about dll - I removed windows.h to isolate and then changed dll line but forgot to un-comment windows.h line) - I took out windows.h - if it matters..

Thanks
[2013-04-26 08:17:40]
ganz - Posts: 1048
Hello SC Support

I've tried this w v968:

NonCLR ver has crashed - no changes

preCLR does the job w the "CPU exception" warning - no changes

Also the study has been recompiled w gcc 4.8 and 4.9pre - no effect

Is it me or is this an issue w compiler?

Should I just drop this for a while?

Thank you.
[2013-04-26 22:01:01]
Sierra Chart Engineering - Posts: 104368
We should have at first tested your code. We did now and we see the problem . This will be resolved in the next release. However, for now please put a "return" at the end of the SetDefaults code block.
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-04-27 01:42:59]
ganz - Posts: 1048
Hello SC Support
I apologize for my oscitancy.
It was the inaccurate decision to cut the part of the code on my side.
Really sorry you've wasted the time on me.
Thank you for the good support.

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

Login

Login Page - Create Account