Login Page - Create Account

Support Board


Date/Time: Mon, 20 May 2024 17:01:41 +0000



Post From: ACSIL: ISSUES POSSIBLE BUGS AND SUGGESTIONS

[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.