Timing issue

#include "sierrachart.h"

SCDLLName("SpreadsheetTest")







static int rowIndex = 1; 







SCSFExport scsf_SpreadsheetTest(SCStudyInterfaceRef sc)



{   

    SCSubgraphRef Subgraph_SignalState = sc.Subgraph[0];

    SCSubgraphRef Subgraph_FormulaResult = sc.Subgraph[0];

   

    SCInputRef Input_StartTimeForAllowedTimeRange = sc.Input[0];

    SCInputRef Input_EndTimeForAllowedTimeRange = sc.Input[1];    

     SCInputRef Input_LongSignalSelection = sc.Input[2];

    SCInputRef Input_ShortSignalSelection = sc.Input[3];    

    SCInputRef Input_CurrentTime = sc.Input[4];

    SCInputRef Input_240StnAngle = sc.Input[5];

    SCInputRef Input_DayStnValue = sc.Input[6];

    SCInputRef Input_720StnValue = sc.Input[7];

    SCInputRef Input_720DayAtrValue = sc.Input[8];

    SCInputRef Input_720WeekAtrValue = sc.Input[9];

    SCInputRef Input_DayDayAtrValue = sc.Input[10];

    SCInputRef Input_DayWeekAtrValue = sc.Input[11];

    SCInputRef Input_60TickValue = sc.Input[12];

    SCInputRef Input_240TickValue = sc.Input[13];

    SCInputRef Input_DayTickValue = sc.Input[14];

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    /////////////////////////////////////////



    if (sc.SetDefaults)

    {

        sc.GraphName = "Spreadsheet Test 1";

        sc.AutoLoop = 0;

        

        

    Input_StartTimeForAllowedTimeRange.Name = "Start Time For Allowed Time Range";

    Input_StartTimeForAllowedTimeRange.SetTime(HMS_TIME(21, 00, 00));    

    

    Input_EndTimeForAllowedTimeRange.Name = "End Time For Allowed Time Range";

        Input_EndTimeForAllowedTimeRange.SetTime(HMS_TIME(15, 00, 00));



    Input_LongSignalSelection.Name = "Select Long Signal";

    Input_LongSignalSelection.SetChartStudySubgraphValues(17, 67, 0);



    Input_ShortSignalSelection.Name = "Select Short Signal";

    Input_ShortSignalSelection.SetChartStudySubgraphValues(17, 68, 0);    



    Input_240StnAngle.Name = "240 STN";

    Input_240StnAngle.SetChartStudySubgraphValues(17, 74, 0);    

    

    Input_DayStnValue.Name = "Day STN";

    Input_DayStnValue.SetChartStudySubgraphValues(17, 73, 0);

    

    Input_720StnValue.Name = "720 STN";

    Input_720StnValue.SetChartStudySubgraphValues(17, 75, 0);

    

    Input_720DayAtrValue.Name = "720 Day Atr";

    Input_720DayAtrValue.SetChartStudySubgraphValues(17, 76, 0);



    Input_720WeekAtrValue.Name = "720 Week Atr";

    Input_720WeekAtrValue.SetChartStudySubgraphValues(17, 77, 0);        



    Input_DayDayAtrValue.Name = "Day Day Atr";

    Input_DayDayAtrValue.SetChartStudySubgraphValues(17, 78, 0);        



    Input_DayWeekAtrValue.Name = "Day Week Atr";

    Input_DayWeekAtrValue.SetChartStudySubgraphValues(17, 79, 0);



    Input_60TickValue.Name = "Day Day Atr";

    Input_60TickValue.SetChartStudySubgraphValues(17, 80, 0);



    Input_240TickValue.Name = "240 Tick";

    Input_240TickValue.SetChartStudySubgraphValues(17, 81, 0);



    Input_DayTickValue.Name = "240 Tick";

    Input_DayTickValue.SetChartStudySubgraphValues(17, 82, 0);











    ////////////////////////////////////////////////////////////////////////////

    Input_CurrentTime.Name = "Current Timme";

    

    Subgraph_FormulaResult.Name = "Formula Result";

    Subgraph_FormulaResult.DrawZeros = true;



        return;

        

    }

    

    

    //creating current time output 

    

    int Year, Month, Day, Hour, Minute, Second;

    SCDateTime currentDateTime = sc.GetCurrentDateTime();

    currentDateTime.GetDateTimeYMDHMS(Year, Month, Day, Hour, Minute, Second);



    char formattedDateTime[20];

    snprintf(formattedDateTime, sizeof(formattedDateTime), "%04d-%02d-%02d %02d:%02d:%02d",

             Year, Month, Day, Hour, Minute, Second);

    sc.AddMessageToLog(formattedDateTime, 1);



    float dayHighClose = sc.BaseData[SC_HIGH][sc.Index];

    float dayLowClose = sc.BaseData[SC_LOW][sc.Index];



    /// log low value 

char lowLogMessage[64];

snprintf(lowLogMessage, sizeof(lowLogMessage), "Low of day: %f", dayLowClose);

sc.AddMessageToLog(lowLogMessage, 1);



// Log the high value

char highLogMessage[64];

snprintf(highLogMessage, sizeof(highLogMessage), "High of day: %f", dayHighClose);

sc.AddMessageToLog(highLogMessage, 1);













    <b

This query has been addressed here.