Before we start this weeks lesson on User Inputs, make sure you check out my newest indicator for TradingView, the Price Data Label. This Indicator allows you to see historical data for each bar on the chart by simply hovering over the high of the bar, similar to the functionality of MarketSmith.
https://www.tradingview.com/script/dd2ZEP5s-Price-Data-Label/
Now let’s get to the fun part, User Inputs!
Similar to variables, you can use user inputs in your script to assign values to variables and create settings menus for your script.
Here you can see all of the different types of inputs you can create. We’ll go through the most common ones (bool, color, int, float, string, source) and there required parameters. There are additional optional parameters you can use as well to help organize your settings menu. We will cover those as well at the end. Â
Just like variables, to begin using user inputs you must assign a name and then use the input function to get the users selections. Let’s look at some examples and this will all make sense.
Before we dive into user inputs make sure you are subscribed so that you don’t miss any future updates!
Bool
A Boolean input allows the user to choose between two options. It is most commonly used to enable or disable certain features. Â It appears a checkbox in the indicators settings.
Color
The color input allows the user to choose a color for a particular element of the indicator.
Integer
The integer input allows the user to choose a whole number integer value. You can set a minimum and maximum range for this as well. While the minimum and maximum range is optional, it is important to know.
Float
The float input is very similar to the integer input by allowing the user to choose a floating point value. You can set a minimum and maximum range for this as well as a step.
Source
A source input allows the user to choose the data series to use and will create a drop down menu.
Organizing Inputs
To better organize your indicators settings menu, there are additional parameters (inline, and group) that you can use. Let’s look at how they work.
You can name your groups and lines whatever you wish, as long as they are a string value, aka a group of characters wrapped in quotes.
Next week, we will take a look at operators and conditional statements.
Thanks for reading! I plan on putting out a lot more content on Pine Script very soon. If you enjoyed this article please help support my work by doing the following:
Follow me on Twitter @amphtrading
Share this post using the button below
The content presented is for informational and educational purposes only. Nothing contained in this newsletter should be construed as financial advice or a recommendation to buy or sell any security. Please do your own due diligence or contact a licensed financial advisor as participating in the financial markets involves risk.