Click here to Login





                                                   SCRIPT: Set current symbol as your benchmark!

  0

0
Josh McCormick
2020-09-10 12:48:18


Below is a script that sets the currently active symbol as your reference benchmark symbol. You can then recall your reference benchmark in any of your formulas and use it however you like. The script is designed to be bound to a hotkey. I, myself, use SHIFT-CONTROL-R. (Hotkeys are assigned by going to the bottom of the screen, selecting Divers, and then List of Shortcuts.) It requires you to download the GetVariable Multiple Usage technical indicator so that you can retrieve the benchmark symbol and use it in your formulas.

I personally have a pane that compares the currently active symbol against my benchmark symbol. So if I haven't done so already, I pull up my benchmark symbol in QuantShare. I hit Shift-Control-R to set it as my benchmark. Then I load whatever symbol(s) I want to compare it to, and my formula remembers which symbol I set my benchmark to. So once you've got all of this configured, it is pretty simple to use. But this probably isn't for novice users. If I end up making an enhanced version of this script, it would be to make the benchmark symbol persistent so that it is saved and then automatically recalled each time you restart QuantShare.

EXAMPLE USE IN A FORMULA:

benchmark=GetVariable("Benchmark");
// If the string is blank (which happens each time QuantShare restarts), set "SPY" as the default.
benchmark=iffstr(!StringContains("",benchmark),benchmark,"SPY");
benchclose = iff(IsEod()==0,0,getseries(benchmark,close,LastData));
plot (benchclose,benchmark,colorGreen,ChartLine,StyleOwnScale1|StyleWidth5|StyleHideValues);

SETBENCHMARK SCRIPT v1.0 IS AS FOLLOWS:

string keyword="Benchmark";
string symbol="";
Chart mychart = Charts.GetSelectedChart();
symbol=mychart.SymbolName;
Global.SetVariable(keyword,symbol);
Chart[] charts = Charts.GetAllCharts();
for(int i=0;i < charts.Length;i++) charts[i].Update();

Enjoy. Let me know if you have any questions/comments/issues/improvements.

EDIT: An earlier version of this document recommended using Shift-Control-B. That turned out to be a bad choice because it also brings up the Dividend adjustment screen which is launched with Control-B.





GetVariable Multiple Usage (by Josh McCormick, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item

Seeker
2020-09-12 12:22:45

  1

Very userful. Plotting a relative ratio has become easy with this with a key stroke than typing in the benchmark symbol name.


No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Symbol Information on Chart
Watchlists on Your Chart
Equity Data to Ticker Symbol
Formula & Symbol Switcher
Per Symbol Average Output

How-to Lessons
How to optimize an indicator in your trading system
How to import your own list of stocks/symbols
How to quickly add a ticker symbol
How to quickly download the most recent EOD data for your stocks
How to set order type of a trading system programmatically

Related Forum Threads
Enhancement Request: add current symbol to symbol filter
Can you share your main (candlestick chart) formula? Here's mine!
SCRIPT: Stock Price Autodownloader v1.0
How to trade one symbol based on indicators of another?
Selecting a Symbol

Blog Posts
Backtesting Your Trading Systems: Symbol Segmentation
Update Chart Layout based on Active Ticker Symbol
How to Adjust the Time Displayed in your Intraday Charts
Create Your Own Tactical Asset Allocation Strategies
Creating and managing notes for your stocks









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.