Login Page - Create Account

Support Board


Date/Time: Fri, 27 Sep 2024 07:33:53 +0000



Post From: Need advice on using ACSIL more efficiently...

[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 - 291 views
attachmentKustomStudiesOne_v2.cpp - Attached On 2016-02-07 19:22:54 UTC - Size: 2.18 KB - 346 views
imageThree_Bar_Setup_Normal.JPG / V - Attached On 2016-02-07 19:23:05 UTC - Size: 144.44 KB - 282 views
imageThree_Bar_Setup_Anomaly.JPG / V - Attached On 2016-02-07 19:23:14 UTC - Size: 138.72 KB - 295 views