非常直截了当。我只想用thinkscript打印出来。如果这个问题表明我在问这个问题时遗漏了thinkscript的一个重要元素,请让我知道这一点。
发布于 2021-03-08 23:18:38
使用类似下面的代码:AddLabel(yes, if close > 0 then "whatyouwanttoprint"
发布于 2021-03-22 09:32:58
#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 bubbleshttps://stackoverflow.com/questions/58230615
复制相似问题