Login Page - Create Account

Support Board


Date/Time: Sun, 09 Mar 2025 19:14:14 +0000



[Programming Help] - SC.DateTimeIn and sc.GetIndexOfHighestValue

View Count: 658

[2019-08-27 02:57:15]
Joel Wisdo - Posts: 15
I would like to store the index value for the previous 3 Highest Indices when a condition is true. For some reason hP2 and hP3 never store the previous index values. They equal the index value for hP1. I have tried to use sc.GetEndingDateTimeForBarIndex instead of sc.BaseDateTimeIn[hP1] but the previous index values (hP2 and hP3) still will not store. Any input would be appreciated.

 
 
        int& hP1 = sc.GetPersistentInt(0); 
  SCDateTime& vhP1 = sc.GetPersistentSCDateTime(0); 
 
 
  int& hP2 = sc.GetPersistentInt(1); 
  SCDateTime& vhP2 = sc.GetPersistentSCDateTime(1); 
 
 
  int& hP3 = sc.GetPersistentInt(2); 
  SCDateTime& vhP3 = sc.GetPersistentSCDateTime(2); 
 
 
if (pN[sc.Index - 2] >= .40 && pN[sc.Index-1] < .40) {  
     
 
                hP3 = hP2; 
    vhP3 = vhP2; 
    hP2 = hP1; 
    vhP2 = vhP1; 
    hP1 = sc.GetIndexOfHighestValue(sc.BaseData[SC_HIGH], 10); 
    vhP1 = sc.BaseDateTimeIn[hP1]; 
  } 
 

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

Login

Login Page - Create Account