Login Page - Create Account

Support Board


Date/Time: Sat, 12 Jul 2025 05:15:38 +0000



[Programming Help] - Speed of market

View Count: 2710

[2021-12-03 12:21:59]
Luchs - Posts: 23
I have realised, that the speed of the market is a very important factor in my trading strategy. Because: Once the market goes too fast, normally I stay out.

One could say, it is easy to recognize on the chart or in the T&S. But in some circumstances speed is quite subjective. And it depends also on the timeframe.

I'd like to have kind of an indicator, which shows me the speed (contracts by time/by price) as an objective value. And as a line with and MA so that I can follow the change over time. Or set alarms on specific levels.

I've seen the indicator T&S: Speed Trades (Histogram) by Zyp. I am sure, this indicator has it's advantages if used the right way, but it doesn't work that well with Renko chart. It blinks and moves and makes me nervous and brings no information at all.

Is there any other indicator or other easy way that can provide me with that information?
[2021-12-03 16:21:35]
John - SC Support - Posts: 40857
You can setup the Number of Trades per second per bar by doing the following:
- Add the Number of Trades study.
- Add the Spreadsheet Formula study and enter the following formula in the Formula Input:
=ID1.SG1 / (FRACTIME(BARDATETIME - BARENDDATETIME) * 86400 )

Where ID1 is the ID of the Number of Trades study (you may need to change this depending on your setup).

Refer to the following for the Number of Trades study:
Number of Trades

And refer to the following for the Spreadsheet Formula study:
Spreadsheet Formula

If you are wanting something else, this should give you a start to get there.

You can add a Moving Average to this by setting the "Based On" for the Moving Average to the Spreadsheet Formula. Refer to the following for the Based On setting:
Chart Studies: Settings and Inputs Tab >> Based On - Basing a Study on Another Study
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-05-16 13:38:55]
BenjFlame - Posts: 338
You can setup the Number of Trades per second per bar by doing the following:
- Add the Number of Trades study.
- Add the Spreadsheet Formula study and enter the following formula in the Formula Input:
=ID1.SG1 / (FRACTIME(BARDATETIME - BARENDDATETIME) * 86400 )

Would you have the same as ASCIL please?
[2023-05-16 15:17:03]
John - SC Support - Posts: 40857
We do not understand this last question. What are you asking?
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-05-16 17:03:20]
BenjFlame - Posts: 338
How to adapt this code to be used from ASCIL code?
[2023-05-16 20:10:22]
John - SC Support - Posts: 40857
We would have to spend the same time figuring that out as you would. This not something we can do.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2025-06-15 11:03:19]
User729516 - Posts: 17
Bumping up this post as this seems like what I want as well (want to look for 2000 volume in 3 seconds)

I'm attempting to represent in a style similar to the Large Volume Trade Indicator: Description

I did the following:

Added the Number of Trades study.

Added the Color Bar Based on Alert Condition

