Is there a way of referencing another user-defined study in a user-defined study


  • Questions
  • Chart Studies
  • [RESOLVED] Is there a way of referencing another user-defined study in a user-defined study
Category:
0
0

I assume not, but I need confirmation since you can in the Conditional Wizard TS Editor

These  coded lines seem to work in referencing studies- all using TOS proprietary studies.

 

def   Varb = SimpleMovngAvg(close,34)> 0;  # works fine

def   VarA= PPS().buysignal==1;

 

 

but if I use the same type syntax  on my own studies it does not work in another study.

Though strangely this syntax works with my own studies  in the Condition Wizard Think Script Editor.  

Let say I had created a study and gave it the   study name

“MyStudy” and  it has  input called length set at default 10, and plot varialble name pvar

Why does

Def  varx=MyStudy(12).pvar==0;       not work in the StudyThinkScript Editor?  or anything like it with  the word reference and  quotes around the  plot variable but work in the Conditonal Wizard ThinkScript Editor?

 

 

RESOLVED
Marked as spam
Posted by (Questions: 13, Answers: 18)
Asked on January 22, 2018 1:03 pm
3099 views
0
Private answer

I cannot explain why it doesn’t work for a custom chart study. I never use it for user defined studies so I never knew it couldn’t be done. Until you brought it up, I would have guessed it was certainly possible. But at least I can tell you it doesn’t work for me. And I tried all the tricks I know.

Perhaps I have another solution to what you are trying to achieve?

If you are trying to avoid duplicating code within a script, by constructing a sub script you call repeatedly from other lines in the study, there is a way.

http://toslc.thinkorswim.com/center/reference/thinkScript/Reserved-Words/script.html

If you are trying to create pseudo “external functions” to reduce the number of lines in your script, probably not.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on January 22, 2018 3:31 pm