Script Problems

StrataSearch has many powerful features, with many techniques and approaches to explore. Here we discuss the things we've done, and the things we'd like to do.

Script Problems

Postby thechartist13 » Mon Jun 09, 2014 8:23 pm

I'm trying to write a script to quantify the number of stocks with basic trends in an index but for some reason or another it's not returning any values. Any Thoughts? Thanks!

MedianTrend()
days = parameter("Days");
MedianTrend = 100 * numsymbols("S&P 500 Index", mov(close,days,simple)> (low(low,days)+ ((high(high,days)-low(low,days))/2))) / totsymbols("S&P 500 Index")
thechartist13
 
Posts: 22
Joined: Mon Oct 18, 2010 7:18 pm

Re: Script Problems

Postby Overload » Tue Jun 10, 2014 10:02 am

You can try running the File > Rebuild Sector Indexes menu, which may help. But I was actually getting an error when I tried to add your custom formula. There may be an issue when placing numsymbols() formulas within a custom formula. I will look into that. But for now, the other option would be to use your formula without the use of a custom formula. I tried this and it worked fine. And fortunately it's a relatively small script.

Pete
Overload
 
Posts: 2248
Joined: Wed Nov 30, 2005 12:14 pm

Re: Script Problems

Postby thechartist13 » Wed Jun 11, 2014 4:47 pm

Thanks Pete,

I don't think it has to do with the numsymbols() in script because I've written other scripts with the numsymbols() command that include user parameters and I've never received this issue before. I haven't updated my software however so perhaps this is causing the issue?

Thanks for all your help as always!

Joe
thechartist13
 
Posts: 22
Joined: Mon Oct 18, 2010 7:18 pm

Re: Script Problems

Postby Overload » Thu Jun 12, 2014 9:50 am

I did some additional tests on this, and I do believe the issue is that you cannot use variables in the numsymbols() formulas within scripts. It allows you to enter them, but then gives and error when running the script. If you're using an older version of StrataSearch, it might be the case that you're not seeing that error. But I'm pretty confident that this is the issue you're running into.

As mentioned, you can run the numsymbols() formula outside of the script and it seems to work fine. Or you could of course hardcode your "days" value, but that probably defeats the purpose of having the script.

Pete
Overload
 
Posts: 2248
Joined: Wed Nov 30, 2005 12:14 pm

Re: Script Problems

Postby thechartist13 » Thu Jun 12, 2014 6:41 pm

As always, thanks for your continued support!
thechartist13
 
Posts: 22
Joined: Mon Oct 18, 2010 7:18 pm


Return to General Discussion

cron