Turi
Turi

Reputation: 77

How disable/enable input using condition?

Until a few days ago I thought that Pinescript Inputs were not conditional, in fact it is not possible to do something like this.

bool_x = input.bool(true, "On")

if bool_x
  integer_x = input.int(0, 'lenght', minval=1)
else
  // Do nothing. Don't create this input

That's not possible 'cause inputs use Constant and they cannot be changed.

However i found a script created by a user and i dont know how he did a similar thing, how can i disable an input in the same way he did based on condition?

Here the indicator's name (We cannot see the source code): Session Volume Profile HD

Example of what i'm taliking about

Upvotes: 3

Views: 1334

Answers (1)

vitruvius
vitruvius

Reputation: 21209

Session Volume Profile HD is an indicator published by Tradingview. Naturally, Tradingview has superpowers that we do not have :)

In short, you cannot do that at the moment in pinescript.

As a workaround, you can have a bool input to enable/disable a specific input but it won't disable other inputs. You just need to programmatically ignore the other inputs.

Upvotes: 5

Related Questions