I have a spreadsheet of levels for different symbols. Is there a way to automate entering these levels on TOS charts either as alerts or as horizontal lines? I have some familiarity with Python, but less so with Thinkscript.
I have a spreadsheet of levels for different symbols. Is there a way to automate entering these levels on TOS charts either as alerts or as horizontal lines? I have some familiarity with Python, but less so with Thinkscript.
Thanks, this is great. I'm able to generate the thinkscript code for a bunch of symbols using python and my source spreadsheet. Then copy/paste the thinkscript code. Since I only have to do this weekly, the manual steps involved aren't a big deal.here is one way,
this study sets a few price levels for a couple of stocks
https://usethinkscript.com/threads/horizontal-lines-in-thinkorswim.3472/page-2#post-38179
take a look at other posts in the thread for other ideas
a label, no. labels only appear at the top of charts.Thanks, this is great. I'm able to generate the thinkscript code for a bunch of symbols using python and my source spreadsheet. Then copy/paste the thinkscript code. Since I only have to do this weekly, the manual steps involved aren't a big deal.
I guess it's still not possible in thinkscript to add a label to the horizontal lines (meaning a label that is on the line itself, to the left side of the chart)?
Yeah, a label on the line would be ideal. So I see the line, and the number on the right axis, and can look over to the left axis to see what this line represents. But sounds like that's still not possible in thinkscript. I'll just use the line formatting to differentiate these lines from other lines on the chart.a label, no. labels only appear at the top of charts.
if you mean , place something on an axis, then no.
a bubble can be placed anywhere on the chart, to display almost anything.
Thanks, this is great. I'm able to generate the thinkscript code for a bunch of symbols using python and my source spreadsheet. Then copy/paste the thinkscript code. Since I only have to do this weekly, the manual steps involved aren't a big deal.
I guess it's still not possible in thinkscript to add a label to the horizontal lines (meaning a label that is on the line itself, to the left side of the chart)?
The spreadsheet that contains source data (symbols and levels to plot) is in Google Sheets, so that's where the python script is fetching from. There is a Sheets API; if you want more info on this, let me know.i was making an outline on how to use excel formulas to generate thinkscript code text, that could be copied into tos...
but it sounds like you have that part figured out, with python. i would like to see the python code , or part of it.
i started reading about python, but have a long way to go.
# fetch from spreadsheet
fetch = sheet.values().get(spreadsheetId=spreadsheet_ID, range =readRange).execute()
EMlist = fetch.get('values', [])
scriptText = 'if (GetSymbol() == "AAA") then {P1 = 69; P2 = 70;} ' # using unlikely to be used ticker to start scriptText before jumping into loop
for i in range(len(EMlist)):
if EMlist[i]: # so we only deal with lists containing content, not empty lists
addString = 'else if (GetSymbol() == "' + EMlist[i][0] + '") then {P1 = ' + EMlist[i][3] + '; P2 = ' + EMlist[i][4] + ';} '
scriptText = scriptText + addString
endString = 'else {p1 = nan; p2 = nan;}'
finalString = scriptText + endString
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
D | Possible Collar suggestion | Questions | 1 | |
B | Possible to Calculate VIX value on underlying stock? | Questions | 1 | |
![]() |
Latest possible close before a certain time | Questions | 1 | |
![]() |
First possible close after 8:00 PM | Questions | 1 | |
![]() |
Is it possible to have Renko listed as a time in the Quotes options | Questions | 1 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.