Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 17:17:54 +0000



question about sc.Index

View Count: 1417

[2017-01-16 04:24:54]
User103949 - Posts: 78
Below is a screenshot of the code in one of the example provided by SC. ( studies5.cpp -- BidAndAskPrices study)
  // Do data processing
  if ( (sc.Index < sc.ArraySize -1) || sc.IsReplayRunning())
  {
    BidPrices[sc.Index] = sc.BaseData[SC_BID_PRICE][sc.Index];
    AskPrices[sc.Index] = sc.BaseData[SC_ASK_PRICE][sc.Index];
  }
  else
  {
    BidPrices[sc.Index] = sc.Bid;
    AskPrices[sc.Index] = sc.Ask;
  }

I have 2 questions.
1. Can sc.Index be greater or equal sc.ArraySize?
2. How does sc.Index behave in real time with autoloop? Does it increase by one each time new bar is added?
Date Time Of Last Edit: 2017-01-16 04:25:18
[2017-01-16 07:40:44]
Sierra Chart Engineering - Posts: 104368
1. No this would make no sense at all.

2. For an understanding, refer to:
Working with ACSIL Arrays and Understanding Looping: Automatic Looping/Iterating
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
[2017-01-16 16:15:24]
User103949 - Posts: 78
so the else condition from code above only happens when sc.index=sc.arraysize -1? What is the difference if i add equal sign inside if condition, ie if sc.index <=sc.arraysize-1 anx get rid of else section?
[2017-01-16 19:53:48]
Sierra Chart Engineering - Posts: 104368
We do not understand the purpose of the question.

You can certainly do what you want and obtain the result that you want.

So effectively you just want to run this code always:

BidPrices[sc.Index] = sc.BaseData[SC_BID_PRICE][sc.Index];
AskPrices[sc.Index] = sc.BaseData[SC_ASK_PRICE][sc.Index];

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
[2017-01-16 20:55:32]
User103949 - Posts: 78
so the code under else is redundant here?
[2017-01-17 03:10:47]
Sierra Chart Engineering - Posts: 104368
No. Refer to the documentation for the ACSIL members in question.
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
[2017-01-17 15:11:48]
User103949 - Posts: 78
I have read the document.

Simply my question is when the bar is in 1 tick level. Are the following two set of codes the same?

1. // Do data processing
if ( (sc.Index < sc.ArraySize -1) || sc.IsReplayRunning())
{
BidPrices[sc.Index] = sc.BaseData[SC_BID_PRICE][sc.Index];
AskPrices[sc.Index] = sc.BaseData[SC_ASK_PRICE][sc.Index];
}
else
{
BidPrices[sc.Index] = sc.Bid;
AskPrices[sc.Index] = sc.Ask;
}


2.
// Do data processing
if ( (sc.Index <= sc.ArraySize -1) || sc.IsReplayRunning())
{
BidPrices[sc.Index] = sc.BaseData[SC_BID_PRICE][sc.Index];
AskPrices[sc.Index] = sc.BaseData[SC_ASK_PRICE][sc.Index];
}
[2017-01-17 18:00:50]
Sierra Chart Engineering - Posts: 104368
No.

The following always provide the most recent Bid and Ask price even when trading is not occurring.
BidPrices[sc.Index] = sc.Bid;
AskPrices[sc.Index] = sc.Ask;

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

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

Login

Login Page - Create Account