如何在plotchar函数调用中使用可变变量?

时间:2019-05-18 19:31:42

标签: pine-script

fix() => 
    summary_text = ""
    if barstate.islast
        Win_T_Percentage = 0
        Loss_T_Percentage = 0
        Total_Profit_Points = 0
        Total_T = Win_Trades + Loss_Trades

        if (Total_T != 0.0) 
            T_Trades  = floor(Total_T)
            Win_T_Percentage   = ceil(100.0 * (Win_Trades / Total_T))
            Loss_T_Percentage  = floor(100.0 * (Loss_Trades / Total_T))
            Total_Profit_Points = (Profit_Points - Loss_Points)

            summary_text :=("\nWinning Trades: " + nz(Win_T_Percentage,0) + "% (" + nz(Win_Trades,0) + " of " + nz(T_Trades,0) + ") \n" + "Losing Trades: " + nz(Loss_T_Percentage,0) + "% (" +nz(Loss_Trades,0) + " of " + nz(T_Trades,0) + ") \n" + "Green Points: +" + nz(Total_Profit_Points,0) + " pts \n")
    summary_text   



plotchar(barstate.islast, text =fix(), color = black,location = location.top)

如果运行此命令,我会收到错误消息

  

输出...取决于可变变量。.请将变量括在   函数调用。

它在plotchar失败,并且因为文本被设置为可变字符串。但是,应该使用某个功能对其进行修复。没有。
您知道其他解决方案吗?

0 个答案:

没有答案