Login Page - Create Account

Support Board


Date/Time: Sun, 24 Nov 2024 16:01:16 +0000



[Programming Help] - Trying to automate a scan for watchlist symbols at the start of every new bar

View Count: 161

[2024-05-28 13:02:19]
User109115 - Posts: 28
Hi all, in a nutshell I'm trying to automate an intraday bar chart data download every 30minutes at the start of a new bar. I'm attempting to do this via a scan for a bunch of stocks which I have set up as an associated watchlist, attached to a chart.
I have a custom study ("TimeAlert") attached to the chart (simplified code is shown below), which achieves this to some degree. So when a new bar opens, the scan starts, but as the scan opens each of the charts in the watchlist, each time a new chart is opened, the custom study kicks in again and again and starts a new scan, so its a never ending loop of scanning!
Can anyone think of a way to achieve this please? I've been round & round in circles on this one and any help would be greatly appreciated! Regards

#include "sierrachart.h"

SCDLLName("TimeAlerts")

SCSFExport scsf_TimeAlert(SCStudyGraphRef sc)
{

// Set the configuration variables and defaults

SCString msg;

if (sc.SetDefaults)
{  
  sc.GraphName = "TimeAlert";
  sc.GraphRegion=0;
  return;
}
  
// Log the current time.
SCString TimeString = sc.TimeToString(sc.CurrentSystemDateTime);

// Limit to restrict execution of studies to when a new chart bar is created...

int &LastBarIndexProcessed = sc.GetPersistentInt(1);

if (sc.Index == 0)
LastBarIndexProcessed = -1;

if(sc.Index == LastBarIndexProcessed)

return;
LastBarIndexProcessed = sc.Index;

sc.AddMessageToLog(TimeString , 0);
sc.StartScanOfSymbolList(1);

}
[2024-05-28 13:20:34]
User109115 - Posts: 28
...to add. I've tried adding the symbols to the IFUL (intraday files update list), but don't know where to go from there? Thanks again

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

Login

Login Page - Create Account