- Added the alert: AND(ID1.SG1 / (FRACTIME(BARDATETIME - BARENDDATETIME)) (I don't have the 86400 like you wrote in the post above because I want the seconds assuming I read up correctly)
- Set Input Data: Volume
- Set Subgraph > Color Bar to Transparent Circle

It doesn't seem to work. Please do advise.

Thanks!
[2025-06-15 16:02:54]
Sawtooth - Posts: 4238
want to look for 2000 volume in 3 seconds
The easiest way to do this is to add a 3 second chart to your chartbook, and use this formula on the Alerts tab of the Color Bar Based On Alert Condition study:
V>=2000

Another way is to add a 2000 volume chart to your chartbook and use this formula on the Alerts tab of the Color Bar Based On Alert Condition study:
=FRACTIME(BARENDDATETIME)-BARTIME<=3/86400

FYI:
- Volume is not the same as Number of Trades.
- FRACTIME(BARDATETIME) is the same as BARTIME. (The FRACTIME function removes the DATE from the DATETIME.)
- BARENDDATETIME is the bar's last update DATETIME, so this value increments as the current bar forms, but is the bar's end DATETIME in previous bars.
- BARDATE, BARTIME, BARDATETIME, and BARENDDATETIME all use the SCDateTime format, where the integer is the number of days since 1/1/1900, and the decimal value is the portion of the day.
- There are 86400 seconds in 24hours, so 3/86400 is equal to 3 seconds in SCDateTime format.
Date Time Of Last Edit: 2025-06-15 18:48:21
[2025-06-18 09:18:48]
User729516 - Posts: 17
Apologies for the late reply!

Thank you for the quick breakdown of the formula (I actually had to reread the last bit on 3/86400 37 times).

The 2 ways you mentioned are sadly in another chart which cannot be referenced on my 5 min candles.

Hence, why I tried to do this:

Added the Number of Trades study.

Added the Color Bar Based on Alert Condition

- Added the alert: AND(ID1.SG1 / (FRACTIME(BARDATETIME - BARENDDATETIME)) (I don't have the 86400 like you wrote in the post above because I want the seconds assuming I read up correctly)



Since you said BARENDDATETIME is not only the close time of the bar but also the last updated time every millisecond, I suspect this'll work:

1. Add Number of Trades study. (Refer to this as ID1.SG1)
2. Add Color Bar Based on Alert Condition and put in this formula: AND(FRACTIME(BARENDDATETIME)-BARTIME<=3/86400, ID1.SG1>=2000)

I have not tried this yet so I'll update once I do so!
[2025-06-18 12:57:05]
Sawtooth - Posts: 4238
Your formula, on a 5 min chart...
=AND(FRACTIME(BARENDDATETIME)-BARTIME<=3/86400, ID1.SG1>=2000)
...can only be TRUE in the first 3 seconds of only the current 5 min bar.

So you could only get an alert once every 5 min, at the most.

FYI, you don't need to add the Number of Trades study, unless you want to see a display of its value:
=AND(FRACTIME(BARENDDATETIME)-BARTIME<=3/86400, NT>=2000)
Study/Chart Alerts And Scanning: Available Main Price Graph Identifiers/Variables

The 2 ways you mentioned are sadly in another chart which cannot be referenced on my 5 min candles.
Try this:
- Add a Number of Trades per Bar chart, set to 2000 trades.
- Add the Color Bar Based On Alert Condition study, using this formula on the Alerts tab:
=FRACTIME(BARENDDATETIME)-BARTIME<=3/86400)
- On the 5 min chart, add the Study/Price Overlay study, referencing the Color bar study on Number of Trade per Bar chart.

This can alert multiple times, in only the current 5 min bar.
Previous bars will show where it was TRUE when the bar closed.
Date Time Of Last Edit: 2025-06-18 14:28:51
[2025-06-18 15:33:44]
User729516 - Posts: 17
I wrongfully said 2000 trades, I meant 2000 volume for which V identifier/Volume Chart is available so all good.

I guess I will try this but with volume chart
Try this:
- Add a Number of Trades per Bar chart, set to 2000 trades.
- Add the Color Bar Based On Alert Condition study, using this formula on the Alerts tab:
=FRACTIME(BARENDDATETIME)-BARTIME<=3/86400)
- On the 5 min chart, add the Study/Price Overlay study, referencing the Color bar study on Number of Trade per Bar chart.


Just to confirm is there any way sort of function that does this (pseudocode):
AND(FRACTIME(BARENDDATETIME)-BARTIME<=3/86400 OR (>3/86400 AND <=6/86400) OR (>6/86400 AND <=9/86400) ... OR (>297/86400 AND <=300/86400) , NT>=2000)

The reason why I'm trying to go for this is because I can use Color Bar Based on Color Bar Based on Alert Condition: Input Data > Volume to show where the 2000 volume exactly happened in the candle similar to Large Volume Trade Indicator: Description
[2025-06-18 19:38:37]
Sawtooth - Posts: 4238
Just to confirm is there any way sort of function that does this (pseudocode):
In a word, no.
There is no way to reset the volume count every 3 seconds within a bar.

I can use Color Bar Based on Color Bar Based on Alert Condition: Input Data > Volume to show where the 2000 volume exactly happened in the candle
There is no way the Color bar study can show what happened intrabar, even with the Input Data setting.

In both situations, you would need to create a custom ACSIL study to historically reveal any intrabar events/values.

Native studies that might get close to what you need:
Large Volume Trade Indicator
Volume by Price
Numbers Bars

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

Login

Login Page - Create Account