Setting Multiple V#'s to Zero

Login or Register

Please login or register in order to view and post in the Forum.

9 posts / 0 new
Last post
Yeti
Last seen: 2 weeks 2 days ago
Joined: 11/21/2021 - 09:25
Setting Multiple V#'s to Zero

I am using a series of V# variables that are bound to an indicator. When I reset the indicator, the previous V#'s are set to the last value of the previous indicator. Is there a way to set a series of v#'s to zero with a button click? Currently I am using a quote page displaying the v#'s. I can delete and tab though the quote page which accomplishes this but is cumbersome at best. Thank you for any assistance you can offer.

0
william-linn
Last seen: 1 day 16 hours ago
Joined: 06/03/2011 - 00:00
Setting Multiple V#'s to Zero

Step 1 is to create a signal and give it a name. Name it ResetVars for example. The signal will have a formula like this:

SET(V#33,0) AND SET(V#34,0) AND SET(V#35);

The formula can set any V# variables you wish with any value you wish, just connect each SET statement with the AND operator.

Step 2 is to create a Signal Action that will evaulate this signal. Use the Object Manager to create a new signal action, name it ResetVarSigAction, for example.

A signal action has many options. You could, for example, have ResetVarSigAction play a sound as audio confirmation that the action is being performed. The key thing however is to specify ResetVars as the confirming signal by checking that box in the signal action setup. What this means is that when the signal action ResetVarSigAction is executed the signal named ResetVars will be evaluated, thereby setting the V# variables per your signal formula.

Step 3, the final step, is to create a method for triggering the signal action using a mouse click. Add a Button to your chart. Set the purpose of the button to Execute Signal Action and select the name ResetVarSigAction as the signal action to be executed when the button is pressed. You can of course custom title the button and color code it if you wish.

When you click the button in the chart, the button executes the signal action named ResetVarSigAction which in turn will play a sound and evaluate the signal named ResetVars which will exeucte the SET statements in the formula for that signal. Note that the signal action is evaluated using the ticker symbol in the chart where the button resides.

You can use this technique to create buttons for setting V# variables or C# variables to a fixed value, or even some computed value. For example, if the signal has a formula such as SET(V#99, MA) then clicking a button to invoke the signal will compute the moving average and set V#99 to that value.

There are endless possibilies when chart Buttons are coupled with Signal Actions and Signals.  Here is the support article on linnsoft.com that details all the things you can do with a signal action:  https://www.linnsoft.com/techind/signal-action-setup

 

cpayne
Last seen: 1 year 8 months ago
Joined: 03/30/2009 - 00:00
Zero User Variables Function

Another approach, to do a full scale reset of all V# variables to zero....

There is a Function titled "Zero User Variables" (File > Functions > Zero User Variables).

You can then enter the symbol you'd like to set the V#s to zero, and it will set all V# variables for that symbol to zero.

You can also setup a Button with purpose "Execute Function" and type in the function "Zero User Variables".  This will zero all V# variables for all symbols in your system.

Yeti
Last seen: 2 weeks 2 days ago
Joined: 11/21/2021 - 09:25
thank you!

Gentlemen, you have outdone yourselves. Thank you much for your kind assistance! This will do nicely. Much appreciated!

william-linn
Last seen: 1 day 16 hours ago
Joined: 06/03/2011 - 00:00
Setting Multiple V#'s to Zero

The disadvantage of using a button setup with purpose Execute Function to invoke the function named Zero User Variables is that all user variables will be set to zero, not just the selected ones you wish to zero. The three step method described earlier is essential if you use a variety of user variables for other purposes to hold various values. If you do elect to use the Execute Function method, you have to be careful, since involking this function by default will initialize all user variables for all symbols to zero! When you execute the function manually, you specify the symbol in the functions window as shown above, but if you use a button to invoke the function, the symbol whose variables are to be initialized must be specified in the button setup by ending the function name with a colon, followed by the ticker, e.g.

Zero User Variables:@ES#   (will zero V#1...V#512 for @ES#)
Zero User Variables  (will zero all user variables for all symbols defined to Investor/RT)
Yeti
Last seen: 2 weeks 2 days ago
Joined: 11/21/2021 - 09:25
thank you!

This is the method that I chose. Your instructions and examples were easy to follow and made setting it up seamless. The other options are great to know as well! Thanks again!

cpayne
Last seen: 1 year 8 months ago
Joined: 03/30/2009 - 00:00
Zero User Variable - Button Improvements

In next release (15.1.9), if you setup your Button indicator as follows..

With the Function Name in format...

Zero User Variables:5-10

...where 5 is the starting variable number and 10 is the ending variable number, then pressing the button will set the values of V#5 thru V#10 to zero and will only do so for the symbol in the chart.

Yeti
Last seen: 2 weeks 2 days ago
Joined: 11/21/2021 - 09:25
That is awesome! Thanks for

That is awesome! Thanks for all the help! There is a reason IRT is the hands down the best platform out there. You guys rock!

william-linn
Last seen: 1 day 16 hours ago
Joined: 06/03/2011 - 00:00
Zero User Variable - Button Improvements

FYI, Investor/RT 15.1.9 with the button improvements is now generally available as an optional update at https://www.linnsoft.com/user/login?destination=download