10

I am looking for a way to hide: trades on the chart, quantity, and signal labels -

When using a pinescript strategy for trading view.

I want to do this in the code and not in the settings window. At the moment I have to uncheck the boxes every time I make a change to the script and I can't find the setting in the code or extra code to make this happen.

To uncheck the boxes each time I make a change in the script is....mweh...

Hopefully, someone can help me out with this seemingly simple issue. I have already spent quite a bit of time to figure this out...but no luck so far.

AnyDozer
  • 2,236
  • 2
  • 5
  • 22
  • You should post a code example if you want the community to help you. – Bjorn Mistiaen Nov 13 '20 at 23:07
  • 1
    Did you find a way to hide this infomation by default? Im having this same issue where for example long positions always show quantity and comment when the script reload. Having to disable each time in style settings. `strategy.entry("Long", strategy.long, qty=longPositionSize, comment="hello")` – AfromanJ Aug 03 '21 at 09:45
  • Same here. Just want to hide qty but need to uncheck it after each script change. There's really no way? Wow... – CShore Jan 22 '23 at 20:52

2 Answers2

1

According to the documentation, when you define a strategy, you can't set the default comment:

strategy(title, shorttitle, overlay, format, precision, scale, pyramiding, 
calc_on_order_fills, calc_on_every_tick, max_bars_back, backtest_fill_limits_assumption, default_qty_type,  
default_qty_value, initial_capital, currency, max_lines_count, 
max_labels_count, slippage, commission_type, commission_value, process_orders_on_close, 
close_entries_rule, margin_long, margin_short, max_boxes_count, explicit_plot_zorder) → void

so, the best workaround is override into the order with a space string in the comment:

strategy.entry("OverSelled", strategy.long, when = OVERSELLED_LONG, comment =' ' )
strategy.close("OverSelled",when=OVERSELLED_CLOSE,comment =' ')

NOTE: the quantities will remain in the chart

0

I believe I understand what you are trying to achieve.

So if you create an input and set it as false:

UnHideCode = input(false, title="Un Hide Code", type=input.bool)

Then apply this as an "and" to the signal labels (etc) you don't want to untick all the time.

if(LongSignal and UnHideCode)
    strategy.entry("Buy - Long Term", long=true)

As the UnHideCode is set to false it should not display, to make them all display you would then go into the setting and tick the Un Hide Code box.

frien_dd
  • 154
  • 2
  • 12
  • I'll just add that for pinescript v5, this is the correct code: var bool UnHideCode = input(false, title="Un Hide Code") – Jaro Apr 26 '23 at 15:03