How do you populate spreadsheet data in the same row when the instance to some of the variables occur at different times in C++

37 Views Asked by At

I need to dump data to a spreadsheet relevant to an alert condition being true but an aspect of the data will occur at a latter time then the alert condition being true. So if my alert is true at 2023-09-01 15:10:37 the data dumps appropriately to call it row 5 at that instance, except the high and low of the bar will not occur until 17, 59, 00. which as a calculation is not at the same time but I need them in the same row. I am not sure how to deal with the timing. As I need the ability to subtract the high from the current price the alert condition triggers(but I will settle for just gettin the high and low in the correct spot) so I can see the difference in price from that exact instance of rows data???

if ((LongAlert || ShortAlert) && Subgraph_SignalState[sc.Index] == 0)
    {   
    
        sc.AddMessageToLog("Long Or Signal Condition is TRUE", 1);
        
        

    
        sc.SetSheetCellAsString(SheetHandle, 0, rowIndex, symbol.GetChars());
        sc.SetSheetCellAsString(SheetHandle, 1, rowIndex, formattedDateTime);
        sc.SetSheetCellAsDouble(SheetHandle, 2, rowIndex, currentPrice);
        sc.SetSheetCellAsDouble(SheetHandle, 7, rowIndex, stn240Array[sc.Index]);
        
        
        
        
        float currentValue;
        currentValue = stn240Array[sc.Index];
    Subgraph_FormulaResult[sc.Index] = static_cast<float>(currentValue);
    
        
            
            rowIndex++;
SCDateTime targetTime;
targetTime.SetTime(HMS_TIME(17, 59, 0));

        if (currentDateTime > targetTime){  
sc.SetSheetCellAsDouble(SheetHandle, 3, rowIndex, dayHighClose);
sc.SetSheetCellAsDouble(SheetHandle, 4, rowIndex, dayLowClose);

        rowIndex++;
}   
    }

    return;
        
    
}

I tried doing it from a populate data at different times but could not get it to work 
0

There are 0 best solutions below