New to PineScript.
I added this indicators script(https://www.tradingview.com/script/a0vTLaS6-Double-Top-Bottom-Ultimate-OS/) to my original strategy, so I can add new conditions for strategy.close/entry, but the problem is that my previous chart plots and some buttons now are not working anymore. I think that the new script that I inserted (copy/past) is overlaying the previous strategy, thus the previous chart plots are not working. In this case, I think the best option is to create an Input.bool for the boxes shown below.
I came up with this:
xyz = input(title="XYZ", type=input.bool, defval=false)
But I don't know how I should relate this input to its relevant line. I think line 172 is the relevant code for this boxes:
labelText = (doubleTop? "Double Top" : "Double Bottom") + (DisplayRiskPerReward ? " RR - "+tostring(riskPerReward) : "")
Also, In case I want to add(copy/past) new scripts to my strategy. Is there a way to create a button for the whole indicator, within my indicator? For instance, my indicator's name is "XYZ" and I want to add "ABC" inside "XYZ". Is there a way to set a button for "ABC", so when I use the general indicator ("XYZ"), I can just turn it off and on? Is it normal input? or I should indent everything in the code?
So, if you want to have an input to enable/disable that "Double Bottom RR" label, you can have an input variable for that and use an if condition to decide if you should plot or not.
Create an input: bool plotLabel = input(true)
Then modify line 172, where plotting is handled as below (note the indentation):
var label baseLabel = na
if (plotLabel == true)
labelText = (doubleTop? "Double Top" : "Double Bottom") + (DisplayRiskPerReward ? " RR - "+tostring(riskPerReward) : "")
baseLabel := label.new(x=index, y=value, text=labelText, yloc=doubleTop?yloc.abovebar:yloc.belowbar,
color=doubleTop?bearishColor:bullishColor,
style=doubleTop?label.style_label_down:label.style_label_up,
textcolor=textColor, size=size.normal)
So in order to plot that label, plotLabel input must be true
.
Also, In case I want to add(copy/past) new scripts to my strategy. Is there a way to create a button for the whole indicator, within my indicator? For instance, my indicator's name is "XYZ" and I want to add "ABC" inside "XYZ". Is there a way to set a button for "ABC", so when I use the general indicator ("XYZ"), I can just turn it off and on? Is it normal input? or I should indent everything in the code?
No, you need to modify the code and add enable/disable input for the whole script that you copy.