PROTECTED SOURCE SCRIPT

Baseline Optimizer NNFX [m8b]

DESCRIPTION
The Baseline Optimizer indicator is a tool to aid in baseline configuration (specifically moving averages). It manages state across iterations within a single bar to allow the indicator to test different settings. This allows the user to find a specific configuration that works well for that asset and timeframe. It also recreates pieces of the default TradingView backtesting framework so multiple settings can be tested concurrently.

Originality and usefulness
Default pine script doesn't allow for state management within a loop due to the way historical values are handled (e.g. EMA). It also does not allow for backtesting across multiple settings concurrently. The the functions are all unique in that they allow for proper state management during the optimization process.

ADDITIONAL BACKGROUND AND USAGE
While the platform is built to support the NNFX way of trading, this indicator can be utilized by any trader who wants to optimize an MA for a specific asset, chart, or time frame regardless of asset class.

NNFX revolves around a systematic approach to trading, designed to be mechanical and with minimal discretionary input. This strategy typically involves multiple indicators across different categories to confirm trading signals. The approach involves:

  • Baseline indicator to determine the overall trend direction
  • Confirmation (Leading & Lagging) indicator used to validate the trade
  • Volume indicator to confirm the presence of market participation
  • Exit indicator to signal when to close the trade


Supported Moving Averages
v1 (this indicator): ALMA, DEMA, EMA, HMA, KAMA, RMA / SMMA, SMA, Tilson T3, TEMA, WMA, VWMA

USAGE
By default, this indicator will run on “Standard” mode, and acts as a roll-up of MAs. Simply set the MA type and length.

When mode is set to “Optimizer”, a table will appear on the chart that displays trade stats for the various configurations.
  • Net Profit, Closed Trades, % Profitable, Profit Factor, Max Drawdown, Avg Trade, Avg Bars


STANDARD SETTINGS
  • MA Type: ALMA, DEMA, EMA, HMA, KAMA, RMA, SMA, T3, TEMA, WMA, VWMA
  • MA Length: Length of the MA
  • MA: Source: Source for the MA


OPTIMIZER SETTINGS
  • Profit factor threshold: Acts as a filter to the trading stats to make it more readable
  • % profitable threshold: Acts as a filter to the trading stats to make it more readable
  • Min trades threshold: Acts as a filter to the trading stats to make it more readable
  • Start & End Date: The data window for the optimizer to backtest
  • Trade Direction: All, Long only, Short Only
  • Pyramid Max: Works the same as standard TradingView pyramid
  • Optimizer Param Start: The first value for the optimizer
  • Optimizer Param End: The end value for the optimizer
  • Optimizer Param Step: The step value for the optimizer
  • Stats green threshold: The value to turn results green
  • Stats red threshold: The value to turn results red


IMPORTANT NOTES (Errors & Pine Limitations)
  • Warm-up Period Multiplier: "Warming up" refers to the period where the indicator begins to reflect accurate and meaningful data. A default value of 5 should generally ensure baseline data is accurate. If performance is an issue (e.g. timeouts), this can be adjusted down at the cost of accuracy. While this may not be ideal, for the purposes of optimization the results should be directionally accurate in most cases with lower values. If you see the stats changing in real-time in the results, that’s often a good indicator your warm-up is too short. Note, the EMA in particular requires a long warm-up due to its nature (~3 x length)
  • Timeouts: Depending on your TradingView plan, scripts will either timeout after 20 or 40 seconds. If you get too aggressive with either timeframes or Start/End/Step, you may timeout. THIS IS NOT A BUG, it’s a limitation of TradingView and/or your plan. The fixes for this are 1) test less states at a time 2) use a higher timeframe 3) get a Premium TradingView Plan.
  • Array Size / Memory Size: This should rarely be an issue with baseline optimization, BUT if you get really aggressive with settings (particularly on the T3) you could run into a scenario with Pine reaches/exceeds the limitation of an array size (100,000). If this happens, reduce your timeframe or input param values to resolve.


DISCLAIMER
This indicator is for educational purposes only, not financial advice. The developers are not financial advisors and accept no liability for how you use the information or features. By using this indicator, you acknowledge that all trading decisions are your own responsibility and that past performance does not guarantee future results.
Moving Averagesstatistics

Script protegido

Este script é publicado como de código fechado e você pode usá-lo livremente. Você pode favoritá-lo para utilizá-lo em um gráfico. Você não pode visualizar ou modificar seu código fonte.

Quer usar esse script no gráfico?

Aviso legal