Login Page - Create Account

Support Board


Date/Time: Thu, 09 May 2024 22:56:59 +0000



ACSIL: ISSUES POSSIBLE BUGS AND SUGGESTIONS

View Count: 1709

[2014-09-25 00:20:24]
Johnny - Posts: 99

Hi, I would like to point out some issues regarding ACSIL.


First, I am creating a custom study and the basic chart has a 5 minute timeframe but I want to calculate price data from other timeframes as well, primarily from the 10 minute timeframe. So I use the sc.GetChartBaseData() function and the sc.GetNearestMatchForSCDateTime() to get the 10M index that corresponds to the date of the 5M index of my basic chart. In order to see whether the data are correct I have set markers to be drawn at the indexes of the 5M chart if the high of the current 10M bar is greater than the high of the previous one. However, even though the markers are drawn they don't seem to correspond correctly to the conditions. For example, if the high of the 10M bar with start time 16:10 is higher than the high of the 10M bar with start time 16:00 I should get two markers under the 16:10 and 16:15 5M bars, the two 5M bars that are contained within the 10M bar. However, there are many cases where the marker is displayed only for the first or second 5M bar and not for both of them like it should. Moreover, there are cases where the marker is drawn at one of the two 5M bars within the 10M bar even though the condition is not met.

There's only one way to get it to work, to calculate the 10M bar index only when the minute of the 5M bar is 0, 10, 20, 30, 40, 50, taking into consideration only the first 5M bar that is contained within the 10M bar and not the second one. So the code is:

if(sc.BaseDateTimeIn[sc.Index].GetMinute() == 0 or sc.BaseDateTimeIn[sc.Index].GetMinute() == 10 or sc.BaseDateTimeIn[sc.Index].GetMinute() == 20 or sc.BaseDateTimeIn[sc.Index].GetMinute() == 30 or sc.BaseDateTimeIn[sc.Index].GetMinute() == 40 or sc.BaseDateTimeIn[sc.Index].GetMinute() == 50)
Index10M = sc.GetNearestMatchForSCDateTime(sc.ChartNumber, DateTime);

It worked that way but my question is shouldn't you be able to get the corresponding index from a different timeframe just by using the sc.GetNearestMatchForSCDateTime() or sc.GetNearestMatchForDateTimeIndex() functions like the ACSIL documentation suggests?


Second, there seems to be a problem when ACSIL handles floating-point numbers. I have set a marker to be drawn if the high of the current bar equals a certain floating-point number like 1116.2. But the marker is never drawn even though the condition is met. Only when I change the condition to "if(High[sc.Index] >= 1116.2)" or when I use an integer "if(High[sc.Index] == 1116)" the marker is displayed. Apart from that, how does ACSIL handle floatimg point-numbers in general? For example, if I want to calculate the 0.618 range of a bar "0.618 * (High[Index] - Low[Index])" and the exact number is 0.0927 will ACSIL round the number or leave it as it is?

ACSIL provides functions to round a number but only to the nearest integer or increment. So, if you want to round the number 2.3 and use the sc.Round() and sc.RoundToTickSize() (with an increment of .25) functions the result will be 2 and 2.5 respectively. But it would be better if there were functions like "sc.RoundUp()" to round a number to the nearest higher integer, which is 3 in the case of 2.3 and "sc.RoundDown()" to round a number to the nearest lower integer. This also applies to "sc.RoundToTickSize()", you could add functions like "sc.RoundUpToTickSize()" and "sc.RoundDownToTickSize()" in order to round a floating-point number to the nearest higher and lower increment respectively.


Third, correct me if I'm wrong but ACSIL doesn't provide a print option. It would be a lot better if this option was available, it would make it easier to perform certain checks and see if things are running properly. Also, the arrow drawing doesn't seem to work. I use the following code which doesn't give any compiler errors:
s_UseTool ArrowUp;
ArrowUp.Region = 0;
ArrowUp.ChartNumber = sc.ChartNumber;
ArrowUp.DrawingType = DRAWING_ARROW;
ArrowUp.MarkerType = MARKER_ARROWUP;
ArrowUp.MarkerSize = 7;
ArrowUp.BeginIndex = sc.Index;
ArrowUp.BeginValue = sc.Low[sc.Index];
ArrowUp.Color = RGB(0,200,200);

if(Condition) sc.UseTool(ArrrowUp);


Finally, I believe that there should be a sticky thread dedicated to ACSIL where sierrachart users more experienced in C++ and ACSIL could help others less experienced, especially since you don't provide programming help.
[2014-09-25 02:34:13]
Sierra Chart Engineering - Posts: 104368
1. You need to get a containing match. Not nearest. Refer to the available functions here:
http://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Functions.html

2. You need to learn about floating-point calculation error. There is a Wikipedia article about this.

3. You can use the ceil and floor C++ functions. Or create your own rounding functions.

4. This is wrong:

ArrowUp.DrawingType = DRAWING_ARROW;
ArrowUp.MarkerType = MARKER_ARROWUP;

An arrow requires two points and MarkerType is not relevant for DRAWING_ARROW.
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: 2014-09-30 22:44:38
[2014-09-30 22:27:19]
Johnny - Posts: 99

Will you consider adding a print option and arrows that don't require two points in order to be drawn and look like those in the attached image?
imageAUD-JPY.png / V - Attached On 2014-09-30 22:22:11 UTC - Size: 130.78 KB - 309 views
[2014-09-30 22:49:55]
Sierra Chart Engineering - Posts: 104368
This exists and we will put together a code example for you.
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
[2014-10-03 00:05:28]
Sierra Chart Engineering - Posts: 104368
Here is the code example we promised:

SCSFExport scsf_MarkerToolExample(SCStudyInterfaceRef sc)
{
  // Set configuration variables

  if (sc.SetDefaults)
  {
    sc.GraphName = "Marker Tool Example";

    sc.StudyDescription = "";

    sc.GraphRegion = 0;

    sc.FreeDLL = 0;

    sc.AutoLoop = 0; //No automatically looping

    return;
  }


  // Do data processing  
  for (int BarIndex = sc.UpdateStartIndex; BarIndex < sc.ArraySize - 1; BarIndex++)
  {
    if(BarIndex % 5)
      continue;

    s_UseTool Tool;

    Tool.ChartNumber = sc.ChartNumber;
    //Tool.LineNumber will be automatically set. No need to set this.
    Tool.DrawingType = DRAWING_MARKER;
    Tool.BeginIndex = BarIndex;
    if(BarIndex % 10 == 0)
    {

      Tool.MarkerType = MARKER_ARROWUP;

      Tool.BeginValue = sc.Low[BarIndex];
    }
    else
    {
      Tool.MarkerType = MARKER_ARROWDOWN;

      Tool.BeginValue = sc.High[BarIndex];
    }

    Tool.Region = 0;
    Tool.Color = RGB(255, 255, 0);
    Tool.MarkerSize = 8;
    Tool.LineWidth = 5;
    Tool.AddMethod = UTAM_ADD_ALWAYS;

    sc.UseTool(Tool); // Here we make the function call to add the marker
  }
}

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-06-07 19:21:01]
skelcap - Posts: 139
In the example, is there an easy way to make the tip of the arrow point exactly to the high/low of the bar? It seems the default behavior is for the middle of the arrow to lie on the BeginValue. I tried setting Tool.DrawFromEnd = 1 but that didn't seem to do anything.
[2016-06-08 18:16:49]
Sierra Chart Engineering - Posts: 104368
Refer to the answer here:
How to make MARKER_ARROWUP point to bottom of bar?
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