Page 1 of 1

New indicator won't run in custom template

Posted: Mon Jan 18, 2021 8:28 am
by tomz
I am working on a custom template and have written a new indicator. The indicator compiles successfully and shows in My Scripts but it won't populate the output of my template. I created two new columns in my template, ran the ATR indicator in both and got output for each one. I then created a new indicator by saving ATR as ATR2 without changing any of the code (ATR2 shows in My Scripts). I put ATR2 in one of the columns. I got output from ATR but not from ATR2.

Is there some method to getting a template to recognize indicators from My Scripts.

Re: New indicator won't run in custom template

Posted: Mon Jan 18, 2021 11:31 am
by Chris White
Scripts in MyScripts need to be prefixed with "My." and scripts in the System Scans need to be prefixed with "Scan."

So, in your case the correct name would be:
My.ATR2

Re: New indicator won't run in custom template

Posted: Mon Jan 18, 2021 12:38 pm
by tomz
The ER editor won't let me use a period in the name. The error msg states that only alphanumerics and underscores are allowed.

I saved ATR2 as My_ATR2 and Scan_ATR2. Neither one puts out any data.

Re: New indicator won't run in custom template

Posted: Tue Jan 19, 2021 6:32 am
by Chris White
Sorry, I meant that in the Template you should reference the script by using "My.ATR2" instead of "ATR2".

The script name in the script file should not have a "My." in it. The "My." is a namespace applied when the script is compiled and allows you to have identically named scripts in MyScripts as in "SystemIndicators".

So, if you named your copy of ATR with the same name ATR, in your template you could refer to the System Indicators version of ATR using just ATR and your own version using My.ATR

Hope that makes sense.
Chris.

Re: New indicator won't run in custom template

Posted: Wed Jan 20, 2021 5:35 am
by tomz
That worked! Thanks