Starbots

Self Optimizing ROC [Starbots]

Self Optimizing Rate of Change (ROC) Strategy. (non-repainting)

Script constantly tests 15 different ROC parameter combinations for maximum profitability and trades based on the best performing combination.
You will notice that signal lines switch after a bar close sometimes, this is when the strategy optimizes to the better combination and change plots, strategy is dynamic.

---------------------------------------------------------------------------------------------------------
The Rate-of-Change (ROC) indicator, which is also referred to as Momentum, is a pure momentum oscillator that measures the percent change in price from one period to the next. The ROC calculation compares the current price with the price “n” periods ago. The plot forms an oscillator that fluctuates above and below the zero line as the rate of change moves from positive to negative. As a momentum oscillator, ROC signals include centerline crossovers, divergences, and overbought-oversold readings.

ROC = (Close - Close n periods ago) / (Close n periods ago) * 100
-----------------------------------------------------------------------------------------------------------

The logic of self - optimizing:
This script is always backtesting 15 different combinations of ROC settings in the background and saves the net. profit gained for every single one of them, then strategy selects and use the best performing combination of settings currently available for you to trade.
It's recalculating on every bar close - if one of the parameters starts performing better than others - have a higher net profit gain (it's literally like running 15 backtests with different settings in the background) strategy switches to that parameter and continues trading like that until one of the other indicator parameters starts performing better again and switches to that settings.

We are optimizing our strategy based on 15 different 'lengths' or also called 'periods' of ROC.

Inputs (ROC period) : (you don't need to change them, you have a nice wide variety of periods)
🔴Roc (default=9) = 5
🟢Roc2 = 6
🔵Roc3 = 7
🟡Roc4 = 8
🟣Roc5 = 9
🟠Roc6 = 10
🔴Roc7 = 11
🟢Roc8 = 12
🔵Roc9 = 13
🟡Roc10 = 14
🟣Roc11 = 15
🟠Roc12 = 16
🟡Roc13 = 17
🟣Roc14 = 18
🟠Roc15 = 20

Backtester in the background works like this:
backtest ROC1 => save net. profit
backtest ROC2 => save net. profit ;
backtest ROC3 => save net. profit ;
..........
..........
backtest ROC15 => save net. profit ;
=>
It will backtest 15 different ROC parameters and save their profits.
Your strategy then trades based on the best performing (highest net.profit) ROC Setting currently available. It will check the calculations and backtest them on every new bar close - it's like running 15 strategies at time, and manually selecting the best performing one.
________________________________________________________________________


If you wish to use it as INDICATOR - turn on 'Recalculate after every tick' in Properties tab to have this script updating constantly and use it as a normal Indicator tool for manual trading.


-- Noise Filter - This will punish the tiny trades made by certain parameters and give more advantage to big average trades. It's basically normal fee calculation, it will deduct 0.xx % fee from every trade when optimizing. You usually want it to have the same number as your fees on exchange. Large number will choose big long swing trades, small number will prioritize small scalping trades.
-- Turn on ROC Combination Profits and spot the worst/best performing combination. You can change periods to get the best performance after checking this table stats.
-- Backtesting Range - backtest within your desired time window. Example: 'from 01 / 01 /2020 to 01 / 01 /2023'.
-- Optimizing range - you can decrease the amount of bars/data for optimizing script. This way you can keep it up to date to more recent market by selecting optimizing range to optimize it just from the recent 3-6months of data for example. Strategy before this selected range will normally trade (backtest) based on the first ROC period ( 'Roc(default=9)' Input) parameter in your menu if you have Optimizing Range turned on.
**** I recommend 'Optimizing Range' to be turned off, use max amount of available bars in your history for optimization script.
-- Strategy is trading on the bar close without repaint. You can trade Long-Sell or Long- Short. Alerts available, insert webhook messages.
-- Turn on Profit Calendar for better overview of how your strategy performs monthly/annualy
-- Recommended ROC periods: from 5 to 24.
-- Recommended Sources : close, hlc3, hlcc4
-- Recommended Chart Timeframe : 4h +
-- Notes window : add your custom comments here or save your webhook messages inside here
-- Trading Session: in a session, you have to specify the time range for every day. It will trade only within this window and close trades when it's out. Session from 9am to 5pm will look like that: 0900-1700 or 7am to 4:30pm 0700-1630. After the colon, you can specify days of the week for your trading session. 1234567 trading all days, 23456 – Monday to Friday ('1 is Sunday here'). 0000-0000:1234567 by default will trade every day nonstop. 00.00am to 00.00pm and 1234567 every day of the week for example - Cryptocurrencies.

This script is simple to use for any trader as it saves a lot of time for searching good parameters on your own. It's self-optimizing and adjusting to the markets on the go.

Private strategies and Signaler. www.star-bots.com
Endast inbjudanskript.

Tillgången till detta skript är begränsat till användare som har godkänts av författaren och kräver vanligtvis betalning. Du kan lägga till det till dina favoriter men du kan bara använda det efter att ha begärt och fått författarens tillstånd. Kontakta Starbots för mer information eller följ författarens instruktioner här under.

TradingView rekommenderar inte att du betalar för ett skript och använder det om du inte litar till 100% på författaren och förstår hur skriptet fungerar. I många fall kan du hitta ett bra alternativ med öppen källkod gratis i våra Community skripts .

Frånsägelse av ansvar

Informationen och publikationerna är inte avsedda att vara, och utgör inte heller finansiella, investerings-, handels- eller andra typer av råd eller rekommendationer som tillhandahålls eller stöds av TradingView. Läs mer i Användarvillkoren.

Författarens instruktioner

PM or visit our website for more info. www.star-bots.com

Vill du använda det här skriptet i ett diagram?

Varning:Var god läs innan du begär åtkomst.