pcex.antiuno
New member
Hi Everyone, I'm learning to use ThinkScript and I have a question.
Here is the thing, I made a script in a study with many variables like this (is just an example):
and I use It forward like this:
My question is: Every time I call TestScript(something).someVariable; script calculations are made them again?
Is there a way to call the script just once ? Someway like this (I try it and doesnt work):
I hope someone can help me.
EDIT: I wrote wrong the tittle. Is "Question about scripts references"
Here is the thing, I made a script in a study with many variables like this (is just an example):
Code:
script TestScript{
input num = 5;
def Var1 = num + 1;
def Var2 = num + 2;
plot Var3 = Var1 + Var2;
}
and I use It forward like this:
Code:
def testNumber1 = 20;
def testNumber2 = 30;
def test11 = TestScript(testNumber1).Var1;
def test12 = TestScript(testNumber1).Var2;
plot test13 = TestScript(testNumber1).Var3;
def test21 = TestScript(testNumber2).Var1;
def test22 = TestScript(testNumber2).Var2;
plot test23 = TestScript(testNumber2).Var3;
My question is: Every time I call TestScript(something).someVariable; script calculations are made them again?
Is there a way to call the script just once ? Someway like this (I try it and doesnt work):
Code:
def testScript1 = TestScript(testNumber1);
def test11 = testScript1.Var1;
def test12 = testScript1.Var2;
plot test13 = testScript1.Var3;
def testScript2 = TestScript(testNumber2);
def test21 = testScript2.Var1;
def test22 = testScript2.Var2;
plot test23 = testScript2.Var3;
I hope someone can help me.
EDIT: I wrote wrong the tittle. Is "Question about scripts references"