Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 04:03:51 +0000



[Programming Help] - Converting NT8 Opening Range Volume Breakout Study

View Count: 1280

[2018-11-01 18:58:51]
Yoda - Posts: 106
I found an opening range volume breakout study here: http://traders.com/Documentation/FEEDbk_docs/2017/06/TradersTips.html

They have provided code for 9 different charting programs, but unfortunately Sierra Chart is not included.

So I've started to convert the provided NT8 code to SC by first focusing on the cumulative & average volume sections.

My code compiles without any issues and correctly calculates the cumulative overnight volume.

However, the code does not add up the total overnight volume for five days. Specifically this section:

// Build NightlyVolumes - Hardcoded 5 days.
for(int i = 0; i < 5; i++)
{
  if (NightlyVolumes[i] == 5 - 1)
  {
    NightlyVolumes[i] = NightlyVolume;
    DebugString.Format("NightlyVolumes[%d] >= SessionStart: \
      %f",i, NightlyVolumes[i]);
    sc.AddMessageToLog(DebugString, 0);
  }
  else
  {
    NightlyVolumes[i] = NightlyVolumes[i + 1];
    DebugString.Format("NightlyVolumes[%d] at SessionStart: \
      %f", i, NightlyVolumes[i]);
    sc.AddMessageToLog(DebugString, 0);        
  }
}

I'm guessing that I haven't setup NightlyVolumes correctly. I've tried a number of things, including:
  
std::array<int,5> NightlyVolumes; // Create Array of 5 days

and also:
  
SCFloatArrayRef NightlyVolumes  = sc.Subgraph[9].Arrays[0];
  
But nothing I did worked.

I've attached my code and should be grateful if someone would have a look at it and let me know what changes I need to make.
attachmentORVB-0-v01a-20181101-1203.cpp - Attached On 2018-11-01 18:54:13 UTC - Size: 5.24 KB - 298 views
[2018-11-01 20:23:33]
Marmany - Posts: 303
if (NightlyVolumes == 5 - 1) looks like a typo
[2018-11-01 20:39:40]
Yoda - Posts: 106
Quote:
if (NightlyVolumes == 5 - 1) looks like a typo

You are correct, it should be:

if (NightlyVolumes == 4)


Unfortunately, the change doesn't resolve the issue.

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

Login

Login Page - Create Account