Description of the Daily Bias Indicator Script
This Pine Script creates a custom indicator called "Daily Bias Indicator" for use on TradingView charts. The purpose of the indicator is to analyze price action based on the previous day's highs and lows, and it provides a bias (either "Buy" or "Sell") based on the closing price relative to these levels.
Key Features:
User-Defined Colors:
Users can customize the colors for the title and bias text, as well as the background colors for "Buy" and "Sell" signals.
There is also an option to set the border color of the table displaying the bias.
Timeframe Selection:
Users can choose whether to calculate the bias based on the current timeframe of the chart or to use the daily timeframe by default.
This is controlled by a boolean input option (useCurrentTimeframe).
Bias Calculation:
The script retrieves the previous high and low prices from the specified timeframe, as well as the closing price from the previous bar.
The bias is determined based on the following logic:
If the closing price is above the previous high, the bias is set to "Buy."
If the closing price is below the previous low, the bias is set to "Sell."
If the closing price is between the previous low and high, it adjusts the bias accordingly.
Table Display:
The indicator displays a table in the top right corner of the chart, showing the title "Daily Bias" and the calculated bias.
The table cells can be styled with the user-defined colors.
Dynamic Updates:
The indicator updates daily, and it checks if the current bar is the first bar of a new day to refresh the displayed values.
This indicator is useful for traders looking to quickly assess market bias based on recent price action, with the added flexibility of customizing the visual appearance and choosing the timeframe for calculations.