Login Page - Create Account

Support Board


Date/Time: Sat, 28 Dec 2024 18:56:34 +0000



sc.NumberOfTrades /Message.Format() - strange behavior

View Count: 802

[2016-01-18 14:55:22]
User754985 - Posts: 109
I am using IB's True RT 5-sec bars which get delivered in SC as 4 trades (1=O, 2=H..) every 5-sec. So, a 1-min bar contains 48 trades (can be seen on a chart).

Now, the following code


SCSubgraphRef NT = sc.Subgraph[3];
if (sc.Defaults){
.....
sc.Autoloop=1
sc.UpdateAlways=0
}

if (sc.NumberOfTrades[i]==48)
{
  Message.Format("Number of Trades: %i", sc.NumberOfTrades[i]);
  sc.AddMessageToLog(Message,0);
        
  NT[i] = sc.NumberOfTrades[i];  
........
}

..produces this output:

Chart: EUR.JPY-CASH-IDEALPRO 1 Min #1 | Study: FADM Example | Number of Trades: 0 | 2016-01-18 09:53:00
Chart: EUR.JPY-CASH-IDEALPRO 1 Min #1 | Study: FADM Example | Number of Trades: 0 | 2016-01-18 09:53:00
Chart: EUR.JPY-CASH-IDEALPRO 1 Min #1 | Study: FADM Example | Number of Trades: 0 | 2016-01-18 09:53:00
Chart: EUR.JPY-CASH-IDEALPRO 1 Min #1 | Study: FADM Example | Number of Trades: 0 | 2016-01-18 09:53:00
Chart: EUR.JPY-CASH-IDEALPRO 1 Min #1 | Study: FADM Example | Number of Trades: 0 | 2016-01-18 09:53:01
Chart: EUR.JPY-CASH-IDEALPRO 1 Min #1 | Study: FADM Example | Number of Trades: 0 | 2016-01-18 09:53:01
Chart: EUR.JPY-CASH-IDEALPRO 1 Min #1 | Study: FADM Example | Number of Trades: 0 | 2016-01-18 09:53:01

1) Why would Message.Format() give a value of 0?

When applying a study to a chart, I can see it graphing and adding messages to the log only starting from the most recent bar, nothing for historical.
2) Why would it not show anything for historical bars? not even 0..

3) Does sc.AddMessageToLog only work for RT or replay bars?

Thanks.
Date Time Of Last Edit: 2016-01-18 15:03:13
[2016-01-18 19:26:26]
Sierra Chart Engineering - Posts: 104368
1. The Number of Trades Intraday file field is not supported with Interactive Brokers true real-time data. And if it were, the number of trades would be much higher because Sierra Chart would use the Number of Trades value transmitted from Interactive Brokers.

2, 3. We would think this would be obvious because you are not adding these messages at any point other than the most recent bar in your code.

The sc.AddMessageToLog function works any time you call it.

However, you have to be very careful with this function because if you call this function at every bar in the chart, there is going to be a huge flood of messages in the Message Log which can temporarily freeze Sierra Chart.
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
Date Time Of Last Edit: 2016-01-18 19:28:15
[2016-01-18 21:29:25]
User754985 - Posts: 109
1. Since i get messages to the log, then obviously sc.NumberOfTrades does evaluate to 48. Right?
Why would it print 0, immediately after being equal to 48 - that is the question!


2,3. My assumption was that - similar to other sc.BaseData[] - NumberOfTrades values do exist for each bar on a chart.

With Autoloop=1, when I load the chart, the study is called automatically on each bar..or is it not?

If the NumberofTrades values are non-existent - this would explain it... but then - how would (1) ever evaluate to 48??
On a chart, you can see that T changes by 4 every 5 sec; and so a 1min chart contains 48 "Trades".
[2016-01-19 03:22:01]
Sierra Chart Engineering - Posts: 104368
1. We do not provide code analysis. You need to answer this question because it is your code and you have compiled it and you are doing the testing. We have no idea about this.

2, 3. Refer to:
http://www.sierrachart.com/index.php?page=doc/doc_ACS_ArraysAndLooping.html


We do know that Sierra Chart does not use the Number of Trades value from the Interactive Brokers true real-time data. So if in the Number of Trades array in Sierra Chart, it contains nonzero values when using true real-time data, then that is Sierra Chart counting price updates.
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
Date Time Of Last Edit: 2016-01-19 03:22:40

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

Login

Login Page - Create Account