OR/USA
Legendary /NQ Trader
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106
|
Referencing Pre-Defined Studies
thinkScript allows you to reference studies that are already available on the Charts tab in your code. You use the reference keyword to do this.
plot SMA = reference simplemovingavg;
or
plot SMA = simplemovingavg();
will plot a simple moving average with the default parameters of that study. So long as the study name is followed by parentheses, you don't need to include the word 'reference'. You can change the parameters of the study within reference by inputting them between parentheses.
plot SMA = simplemovingavg(price = volume, length = 20);
will plot a 20 day moving average of the volume. To see the input parameters of a particular study, click on that study in the 'Edit Studies' section of the Charts tab. You will see the available parameters listed in the study properties section.
By default, the first plot of a study is always referenced. However, you can specify the plot you want to reference, as well.
plot bear = reference ElderRay."BearPower"
plot bear = ElderRay(length = 6)."BearPower"
|