Futures Ticker Chart label


Category:
0
0

Hello , I’m trying to create a chart label where I can eliminate the exchange part and just show the ticker symbol like it used to be a few years ago. I keep getting this error , but I don’t see how or where the logic is wrong here.. Am I close with this ? All ideas welcome. Have a great MLK day guys.

Attachments:
Marked as spam
Posted by (Questions: 11, Answers: 10)
Asked on January 18, 2020 9:32 am
144 views
0
Private answer

I don't understand the request. The ticker symbol loaded on the chart is already displayed on the chart. You do not need a chart label to display the currently loaded ticker symbol on the chart.

Now, I'll take some time to explain why your code is not working. The following statement is invalid:

def x = if ticker then "/ES" else GetSymbol();

Variable declarations in Thinkorswim must ALWAYS be in the form of a numerical value. String values are not permitted. So you cannot assign the ticker symbol to a variable, period.

Your code implies that you want to display a ticker symbol other than what is currently loaded on the chart. Otherwise, why would you include a user input for the ticker and set its default value to "/ES". However that doesn't make sense so instead I will provide a signal line of code that will place a label on the chart to display the ticker symbol that is currently loaded on the chart.

AddLabel(yes, Concat("Ticker: ", GetSymbol()), Color.WHITE);

However when you apply this to a chart of /ES the label displays it as "/ES:XCME". Which is exactly what you said you were trying to avoid. Now we are back at the very beginning of the thought process. Which is that you are trying to do something that is already displayed on the chart. See screenshot below for an example of what I can talking about.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on January 18, 2020 4:05 pm