Support Board
Date/Time: Tue, 04 Feb 2025 09:48:03 +0000
[Programming Help] - Plot All Time High / Low
View Count: 1985
[2020-01-08 10:51:24] |
Cavalry3162 - Posts: 523 |
SC, what could i use to determine the all time high/low of an instrument? i am aware of "Highest High over N bars" but does that makes sense to add it and put like 99999999999999999 into the number of bars? |
[2020-01-08 22:14:12] |
Ackin - Posts: 1865 |
put like 99999999999999999 into the number of bars?
:)Hi Andreas, you can download this: Study: All Time High Highest High / Lowest Low - The study counts from the first index on the chart contact link: https://www.sierrachart.com/UserControlPanel.php?page=StudyStore&SCDLLName=zyp_download_free |
[2020-01-09 16:40:41] |
T44 - Posts: 363 |
I load a historical daily chart (programmatically with ACSIL) and iterate through around 5000 days of historical data. As this isn't efficient, I've taken to hard coding the values into a study and checking if those levels have been exceeded in the last 52 days. This means I only need to update my hard coded numbers once per year. If you're familiar enough with ACSIL / C++ to compile and run something I could post some code examples for you? |
[2020-01-09 18:48:55] |
Cavalry3162 - Posts: 523 |
Ackin, i have the free bundle but i cant find it there...? T44, compilation is no issue, would appreciate the code sample. thanks guys, Andreas |
[2020-01-09 18:53:09] |
Marmany - Posts: 308 |
An even simpler way to detect this is to set up an alert on a Daily Chart or Weekly Chart (this may be minimised) e.g. Chart Settings/ Alerts / Alert Condition =C>123456... ( i.e. Current all time high) Select an Alert Sound and tick the other boxes as required. When the high is broken adjust the formula. |
[2020-01-09 18:57:22] |
Cavalry3162 - Posts: 523 |
Marmany, thing is, i want to determine the current all time high with this.. and i am known for being lazy, so i want SC to actually show me the ATH |
[2020-01-09 19:14:25] |
Ackin - Posts: 1865 |
Ackin, i have the free bundle but i cant find it there...?
update is sometimes several times a day, do you really have the latest version? :) Date Time Of Last Edit: 2020-01-09 19:18:36
|
update.png / V - Attached On 2020-01-09 19:18:31 UTC - Size: 59.79 KB - 354 views |
[2020-01-09 19:23:12] |
Cavalry3162 - Posts: 523 |
i have the one distributed via sc.. i think its v1931? have already shut everything down..
|
[2020-01-09 19:32:22] |
Ackin - Posts: 1865 |
Andreas sorry, via SC is not up-to-date (Everyone has a different version of sierrachart, it is not possible to ensure the functioning of everyone, so I prefer to update the forum, everyone chooses according to their version).There are over 200 studies on the forum, download update file there ... Thanks to the great work of the Sierra team (request for the Summary window) will be created a very large number of new studies from multiple timeframes and more ;) .... will be created very soon ...... Login to the forum for the latest update ... Date Time Of Last Edit: 2020-01-09 19:46:22
|
[2020-01-09 19:48:59] |
Ackin - Posts: 1865 |
An even simpler way to detect this is to set up an alert on a Daily Chart or Weekly Chart (this may be minimised)
e.g. Chart Settings/ Alerts / Alert Condition =C>123456... ( i.e. Current all time high) Select an Alert Sound and tick the other boxes as required. When the high is broken adjust the formula. Marmany) Very nice... New for me ...thanks |
[2020-01-10 10:49:52] |
T44 - Posts: 363 |
Hello Ackin, Thanks for your help here, some of your studies look interesting. I see that unfortunately you do not provide source code. Would you consider doing so, perhaps as a paid option? I do not think that any serious trader is going to run third party code on a trading platform which could have the ability e.g. to enter / modify orders, without being able to see for themselves what the code does before installing it. If you're asking people to trust you to install software which has direct access to their trading platform, what accountability have you put in place to justify that trust? Andreas, I'm running something similar to: s_ACSOpenChartParameters OpenChartParameters; OpenChartParameters.PriorChartNumber = ChartNumber; OpenChartParameters.ChartDataType = DAILY_DATA; OpenChartParameters.Symbol = sc.GetRealTimeSymbol(); OpenChartParameters.DaysToLoad = 5040; //approx 20 years OpenChartParameters.ContinuousFuturesContractOption = CFCO_DATE_RULE_ROLLOVER_BACK_ADJUSTED; OpenChartParameters.HideNewChart = 1; //we don't display the chart just reference its data ChartNumber = sc.OpenChartOrGetChartReference(OpenChartParameters); if (ChartNumber != 0) { SCGraphData ReferenceChartData; // Get the arrays from the reference chart sc.GetChartBaseData(ChartNumber, ReferenceChartData); if (ReferenceChartData[SC_LOW].GetArraySize() == 0) return; // The array is empty int ArraySize = 0; int LastIndex = sc.ArraySize - 1; ArraySize = sc.GetNearestMatchForSCDateTime(ChartNumber, CurrentDateTime); ArraySize = ArraySize-1; float ATH; for (int j = 0; j < ArraySize+1; j++) { if (ReferenceChartData[SC_HIGH][j] > ATH) ATH=ReferenceChartData[SC_HIGH][j]; } Date Time Of Last Edit: 2020-01-10 10:53:47
|
[2020-01-10 11:11:45] |
User907968 - Posts: 825 |
Instead of iterating through the arrays, did you consider using sc.GetHighest & sc.GetLowest? sc.GetHighest() sc.GetLowest() |
[2020-01-10 15:14:45] |
Ackin - Posts: 1865 |
T44) I do not think that any serious trader is going to run third party code on a trading platform which could have the ability e.g. to enter / modify orders, without being able to see for themselves what the code does before installing it.
:) Do you want a chef's recipe in your restaurant before you eat? I don't ... sometimes trust is needed, if not then there is a free choice of other software providers. Would you consider doing so, perhaps as a paid option?
What do you need to solve and I have it? Let's not talk about money.
|
[2020-01-10 15:23:40] |
Ackin - Posts: 1865 |
User907968)
Instead of iterating through the arrays, did you consider using sc.GetHighest & sc.GetLowest? Are you sure? Look at GetLowest INSIDE (sierrachart.h): float GetLowest(SCFloatArrayRef In, int Index, int Length)
sc.Lowest it will be same or maybe other way is sort of array and get last value...from view of time isn't big difference....
{ float Low = FLT_MAX; // Get the low starting at Index going back by Length in the In array for (int SrcIndex = Index; SrcIndex > Index - Length; --SrcIndex) { if (SrcIndex < 0 || SrcIndex >= In.GetArraySize()) continue; if (In[SrcIndex] < Low) Low = In[SrcIndex]; } return Low; } Date Time Of Last Edit: 2020-01-10 15:35:00
|
[2020-01-10 15:40:47] |
User907968 - Posts: 825 |
@Ackin Haha, good point. :-) I am lazy, if someone else already make a function I opt for using that. Date Time Of Last Edit: 2020-01-10 15:40:56
|
To post a message in this thread, you need to log in with your Sierra Chart account: