PROTECTED SOURCE SCRIPT

robotrading body limit

84
This Pine Script strategy, named "The Retriever" aims to capitalise on price dips based on the size of the candlestick body. It uses a moving average of the body size to identify potential long entry points. Here's a breakdown:

Body Size Calculation: It calculates the absolute difference between the close and open prices (body) to determine the candlestick body size.

Entry Signals:

long: A long entry signal is generated when the close price is significantly higher than the moving average of the body size (ta.sma(body, 100)) multiplied by a factor (mult). Thanks to this principle we are entering just bigger dips but just in case it is sudden movement, typically dip during bullish trend.
longExtra: A second, more aggressive long entry signal is generated when the close price is even further above the moving average (multiplied by mult * 2). This signal is very rare and it is helping to decrease entry point in case huge market dips which can occurs just few times per year.
EMA long: It is newly integrating long term trades on EMA cross. The % of profitable trades is decreased but strategy can gain from long trends now.

Quantity Calculation: The order quantity (qty) is dynamically calculated based on the current equity and the price range between minRange and maxRange. It aims to adjust the quantity inversely to the price range, possibly increasing the quantity when the price range is smaller. It is actually very smart in several ways:
it is making bigger trades when market price is low (closer to manually defined minRange) and vice versa making smaller trades when market is close to maxRange
trade size is calculated based on current equity so it allows to use compound interest effect
as there is no SL in this strategy trade size is calculated to be max around 50-60% drawdown based on backtested results so it can survive 80-90% market drawdowns (entry point is after huge dip)

Exit Conditions: All open positions are closed when either of these conditions is met:

The last candle is green (close is lower than open). There is also minProfit param defined which is set to 0 so it means that our position has to be in profit. So we are never closing in loss. We have to differentiate here between order and position. Order can be in loss but overal position has to be always in profit.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.