Login Page - Create Account

Support Board


Date/Time: Fri, 27 Sep 2024 07:26:18 +0000



Need advice on using ACSIL more efficiently...

View Count: 900

[2016-02-07 19:25:05]
BillyWinegardner - Posts: 2
In developing indicators et al. for Sierra Chart via ACSIL (C++) I have encountered a hurdle. I am trying to find the proper way to handle real-time updating of a study during replay of a chart and normal real-time updating of a chart (live).

Attached are two versions of the code. The first, KustomStudiesOne_v1.cpp, works correctly during replay, bar-based backtest, and real-time updating. Note that there are two copies or "blocks" of the same logic; one exists in the "... if (sc.IsFullRecalculation) { ... } ..." block and the other exists in the "... if (PriorArraySize < sc.ArraySize) { ... } ..." block. If I do not do this then during replay or live updating of a chart I have anomalies in drawings of the subgraphs. The second version of the code, KustomStudiesOne_v2.cpp, produces these anomalies. The anomaly comes from the fact that the custom study is being triggered for each tick and therefore setting the subgraph prematurely before allowing the candle to end. In other words, during evolution of the candle at one point it was a down retracement bar completing the requirements for a three-bar bullish setup (look closely at the volume setup that goes with it). This is why I need to explicitly wait for the candle to completely form first. However, in doing so the custom study is only updated in real-time or during a replay or a bar-based backtest. I also want it to find all of the setups on the history of the entirety of the loaded chart.

Basically what I need is this: the functionality of the first version of the code but without having to have two explicit copies of the same logic, viz., during reloading of a chart or when it has to recalculate find all of the setups in the chart historically as well as work properly in real-time updating. The first version of the code does this correctly, but I had to explicitly make two copies of the code, one to do it when the custom study is in "full recalculation mode" and the other during normal updating which explicitly checks if a new bar is forming before evaluating. There has to be a better way to do this.

I have also attached two charts to illustrate this.

By the way, thanks for such an awesome trading platform! I am looking forward to a more proper solution to this.
attachmentKustomStudiesOne_v1.cpp - Attached On 2016-02-07 19:22:50 UTC - Size: 3.45 KB - 290 views
attachmentKustomStudiesOne_v2.cpp - Attached On 2016-02-07 19:22:54 UTC - Size: 2.18 KB - 345 views
imageThree_Bar_Setup_Normal.JPG / V - Attached On 2016-02-07 19:23:05 UTC - Size: 144.44 KB - 281 views
imageThree_Bar_Setup_Anomaly.JPG / V - Attached On 2016-02-07 19:23:14 UTC - Size: 138.72 KB - 295 views
[2016-02-07 20:28:52]
BillyWinegardner - Posts: 2
Sierra Chart Engineering, do you think there is an easier way to do it?
[2016-02-08 09:29:26]
Sierra Chart Engineering - Posts: 104368
We do not provide programming help, so we cannot be studying all of this information and code.

However, after reviewing this, we think you should be using this function:
https://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Functions.html#scGetBarHasClosedStatus
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