Login Page - Create Account

Support Board


Date/Time: Wed, 12 Feb 2025 01:38:20 +0000



[User Discussion] - Access to old Support Board

View Count: 811

[2020-09-28 23:04:15]
Kiwi - Posts: 375
Is this still possible? Can I please get a link.

One of your users is using an old function T1 from a dll kiwi_test around 2012

I can't find the old source but will have published it in the forum.
[2020-09-28 23:08:39]
Kiwi - Posts: 375
Actually its should be in kiwi12.cpp

kiwi custom study T1 is missing
[2020-09-29 04:12:22]
Ackin - Posts: 1865
Look:
Kiwi Resync Study - Memory leak? | Post: 174469
[2020-09-29 04:29:44]
Kiwi - Posts: 375
Found it in another thread ... I was looking for a study called T1 but TI was the graph name & the study was TInt.

Will fix a file to compile with Sierra Chart 2175 and publish here.
Date Time Of Last Edit: 2020-09-29 04:47:26
[2020-09-29 04:41:45]
Kiwi - Posts: 375
So I've attached the code file (.cpp) and the dll compiled with Sierra Chart 2175 here. I see I was in my 'compact is better' phase back in 2012.

The code was just:

#include "sierrachart.h"

SCDLLName("* Kiwi 12 Recovery *")

/*==========================================================================*/
SCSFExport scsf_RecalcChart(SCStudyInterfaceRef sc) {
if (sc.SetDefaults) {
sc.GraphName = "Recalc";
sc.StudyDescription = "Recalc Chart every x secs based on real time";
sc.Subgraph[0].Name = "Strobe";
sc.Subgraph[1].Name = "Time";
sc.Subgraph[0].DrawStyle=DRAWSTYLE_IGNORE;
sc.Subgraph[1].DrawStyle=DRAWSTYLE_IGNORE;
sc.Input[0].Name="Seconds between recalcs";
sc.Input[0].SetInt(60);
sc.Input[1].Name="Also reload chart data";
sc.Input[1].SetYesNo(0);
sc.UpdateAlways=1;
return;
}

if (sc.CurrentSystemDateTime.GetTime() % sc.Input[0].GetInt() == 0) {
if (sc.Subgraph[0][sc.ArraySize-1] < 999660) {
sc.Subgraph[0][sc.ArraySize-1] = 999666;
sc.Subgraph[1][sc.ArraySize-1] = sc.CurrentSystemDateTime.GetTime();
sc.FlagFullRecalculate = 1;
if (sc.Input[1].GetYesNo())
sc.FlagToReloadChartData = 1;
}
else
sc.Subgraph[0][sc.ArraySize-1] = 0;
}
}

/*==========================================================================*/
SCSFExport scsf_TInt(SCStudyGraphRef sc) {
if (sc.SetDefaults) {
sc.GraphName="TI";
sc.StudyDescription="Tick Interpretter";
sc.Subgraph[0].Name="TI+"; sc.Subgraph[0].DrawStyle = DRAWSTYLE_BAR;
sc.Subgraph[1].Name="TI-"; sc.Subgraph[1].DrawStyle = DRAWSTYLE_BAR;
sc.Subgraph[6].Name="Up Colour";
sc.Subgraph[7].Name="Dn Colour";
sc.Subgraph[8].Name="Neutral Colour";
sc.Input[2].Name="Cut Off 1"; sc.Input[2].SetInt(500);
sc.Input[3].Name="Cut Off 2"; sc.Input[3].SetInt(1100);
sc.DrawZeros=0;
return;
}

int& cutoff1 = sc.Input[2].IntValue;
int& cutoff2 = sc.Input[3].IntValue;
SCSubgraphRef value1 = sc.Subgraph[0], value2 = sc.Subgraph[1], answer = sc.Subgraph[5];

for ( int i=sc.UpdateStartIndex; i < sc.ArraySize; i++)
{
float medianprice = (sc.High[i] + sc.Low[i]) / 2;
answer[i] = 0;
if(sc.High[i] > cutoff1) answer[i] = answer[i] + (sc.High[i] - cutoff1);
if(medianprice > cutoff1) answer[i] = answer[i] + (medianprice - cutoff1);
if(sc.High[i] > cutoff2) answer[i] = answer[i] + 2.0*(sc.High[i] - cutoff2);
if(sc.Low[i] < -cutoff1) answer[i] = answer[i] - (-cutoff1 - sc.Low[i]);
if(medianprice < -cutoff1) answer[i] = answer[i] - (-cutoff1 - medianprice);
if(sc.Low[i] < -cutoff2) answer[i] = answer[i] - 2.0*(-cutoff2 - sc.Low[i]);

value1[i] = (answer[i-1] + 2.0*answer[i]) / 3.0;
//value2[i] = (answer[i-2] + 2.0*answer[i-1]) / 3.0;

if(value1[i] > 0)
sc.Subgraph[0].DataColor[i] = sc.Subgraph[1].DataColor[i] = sc.Subgraph[6].PrimaryColor;
else if(value1[i] < 0)
sc.Subgraph[0].DataColor[i] = sc.Subgraph[1].DataColor[i] = sc.Subgraph[7].PrimaryColor;
else
sc.Subgraph[0].DataColor[i] = sc.Subgraph[1].DataColor[i] = sc.Subgraph[8].PrimaryColor;
}
}


