Login Page - Create Account

Support Board


Date/Time: Thu, 28 Mar 2024 13:50:51 +0000



ASCIL: Getting Chart Periodicity Data

View Count: 666

[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
[2017-03-17 18:58:05]
Sierra Chart Engineering - Posts: 104368
When working with these various variables to determine the timeframe of the chart bars, you need to check the chart data type first to determine which ones to use:
ACSIL Interface Members - Variables and Arrays: sc.ChartDataType

Use this function to get the name of the main price graph which will contain the timeframe per bar:
http://www.sierrachart.com/index.php?page=doc/ACSIL_Members_Functions.html#scGetStudyName
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account