Login Page - Create Account

Support Board


Date/Time: Mon, 21 Apr 2025 17:02:45 +0000



Post From: ACSIL sc.DailyHigh & sc.DailyLow

[2025-04-18 03:54:22]
Gradient - Posts: 121
For future reference, I did the following as a work around to dynamically compute the day's range.

double &HOD=sc.GetPersistentDouble(0);

double &LOD=sc.GetPersistentDouble(1);

SCDateTime currentBar=sc.BaseDateTimeIn[sc.Index];

int currentDate=currentBar.GetDate();

int firstIndex=sc.GetFirstNearestIndexForTradingDayDate(sc.ChartNumber,currentDate);

//Set the HOD and LOD at the start of the session
if(sc.Index==firstIndex){
  HOD=sc.High[sc.Index];
  LOD=sc.Low[sc.Index];
}

//Iterative Updates to HOD and LOD  
if(sc.High[sc.Index]>HOD){
    
  HOD=sc.High[sc.Index];
}
  
if(sc.Low[sc.Index]<LOD){
    
  LOD=sc.Low[sc.Index];
}
  
//Store Updated Range
dayRange=HOD-LOD;