How can I set Scale, Data Range from inside a script?
Author: Carova
Creation Date: 4/29/2016 1:44 PM
profile picture

Carova

#1
I would like to ensure that all of the correct characteristics for a script are used each time, and the best way might be to set them from inside the script (especially when it is run by others).

How can I do that?

Vince
profile picture

Eugene

#2
You can't.

What you can do is get them (using GetDataRange and similar parameters in Community Components) and then compare it with some preset values, for example. As an alternative, save a properly configured Workspace and tell the others to load it.
profile picture

Carova

#3
Thanks Eugene!

Is there an equivalent to tell the appropriate Scale (Daily, Weekly, etc.)? I did not see it in Community Components.

Vince
profile picture

Eugene

#4
Vince, it's built-in. Check out Scale in the QuickRef.
profile picture

Carova

#5
But is that only when a Position has been established? How about before the script has generated any positions?

Vince
profile picture

Eugene

#6
Bars.Scale doesn't require a Position to be created. It's a property of the Bars object the strategy is being executed on.
profile picture

Carova

#7
Thanks for the clarification.

Vince