Support Board
Date/Time: Mon, 23 Dec 2024 19:27:56 +0000
ACSIL: accessing the DailyChange (DChg)
View Count: 1546
[2015-10-02 07:23:10] |
User44052 - Posts: 34 |
At the top of every chart, SC displays the "Daily Change" (it shows in the chart's Region 1 as "DChg"). Is this variable accessible through ACSIL? If so, how? Thanks in advance. |
[2015-10-02 08:24:29] |
Sierra Chart Engineering - Posts: 104368 |
You can calculate this as follows: float DailyChange = sc.SymbolData->LastTradePrice - sc.SymbolData->SettlementPrice; 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 |
[2015-10-03 08:25:01] |
User44052 - Posts: 34 |
Hi. The solution given seems to work only when the market is open. Running my study today (on the weekend) seems to reference the very last SettlementPrice for the entire chart. I need to reference it dynamically, i.e. as it changes each day. Any thoughts? Date Time Of Last Edit: 2015-10-03 08:25:14
|
[2015-10-03 08:35:57] |
Sierra Chart Engineering - Posts: 104368 |
Therefore, you will want to use this function: sc.GetOHLCForDate Refer to the ACSIL Functions page for the details for this function. 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 |
[2015-10-05 22:01:31] |
User44052 - Posts: 34 |
Thanks for the suggestions. This is how I ended up doing this: float myDailyChange; float myOpen, myHigh, myLow; float previousDayClose; SCDateTime todaysDate = sc.BaseDateTimeIn[sc.Index].GetDate(); SCDateTime previousTradingDay; if (todaysDate.GetDayOfWeek() == MONDAY) { previousTradingDay = todaysDate - 3; } else { previousTradingDay = todaysDate - 1; } sc.GetOHLCForDate(previousTradingDay, myOpen, myHigh, myLow, previousDayClose); myDailyChange = sc.Close[sc.Index] - previousDayClose; |
[2015-10-06 02:48:58] |
ejtrader - Posts: 688 |
this code might not account for holidays. I think there should be a function for getting a valid trading day. |
[2015-10-06 19:31:23] |
User44052 - Posts: 34 |
You're absolutely right, ejtrader - thanks! And yes, I did find a built-in study (called "Period OHLC-Variable Period") which looks like it will work. Thanks again. |
To post a message in this thread, you need to log in with your Sierra Chart account: