PINE LIBRARY

Order Block Refiner [TradingFinder]

Actualizado
🔵Introduction

The "Refinement" feature allows you to adjust the width of the order block according to your strategy. There are two modes, "Aggressive" and "Defensive," in the "Order Block Refine". The difference between "Aggressive" and "Defensive" lies in the width of the order block.

For risk-averse traders, the "Defensive" mode is suitable as it provides a lower loss limit and a greater reward-to-risk ratio. For risk-taking traders, the "Aggressive" mode is more appropriate. These traders prefer to enter trades at higher prices, and this mode, which has a wider order block width, is more suitable for this group of individuals.


Important:
One of the advantages of using this library is increased code accuracy. Not only does it have the capability to create order blocks, but you can also simply define the condition for order block creation (true/false) and "bar_index," and you'll find the primary range without applying any filters.


🟣Order Block Refinement Algorithm

The order block ranges are filtered in two stages. In the first stage, the "Open," "High," "Low," and "Close" of the current order block candle, its two or three previous candles, and one subsequent candle (if available) are examined. In this stage, minimum and maximum distances are calculated, and logical range filters are applied.

In the second stage, two modes, "Aggressive" and "Defensive," are calculated.

For the "Defensive" mode, the width of these ranges is compared with the "ATR" (Average True Range) of period 55, and if they are smaller than "ATR" or 1 to more than 4 times "ATR," the width of the range is reduced from 0 to 80 percent.

For the "Aggressive" mode, you get the same output as the first filter, which usually has a wider width than the "Defensive" mode.


Order Block Refiner: Off

imagen

Order Block Refiner: On / "Aggressive Mode"

imagen

Order Block Refiner: On / "Defensive Mode"

imagen



🔵How to Use




To add "Order Block Refiner Library", you must first add the following code to your script.




OBType: This parameter receives 2 inputs. If the order block you want to "Refine" is of type demand, you should enter "Demand," and if it's of type supply, you should enter "Supply."

OBRefine: Set to "On" if you want the "Refine" operation to be performed. Otherwise, set to "Off."

RefineMethod: This input receives 2 modes, "Aggressive" and "Defensive." You can switch between these modes according to your needs.

TriggerCondition: Enter the condition with which the order block is formed in this parameter.

Index: Enter the "bar_index" of the candle where the order block is formed in this parameter.


🟣Function Outputs

This function has 6 outputs: "bar_index" at the beginning of the "Distal" line, "bar_index+1" at the end of the "Distal" line, "Price" at the "Distal" line, "bar_index" at the beginning of the "Proximal" line, "bar_index+1" at the end of the "Proximal" line, and "Price" at the "Proximal" line, which can be used to draw order blocks.

Sample:


Notas de prensa
v2
🔵Fixed Error

Due to the limitation on the number of available candles, which is no more than 5000, errors occasionally occurred. This issue has been resolved with a minor modification.
displaystatisticstechindicator

Biblioteca Pine

Siguiendo fielmente el espíritu TradingView, el autor ha publicado este código Pine como una biblioteca de código abierto, permitiendo que otros programadores de Pine en nuestra comunidad lo utilicen de nuevo. ¡Olé por el autor! Puede utilizar esta biblioteca de forma privada o en otras publicaciones de código abierto, pero tenga en cuenta que la reutilización de este código en una publicación se rige por las Normas internas.


Get Access to TradingFinder indicators and Education for FREE: tradingFinder.com/

Forex, Crypto, Stocks, Futures & Index informational materials and Trading Tools in Turkish language: tradingFinder.com/tr/
También en:

Exención de responsabilidad