Login Page - Create Account

Support Board


Date/Time: Thu, 21 Nov 2024 16:39:14 +0000



sc.GetStartOfPeriodForDateTime does not work

View Count: 2211

[2013-04-12 15:32:06]
GmA - Posts: 20
Hello Support board!
I have tried to use sc.GetStartOfPeriodForDateTime function, but it always returns incorrect result.

Code is the following:



#include "sierrachart.h"

SCDLLName("Test")
SCString     MessageString;

SCSFExport scsf_Test(SCStudyGraphRef sc)
{
SCDateTime dtDayStartDateTime;
int    iYear;
int iMonth;
int    iDay;
int    iHour;
int    iMinute;
int    iSecond;

if (sc.SetDefaults)
   {
   sc.GraphName     = "Test";
   sc.FreeDLL     = 1;
   sc.AutoLoop     = 1;
   sc.ScaleRangeType = SCALE_SAMEASREGION;  
   return;
  }

if (sc.GetBarHasClosedStatus(sc.Index)!=BHCS_BAR_HAS_CLOSED)
{
   return;
}  
dtDayStartDateTime  = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[sc.Index], TIME_PERIOD_LENGTH_UNIT_DAYS, 1, 0);  

dtDayStartDateTime.GetDateTimeYMDHMS(iYear, iMonth, iDay, iHour, iMinute, iSecond);  
MessageString.Format(" sc.Index = %d, Session Start time = = %.2d.%.2d.%d %.2d : %.2d ", sc.Index, iDay, iMonth, iYear, iHour, iMinute);
sc.AddMessageToLog(MessageString,0);   
}


Log looks as follow:

Chart: ESM3 30 min #1 | Study: Test | sc.Index = 0, Session Start time = = 01.01.1950 00 : 00 | 2013-04-12 09:49:25
Chart: ESM3 30 min #1 | Study: Test | sc.Index = 1, Session Start time = = 01.01.1950 00 : 00 | 2013-04-12 09:49:25
Chart: ESM3 30 min #1 | Study: Test | sc.Index = 2, Session Start time = = 01.01.1950 00 : 00 | 2013-04-12 09:49:25
Chart: ESM3 30 min #1 | Study: Test | sc.Index = 3, Session Start time = = 01.01.1950 00 : 00 | 2013-04-12 09:49:25
Chart: ESM3 30 min #1 | Study: Test | sc.Index = 4, Session Start time = = 01.01.1950 00 : 00 | 2013-04-12 09:49:25
Chart: ESM3 30 min #1 | Study: Test | sc.Index = 5, Session Start time = = 01.01.1950 00 : 00 | 2013-04-12 09:49:25


Same output till sc.Index == 6000.

Build log:


-- Starting build of Custom Studies Source File: Test.cpp. -- 18:49:18
"C:\SierraChart\CPPCompiler\bin\g++.exe" "C:\SierraChart\SierraChartTransActMA\ACS_Source\Test.cpp" -march=i686 -mtune=i686 -O2 -shared -static -static-libgcc -static-libstdc++ -s -fno-rtti -fno-exceptions -o "C:\SierraChart\SierraChartTransActMA\Data\Test.dll"

-- End of Build -- 18:49:19



Theere is an old posts were similar problem with that function was described and as a resolution VC compiler were proposed to be used.
https://www.sierrachart.com/supportboard/showthread.php?t=40023&highlight=GetStartOfPeriodForDateTime

I've tried to compile it by Visual C++ Express, but result is the same.

Current version is 961.

Please advice how to make it working.
Thanks in advance and
Br GmA
[2013-04-12 17:33:29]
Sierra Chart Engineering - Posts: 104368
We do see this problem using the g++.exe compiler. We have resolved this. We do not see it with Visual C++ 2010. If you do see it using Visual C++, we tend to suspect you are actually not using the DLL generated by Visual C++. And instead using the one from g++.exe.

We will have a new release out today.
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-13 15:16:27]
GmA - Posts: 20
DLL has been removed from Data directory before compiling by Visual C++, so there were no former one created by g++.

Anyways, todays's version 964 has solved the problem.
Thank you very much for the fast reply and correction.

Regards,
GmA

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

Login

Login Page - Create Account