Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 02:30:27 +0000



[Programming Help] - Timing issue populating spreadsheet data ACSIL

View Count: 207

[2023-09-23 18:24:47]
User373245 - Posts: 42
Anyone know how to tackle this timing issue. I want to populate the difference between the high or low of the day from the current price my alert triggers at and populate the same row my alert triggers at but they occur in different times. So says my initial alert triggers 2023-09-01 15:08:10. The data populates correctly in call it row 5....the end of day is not until (20, 59, 0); And so It will not populate until the end of day and loads the value in the next row 6. I tried to put the block of code under the initial If statment but that didn't work at all. The way its coded now it at least populate the row below and I thought of subtracting manually in the spreadsheet but there is defiantly a way. Maybe you can stall the data population until the end of the day to have it time at the same instance even though the calculations occur in different times???







if ((LongAlert || ShortAlert) && Subgraph_SignalState[sc.Index] == 0)
  {  
      
      if (currentPrice < S1ValArray[sc.Index] && currentPrice > S2ValArray[sc.Index]){
         double price = currentPrice;
        double s1 = S1ValArray[sc.Index];
        double s2 = S2ValArray[sc.Index];
        double percentage = ((s1 - price) / (s1 - s2)) * 100.0;
        sc.SetSheetCellAsDouble(SheetHandle, 5, rowIndex, percentage);

        
        
sc.AddMessageToLog("Condition is TRUE", 1);
}
else
{
sc.AddMessageToLog("Condition is FALSE", 1);
}
  
    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]);
    sc.SetSheetCellAsDouble(SheetHandle, 8, rowIndex, dayStnValArray[sc.Index]);
    
    float currentValue;
    currentValue = stn240Array[sc.Index];
    
    Subgraph_FormulaResult[sc.Index] = static_cast<float>(currentValue);
    rowIndex++;

  }

if ((currentDateTime >= endTime) && (Subgraph_SignalState[sc.Index] == 0)){
float priceDiffH;
  priceDiffH = currentPrice - dayHighClose;
  float priceDiffL;
  priceDiffL = currentPrice - dayLowClose;
    
sc.SetSheetCellAsDouble(SheetHandle, 3, rowIndex, dayHighClose);
sc.SetSheetCellAsDouble(SheetHandle, 4, rowIndex, dayLowClose);
sc.SetSheetCellAsString(SheetHandle, 0, rowIndex, symbol.GetChars());
sc.SetSheetCellAsString(SheetHandle, 1, rowIndex, formattedDateTime);
sc.SetSheetCellAsDouble(SheetHandle, 5, rowIndex,priceDiffH);
sc.SetSheetCellAsDouble(SheetHandle, 6, rowIndex, priceDiffL);
  }    
  
return;
  
  
  
  
}

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

Login

Login Page - Create Account