Login Page - Create Account

Support Board


Date/Time: Sat, 27 Apr 2024 19:20:58 +0000



[Programming Help] - Totaling Volume using ACSIL During Replay Mode

View Count: 1007

[2018-11-04 09:25:04]
Yoda - Posts: 106
I'm creating an ASCIL study that sums volume between midnight and 08:30 a.m.

When I first apply the study to a chart (what I refer to as "non-replay mode"), it correctly calculates the volume.

However, it doesn't work during Accurate Trading System Back Test Replay Mode (with tick data).

Let's say we have a 15 min bar with 3 trades each with volume of 300 (for a total of 900 for the bar).

To retrieve the overnight volume I'm using:

NightlyVolumePersist += Volume[sc.Index];

In non-replay mode, Volume[sc.Index] pulls the volume of each candle (so 900 in the above example) and correctly assigns the 900 to NightlyVolumePersist.

However, in replay mode, Volume[sc.Index] is returning the following volume figures:

300
600
900

Therefore the NightlyVolumePersist variable is now showing total volume for the 15 min candle of 1,800 (300 + 600 + 900).

Can anybody help me and suggest code that I need to use that will work both in replay and non-replay mode?
[2018-11-05 21:55:51]
Yoda - Posts: 106
For those reading this post at a later date, I thought I would provide a quick update.

I've made a number of changes to the code, but I found a key change to get this to work was to replace:

NightlyVolumePersist += Volume[sc.Index];

with:

sc.CumulativeSummation(sc.BaseData[InputData.GetInputDataIndex()], Summation, sc.Index);

where InputData is a SCInputRef variable set to SC_VOLUME and Summation is a sc.Subgraph variable.
[2018-11-05 22:08:13]
User90125 - Posts: 715
Try

sc.CumulativeSummation(sc.Volume, Summation, sc.Index);

[2018-11-05 22:14:06]
Yoda - Posts: 106
thank you User212764, sorry I wasn't clear, but it is working with:

sc.CumulativeSummation(sc.BaseData[InputData.GetInputDataIndex()], Summation, sc.Index);

With your suggestion, you are hard coding sc.Volume whereas my method above makes it a setting that the user can change.

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

Login

Login Page - Create Account