Algorithm Tuning - quantatrading/Quanta-exoTrader GitHub Wiki

WaveForm Tuning: An Analogy to Tuning an Analog Radio

Whilst default settings work well, optimising the algorithmic core within the Quanta exoTrader strategy is key to adapting the algorithm for specific market conditions and trading preferences. This guide focuses on adjusting each part of the algorithm, with particular attention to the WaveForm Core.

Understanding the tuning of the WaveForm can be likened to the process of tuning an analog radio to find the perfect station. Just as fine-tuning a radio involves adjusting the dial to get a clear signal without static, tuning the WaveForm involves adjusting its parameters to clearly identify market signals without noise.

Finding the Right Frequency: Channel Length

When tuning a radio, you adjust the dial to find the right frequency that catches your desired station's signal. Similarly, adjusting the WT Channel Length in the WaveForm helps to "find the right frequency" for market signals:

  • Longer Channel Length: This is like tuning into a station with a broader signal band. It makes the received signal (market trend) smoother and more stable, filtering out the minor fluctuations (static) just as a wide-band radio frequency might reduce static but might miss some finer details in the sound.

  • Shorter Channel Length: This corresponds to a narrower signal band on a radio, where you pick up more of the finer fluctuations in the sound (market). It's great for catching all the details but can also mean more static (market noise), making it harder to distinguish the actual music (true market movements).

Fine-Tuning the Signal: Average and SMA Lengths

Fine-tuning on a radio helps you dial into the exact frequency where the signal is strongest and clearest. Adjusting the WT Average Length and WT SMA Length in the WaveForm Oscillator refines how precisely it identifies the market's turning points:

  • Increasing Average/SMA Lengths: Like fine-tuning to a station's strongest signal point, increasing these lengths helps smooth out the oscillator's readings, making it less likely to react to false starts or abrupt stops in the market that might be misleading.

  • Decreasing Average/SMA Lengths: This is similar to tuning the radio to pick up more of the breadth of broadcast signals, which may include some static but ensures you don’t miss any part of the broadcast. Decreasing these lengths in WaveForm makes it more responsive and capable of identifying rapid market changes, albeit with increased sensitivity to market "noise."

Adjusting Volume: WT Sell Level and WT Buy Level

On a radio, adjusting the volume can help you hear the broadcast better without being overwhelmed by background noise. In the WaveForm Oscillator, adjusting the WT Sell Level and WT Buy Level is akin to setting the right volume:

  • Tightening WT Sell/WT Buy Levels (Increasing sensitivity): This is akin to turning up the radio volume, where you increase sensitivity to catch more of the broadcast, including the subtle parts. In market terms, tighter WT Sell/WT Buy Levels make the oscillator sensitive to smaller peaks and troughs, reacting more frequently to price movements which can be analogous to catching more of the market's nuanced moves but with an increased risk of reacting to minor fluctuations that may not be significant.

  • Widening WT Sell/WT Buy Levels (Decreasing sensitivity): Lowering the volume on a radio reduces the overall sensitivity, which can help drown out overwhelming static. Similarly, widening these levels in the WaveForm allows the strategy to focus only on significant market moves, reducing the likelihood of false signals from minor price changes. This setting is useful for maintaining positions during volatile conditions without being swayed by every minor movement.

Tuning Logic

Tuning logic between TradingView and Gunbot are mirrored, the same logic is replicated in PineScript and Javascript. Below we explore more detail in the Quanta exoTrader tuning parameters.

High-Level Functionality

Tuning involves defining combinations of signals and guards from the algorithm. By analysing these signals together, it determines the optimal time to enter or exit the market.

Buy Signal Criteria

  • Market Trend Compliance: Checks if the current price is in agreement with the overall trend.
  • Indicator Confluence: Looks for multiple signals to agree on an confluence condition, indicating a good time to buy.
  • Safety Checks: Ensures extra conditions are met, such as the price being below the average price, to make safer purchases.

Sell Signal Criteria

  • These are essentially the opposite of the buy criteria. The strategy looks for conditions and prices at the top of the WaveForm Core to decide when to sell.

WaveForm Core

