The Doji pattern occurs when the absolute difference between the open and close prices is very small compared to the price range for that period. The script will look for these patterns by comparing the difference between the open and close prices by a certain percentage of the price range.
After the patterns are detected, the script will calculate the Stop Loss (SL) and Take Profit (TP) levels based on the parameters set. The SL level will be determined based on the lowest price range with certain adjustments, while the TP level is calculated using a 1:1 ratio to the SL distance.
This script will display arrows and Stop Loss and Take Profit labels on the chart to assist traders in identifying relevant patterns and levels. However, it is important to remember that these scripts only assist in the analysis of patterns and levels, and a more complete trading strategy and decision-making remains the responsibility of the trader.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.