Login Page - Create Account

Support Board


Date/Time: Mon, 06 May 2024 12:54:02 +0000



[Programming Help] - Chart bar Index

View Count: 1136

[2016-08-27 18:30:06]
User382358 - Posts: 2
I need to get the chart bar Index to count the no. of bars in the chart.
I see that sc.Index does not work.
Eg:
If (Buy) myIndex = sc.Index ;
If (EndBuy) no_of_bars = sc.Index - myIndex ;

sc.Index is auto incremented and points to current bar.
Is there a way to get the Index / count the no. of bars based on a condition ?
thanks
[2016-08-28 00:26:43]
Sierra Chart Engineering - Posts: 104368
What you are doing looks correct. Just make sure that myIndex is persistent between function calls:
ACSIL Programming Concepts: Global Variables
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
[2016-08-29 17:37:54]
User382358 - Posts: 2
I am not using any new functions other than calling standard study ( RSI, moving average, etc..).
I see that the values for no_of_bars remain zero when used.

int myIndex, no_of_bars;
If (Buy) myIndex = sc.Index ;
If (EndBuy) no_of_bars = sc.Index - myIndex ;

What is required here ?
thanks
[2016-08-29 19:02:10]
Sierra Chart Engineering - Posts: 104368
We do not provide programming help. You need to figure this out on your own because we do not provide programming help and what you are doing wrong is not clear from this code.

This page may be helpful:
Working with ACSIL Arrays and Understanding Looping
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-08-29 19:02:57

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

Login

Login Page - Create Account