The WaveForm Core is the critical core algorithm for identifying potential market reversals. Below are guidelines on how to adjust its parameters, including the normalised levels for buying and selling.

Channel Length

  • Purpose: Affects sensitivity to price movements.
  • Tuning:
    • Increase the channel length to reduce responsiveness to minor price changes, which helps in smoothing the oscillator and focusing on significant trends.
    • Decrease the channel length to capture quick market shifts, useful in highly volatile trading environments.

Average Length

  • Purpose: Determines the calculation of the moving average within the oscillator.
  • Tuning:
    • Longer average lengths lead to a smoother oscillator wave, which might produce fewer signals but with potentially higher reliability.
    • Shorter lengths can provide quicker responses to market changes, albeit with an increased risk of false signals.

SMA Length

  • Purpose: Sets the simple moving average length over the oscillator values.
  • Tuning:
    • Increase to delay crossover signals, potentially confirming stronger trends but possibly missing early entries.
    • Decrease for earlier crossover signals, which might increase trading frequency and associated risks.

WT Buy Level

  • Purpose: Sets the threshold for the wave form low, indicating potential buy signals.
  • Tuning:
    • Increase the WT Buy Level (e.g., from -53 to a less negative number) to trigger buy signals earlier. This can be beneficial in catching upward moves sooner, but it may increase the risk of entering during false bottoms.
    • Decrease the WT Buy Level (e.g., making it more negative) to make the buy signal more conservative, potentially avoiding false buy signals but at the risk of entering the market too late.

WT Sell Level

  • Purpose: Sets the threshold for the wave form high, indicating potential sell signals.
  • Tuning:
    • Increase the WT Sell Level (e.g., from 53 to a higher number) to make the sell signal less sensitive. This adjustment might delay the sell signal, allowing for longer participation in upward trends.
    • Decrease the WT Sell Level to trigger sell signals earlier, which can be useful in securing profits before potential trend reversals.

RSI (Relative Strength Index)

RSI is used as guard one to the WaveForm to identify overbought or oversold conditions. The RSI used by Quanta exoTrader is not the standard RSI, its the RSI of an algorithmic output however for all purposes, it shares the same overbought and oversold conditions. Tuning this indicator involves adjusting:

Length

  • Purpose: The number of periods used to calculate the RSI.
  • Tuning:
    • Longer periods will smooth the RSI, making it less reactive to price spikes and dips, which helps in trending markets to avoid premature exits.
    • Shorter periods make the RSI quicker to react, better for capturing short-term movements in a choppy market.

Oversold and Overbought Levels

  • Purpose: Determine the thresholds for potential buy or sell signals.
  • Tuning:
    • Increase the oversold threshold (e.g., from 30 to 40) to receive earlier buy signals.
    • Decrease the overbought threshold (e.g., from 70 to 60) for earlier sell signals.
    • Adjust these based on market conditions; less volatile markets might require tighter levels.

Bollinger Bands

Bollinger Bands are used as guard two to the WaveForm to identify volatility and price extremities.

Length

  • Purpose: The moving average length over which the bands are calculated.
  • Tuning:
    • Increase the length for more stability in the bands, useful in long-term trend following.
    • Decrease for more reactive bands, useful in capturing shorter-term price movements.

Multiplier

  • Purpose: Adjusts the distance of the bands from the central moving average line.
  • Tuning:
    • Increase the multiplier to widen the bands, which can be useful to avoid exiting during increased volatility.
    • Decrease the multiplier to narrow the bands, increasing the sensitivity to price touching or breaching the bands.

General Tuning Tips

  • Backtesting: Always test any changes in a controlled simulation environment before applying them in live trading scenarios.
  • Lookback Period: The lookback period should try and avoid major systemic changes in the asset. If major changes are observed, zoom out on the timeframe and see the overall impact.
  • Regular Monitoring: Keep an eye on the performance and adjust as needed, especially if market conditions change significantly.
  • Indicator Interaction: Consider how changes to one indicator might affect the performance or signals of others. Coordinated adjustments can lead to more consistent and reliable trading strategies.

By carefully tuning these indicators according to the above, traders can significantly enhance their strategy's effectiveness and adaptability to different market environments.