1

Pretty straight forward. I just want to print in thinkscript. If this question indicates that I'm missing a crucial element of thinkscript by asking this, please let me know that as well.

ScottyBlades
  • 12,189
  • 5
  • 77
  • 85
  • Sadly, it doesn't look like there is a way. This thread expands on other ways to see your information https://stackoverflow.com/questions/64215873/how-do-you-step-through-thinkscript-in-thinkorswim-platform, and I read an article where a guy "plotted" his variables in the lower window so he could see them all. Very creative. – Praesagus Jul 21 '23 at 17:10

2 Answers2

1

Use something like this: AddLabel(yes, if close > 0 then "whatyouwanttoprint"

mteam88
  • 103
  • 1
  • 12
0
  • If you're asking how to actually print out the code for a script: the best I can find is to copy the code into another editor and print from there.

  • If you're looking for ways to output for debugging purposes, say, then @Mteam888's answer, AddLabel is one way. Another is AddChartBubble:

#hint: Demonstrates adding a chart bubble at a given bar number and a label showing the last (most recent) bar number.\nNote: bar[0] is the rightmost, or most recent, bar. It is actually n bars from the leftmost side of the chart;\nbar[1] is one bar left of bar[0], and bar[2] is 2 bars left of bar 0.\nThis example also shows no plot is required in this case.

def isLastBar = !IsNaN(close) and IsNaN(close[-1]);
def lastBarNum = if isLastBar then BarNumber() else 0;

AddChartBubble( "time condition"=(BarNumber() == 15), "price location"=high, text="BarNumber" + BarNumber(), color=Color.YELLOW);
AddChartBubble( "time condition"=(BarNumber() == 30), "price location"=high, text="BarNumber" + BarNumber(), color=Color.YELLOW);
AddChartBubble( "time condition"=(BarNumber() == 45), "price location"=high, text="BarNumber" + BarNumber(), color=Color.YELLOW);


AddLabel(visible=isLastBar, text="bar[0] (rightmost): " + lastBarNum, color=Color.GREEN);
AddLabel(visible=isLastBar, text="bar[1]: " + (lastBarNum - 1), color=Color.YELLOW);
AddLabel(visible=isLastBar, text="bar[2]: " + (lastBarNum - 2), color=Color.ORANGE);


#plot Data = close;  #plot is not required if only adding labels/chart bubbles

leanne
  • 7,940
  • 48
  • 77