assiParticipant
Senior
Hi ALL,
I am trying to understand the “CALL” function.
I read the documentation but didn’t how to use it in the code.
For example, I saw strategy that had 5 values but 6 parameters (rsi indicator) , also the number didn’t make sense:
value1, value2, value3, value4, value5 = CALL RSI (30, 0, 1, 100, 8, 10)(CLOSE)
What the coder means by that?
Thanks for any help.
Assi
The values are the returns of the indicator so if the last line of the indicator is:
return a,b,c,d,e
then value1 = a, value2 = b value3 = c etc
The parameters in brackets are the variables that the indicator needs. So for example an RSI indicator that just needs to know the period that it should be calculated on would just need one parameter. 14 for RSI[14] or 2 for RSI[2] for example.
The parameters are the adjustable variables that you would find in the indicator settings window in the order they are presented there.
assiParticipant
Senior
Got it!!
wow!! i really thank you.
If there are only 3 values and 5 parameters (none of them is zero), then the logic is that the first value always get the firs parameter?
If there are only 3 values and 5 parameters (none of them is zero), then the logic is that the first value always get the firs parameter?
I’m not sure that I understand what you are asking.
An indicator might have four adjustable parameters and return two values.
You call it with whatever parameter values you want to use and it returns the output of that indicator.
So if you have an indicator (called myIndicator) that is as follows with adjustable variables of p1, t1, p2, t2 in that order:
ave1 = average[p1,t1]
ave2 = average[p2,t2]
return ave1, ave2
Then you call it in your strategy using:
ave1, ave2 = CALL"myIndicator"[50,0,100,1](close)
That would retrieve the 50 period simple moving average and the 100 period exponential average and your strategy would then store those values as ave1 and ave2
assiParticipant
Senior
Thanks for the example, it’s clears the thing.
Thanks for your time.
Link to explanation added as Log 179 here …
Snippet Link Library
If I do this, when trying to save the code of my indicator, it will refuse to do it, based on the fact I have not defined the variables p1, t1, p2,t2. No ?
Define p1, t1, p2,t2 as 50,0,100,1 first then try.