attachmentkiwi12_partial.cpp - Attached On 2020-09-29 04:40:18 UTC - Size: 3.28 KB - 324 views
attachmentkiwi12_partial_64.dll - Attached On 2020-09-29 04:40:42 UTC - Size: 897.5 KB - 316 views
[2020-10-01 09:29:18]
User90125 - Posts: 715
Thanks for this, Kiwi. And especially providing the updated raw .cpp source code as well :)

Now if I could only figure out how to make a study that automatically recalculates and/or reloads a chart when a Session Time boundary is crossed.....
[2020-10-01 12:01:02]
Kiwi - Posts: 375
Assuming you mean in real time ... something like this which is testing for start of day (if my functions are right).

/*==========================================================================*/

SCSFExport scsf_RecalcChartEOD(SCStudyInterfaceRef sc) {
if (sc.SetDefaults) {
sc.GraphName = "Recalc on Day";
sc.StudyDescription = "Recalc Chart every day";
sc.Subgraph[0].Name = "Strobe";
sc.Subgraph[1].Name = "Time";
sc.Subgraph[0].DrawStyle=DRAWSTYLE_IGNORE;
sc.Subgraph[1].DrawStyle=DRAWSTYLE_IGNORE;
sc.Input[0].Name="Seconds between recalcs";
sc.Input[0].SetInt(60);
sc.Input[1].Name="Also reload chart data";
sc.Input[1].SetYesNo(0);
sc.UpdateAlways=1;
return;
}

int signal_bar = -1;
for (int pos = 0; pos < sc.ArraySize; pos++) {
// only for last bar, then new day, then only once in the bar
if (pos == sc.ArraySize - 1) {
if (sc.BaseDateTimeIn[pos].GetDate() > sc.BaseDateTimeIn[pos-1].GetDate()) {
if (pos != signal_bar) {
sc.FlagFullRecalculate = 1;
signal_bar = pos;
}
}
else
signal_bar = -1;
}
}
}


[2020-10-02 00:08:19]
Kiwi - Posts: 375
I thought about it and that's not terribly good code. Here's a better version ... and the start of a new kiwi's stuff, kiwi_20. This one permits you to select 3 times (just duplicate a time or use an untraded time if you don't need 3). Modifying it should be easy if needed 🙂


SCSFExport scsf_RecalcChartAtTimes(SCStudyInterfaceRef sc)
{
if (sc.SetDefaults)
{
sc.GraphName = "RecalcAtTimes";
sc.StudyDescription = "Recalc At Specified Times";
sc.GraphRegion = 0;

sc.Subgraph[0].Name = "Strobe";
sc.Subgraph[1].Name = "dbg 0";
sc.Subgraph[0].DrawStyle = DRAWSTYLE_IGNORE;
sc.Subgraph[1].DrawStyle = DRAWSTYLE_IGNORE;

sc.Input[1].Name="Also reload chart data";
sc.Input[1].SetYesNo(0);
sc.Input[2].Name = "Time to Recalc";
sc.Input[2].ValueType = TIME_VALUE;
sc.Input[3].Name = "Time to Recalc";
sc.Input[3].ValueType = TIME_VALUE;
sc.Input[4].Name = "Time to Recalc";
sc.Input[4].ValueType = TIME_VALUE;
return;
}

int& bar_is_tested = sc.GetPersistentIntFast(0);

// This will test if this bar has been checked and if not
// it will test if the bar includes one of the times
// and if it does: recalculate and reload if chosen

if (sc.ArraySize != bar_is_tested)
{
bar_is_tested = sc.ArraySize;
int this_ = sc.BaseDateTimeIn[sc.ArraySize-1].GetTime();
int next_ = sc.BaseDateTimeIn[sc.ArraySize-1].GetTime() + sc.SecondsPerBar;

if ((sc.Input[2].GetTime() >= this_ && sc.Input[2].GetTime() < next_) ||
(sc.Input[3].GetTime() >= this_ && sc.Input[3].GetTime() < next_) ||
(sc.Input[4].GetTime() >= this_ && sc.Input[4].GetTime() < next_))
{
sc.Subgraph[0][sc.ArraySize-1] = this_;
sc.FlagFullRecalculate = 1;
if (sc.Input[1].GetYesNo())
sc.FlagToReloadChartData = 1;
}
}
}

attachmentkiwi_20.cpp - Attached On 2020-10-02 00:07:44 UTC - Size: 1.69 KB - 309 views
attachmentkiwi_20_64.dll - Attached On 2020-10-02 00:08:07 UTC - Size: 891 KB - 321 views

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

Login

Login Page - Create Account