Login Page - Create Account

Support Board


Date/Time: Sun, 28 Apr 2024 10:55:06 +0000



Post From: ASCIL: Getting Chart Periodicity Data

[2017-03-17 03:39:11]
6c7574686572 - Posts: 20
I have a study that will display the periodicity and the symbol on the chart. I am running into problems with the periodicity as sc.SecondsPerBar does not seem to function as expected in Daily charts (does not return NULL) and sc.DaysPerBar returns (1) in intraday periodicities (1m, 5m, etc)

Therefore, the Intraday portion does not work together with the Daily portion. When separated, they work as expected.

Can you create access to an element that would simply return the string of the chart periodicity? This is already available as "(RC)Period" for Chart Header fields but not accessible via ASCIL as far as I can tell.



if(DisplayPeriod.GetYesNo())
    {
    
     // Intraday
    
    if (sc.SecondsPerBar > 3600 && sc.SecondsPerBar < 86400) // hours
        Tool.Text.Format("%d Hours\n%s", sc.SecondsPerBar/3600, SymbolDisplay);
    
     else if (sc.SecondsPerBar == 3600) // one hour
       Tool.Text.Format("%d Hour\n%s", sc.SecondsPerBar/3600, SymbolDisplay);
    
     else if (sc.SecondsPerBar > 60 && sc.SecondsPerBar < 14400 ) // minutes
        Tool.Text.Format("%d Minutes\n%s", sc.SecondsPerBar/60, SymbolDisplay);

     else if (sc.SecondsPerBar == 60) // one minute
       Tool.Text.Format("%d Minute\n%s", sc.SecondsPerBar / 60, SymbolDisplay);
    
    else if (sc.SecondsPerBar < 60 ) // seconds
        Tool.Text.Format("%d Seconds\n%s", sc.SecondsPerBar, SymbolDisplay);    
    
    // Daily
    
    else if (sc.DailyDataBarPeriod == 1) // Days
      Tool.Text.Format("%i Days\n%s", sc.DaysPerBar, SymbolDisplay);
      
    else if (sc.DailyDataBarPeriod == 2) // Weeks
      Tool.Text.Format("%i Weeks\n%s", sc.DaysPerBar, SymbolDisplay);
    
    else if (sc.DailyDataBarPeriod == 3) // Months
      Tool.Text.Format("%i Months\n%s", sc.DaysPerBar, SymbolDisplay);
    
    else if (sc.DailyDataBarPeriod == 4) // Quarters
      Tool.Text.Format("%i Quarters\n%s", sc.DaysPerBar, SymbolDisplay);
    
    else if (sc.DailyDataBarPeriod == 5) // Years
      Tool.Text.Format("%i Years\n%s", sc.DaysPerBar, SymbolDisplay);  
    
    }
    else
      Tool.Text.Format("%s ##", SymbolDisplay );  // dont display periodicity
    }

Thank you