Will a user-defined Study work in a Strategy?


Category:
0
0

Hi Pete, thanks for the superb videos. I’m having difficulty with a strategy that calls a user-defined study. An error is being generated. I searched the Q&A forum and found in the thread <https://www.hahn-tech.com/ans/custom-rsi-study/> that you seem to indicate that strategies support user-defined studies, but I may have misunderstood. The study script is below. Any assistance is greatly appreciated. Thanks in advance.

Attachments:
Marked as spam
Posted by (Questions: 4, Answers: 6)
Asked on May 11, 2020 12:59 pm
143 views
0
Sorry, I should have added more context. I used the strategy that you shared through the Thinkorswim Strategy Guide video called "Strat_PivotRev_SlowDRevSTRATEGY.ts" as a template to build my own strategy. From the strategy: #the user-defined study generates error def LowInflect = QuadratiXA().crossinglow; def LowInflect2 = reference QuadratiXA(60, 10, 1, 5).crossinglow; #the standard study works fine def SlowD2 = StochasticFull().FullD; def SlowD = reference StochasticFull(80,20,KPeriod,DPeriod,priceH,priceL,priceC,2,averageType).FullD;
( at May 11, 2020 1:30 pm)
1
Private answer

It may be possible but in practice it is something I rarely do. There are several reasons.

  1. It does not work in all of the tools, such as Study Alert and Conditional Orders.
  2. A change in your custom chart study will immediately change the behavior everywhere that custom study is referenced. This can be handy, but it can also lead to disaster.
  3. Your code is less portable. You cannot easily move that to another account or share it with others because the original custom study will need to be installed first.

So even for the standard built-in chart studies, I rarely reference the study when building something new. Not for chart strategies, and not for chart studies, and especially not for the tool items listed in bullet point 1.

Having said that, I just posted a solution that did reference a built-in study:

https://www.hahn-tech.com/ans/woodiescci-cross-above-zero-after-new-30-day-low/

But I did that because the code from WoodiesCCI is very long and I wanted to present a very compact solution. The vast majority of code in the WoodiesCCI was not required for that solution. So I just grabbed the signal plot from that study that I needed. When building custom projects for clients, I avoid referencing other studies completely. Because I need to ensure the tools I build for clients can stand on their own and not be subject to being disabled by changes made to a built-in study, of which I have zero control.

So rather than answering you question directly I decided to share with you my "best practices" as a full time developer of Thinkorswim custom studies.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on May 11, 2020 3:56 pm