StarFox
- Experts
-
Juan Antonio Alvarenga Galindo
Creator, designer, and developer of trading platform bots, specializing in algorithmic trading, with expertise in data science, machine learning, and statistics. Five years of trading experience, creating my own trading bots on various platforms such as MetaTrader and TradingView. - Version: 1.0
- Activations: 5
Master Guide: Entry Logic in Algorithmic Trading (STARFOX System)
1. Introduction to the Automatic Decision Engine
In the design of high-fidelity systems, the decision-making architecture is centralized in the CSignalEngine. This specialized class is not merely a software component, but a class-based architectural structure that abstracts complex data buffers (RSI, MA, ADX) into discrete, executable boolean logic. The CSignalEngine processes a three-candle technical history (indices 0, 1, and 2) to normalize market noise and transform it into binary validation. The fundamental goal of this engine is to strip trading of emotional subjectivity, replacing it with mathematical rigor that ensures system repeatability.
Code Philosophy: "Aggressive Hybrid Engine with Intelligent Protection".
Before the algorithm proceeds to evaluate specific signals, it must validate the market's macro-structural context, ensuring that volatility and trend act as tailwinds rather than obstacles.
2. The Foundations: Trend (EMA) and Strength (ADX)
The STARFOX system operates under a strict regime of convergence. Before considering any entry, the CSignalEngine consults the HTF (Higher Time Frame), usually configured to H4 (TimeFrame_Trend), to establish directional bias and environmental viability.
Indicator | Parameter in Code | Critical Function for the System
--- | --- | ---
Moving Average (EMA) | MA_Trend_Period (200) | Structural Filter: Defines directional bias. Logic: Current Price > EMA = Bullish Regime; Current Price < EMA = Bearish Regime.
ADX | ADX_MinLevel (20.0) | Contraction Filter: Blocks trades in "dead markets". Values < 20.0 indicate consolidation phases where oscillators generate false signals (whipsaws).
Once a healthy trend and market strength above the 20.0 threshold are confirmed, the algorithm deploys its oscillation logic to identify the optimal insertion point.
3. The Main Signal: The 'RSI Hook' (Reversal Hook)
Identified as "Route 1", this high-quality technical signal seeks to capture momentum reversal after price exhaustion. The system looks not just for extreme levels, but for a micro-reversal confirmation in the current candle.
Hook Execution Mechanics:
1. Exhaustion Detection: The previous candle's RSI (rsi[1]) must have reached overextended zones: below 40.0 for buys or above 60.0 for sells.
2. Hook Validation (Micro-Reversal): The level is not enough; the system demands that the current RSI (rsi[0]) changes its trajectory relative to the previous one.
- Buy: rsi[1] < 40.0 AND rsi[0] > rsi[1].
- Sell: rsi[1] > 60.0 AND rsi[0] < rsi[1].
3. Candle Confluence: The signal is only valid if the current candle (PERIOD_CURRENT) closes in the direction of the signal (Bullish for buys / Bearish for sells).
4. The Alternative Signal: 'RSI-50 Cross' (Momentum Cross)
To optimize operating frequency in strongly trending markets, the UseRSI50Cross parameter activates a second entry route. This logic captures momentum when the RSI crosses the neutral 50.0 level, acting as a momentum trigger. Unlike the Hook, this signal requires additional Price Action Momentum validation to avoid false breakouts.
The logical formula integrated into the code is defined as:
If (RSI[1] < 50.0 AND RSI[0] >= 50.0 AND RSI[0] > RSI[1]) + (pClose0 > close[1]) = Buy
Where pClose0 > close[1] represents relative price momentum (Current Close vs. Previous Close).
This "Route 2" ensures that the asset is not only crossing a technical level, but that the price is printing real acceleration in the trade direction.
5. The Confirmation Funnel: Price Action and MTF
Even after detecting a valid signal (Route 1 or 2), STARFOX subjects the decision to a process of volatility normalization and multi-timeframe convergence. Only if these filters are passed does the system issue a positive ResultRetcode for trade.Buy or trade.Sell execution.
Technical Execution Checklist:
- [ ] Candle Confirmation (Candle Bias): Validation that bullishCandle (Buy) or bearishCandle (Sell) are present at the close of candle 0.
- [ ] MTF Filter (Multi-Timeframe Convergence): The RSI on the trend timeframe (hRSI_HTF) must be in sync: >= 40.0 for buys and <= 60.0 for sells. This ensures the micro-signal is not a deep retracement of the macro trend.
- [ ] Volatility Normalization (ATR Spike): The system calculates atrVol[0] > atrVol[1] * VolatilitySpikeMult. If the current ATR exceeds the previous one by 2.5x, a volatility "spike" (macro news or black swan events) is identified and the entry is automatically blocked for safety.
6. Conclusion: System Synergy
The STARFOX architecture demonstrates that success in quantitative trading depends not on prediction, but on the discretization of market conditions. By combining the surgical precision of the RSI Hook with the flow capture of the RSI-50 Cross, the system balances frequency and win-rate.
Key learnings for curriculum design:
- 🎯 Hierarchical Convergence: The entry signal is the final step of a funnel that begins in the HTF structure. Without a major trend, there is no trade.
- 🛡️ Mathematical Protection: The inclusion of filters like the volatility multiplier (2.5x ATR) distinguishes a professional algorithm from a retail one, protecting capital against liquidity anomalies.
- 📊 Boolean Validation: Transformation of "dirty" indicators into clear logical validations removes interpretation, allowing the ResultRetcode to be a direct consequence of applied mathematics.
The 4 Levels of Intelligent Protection of STARFOX
1. Introduction to the Concept of Volatility-Based Protection (ATR)
In high-precision algorithmic trading, fixed distances are the shortest path to obsolescence. The market is not static; its "breathing" changes daily. Therefore, STARFOX uses the ATR (Average True Range) as its fundamental unit of measure to deploy defensive shields. The ATR allows the system to identify price expansion relative to recent volatility. Instead of using arbitrary pips, the robot calculates its protections in multiples of ATR, allowing the strategy to expand in volatile markets and contract during periods of low activity, thus optimizing capital survival.
Intelligent Protection: Defined as a dynamic and multidimensional risk management framework that transmutes a directional trade into a "zero risk" scenario through the algorithmic execution of partial closes and volatility-based stop loss adjustments. For the learner, this represents the elimination of emotional bias in profit taking.
Having established that volatility is the metric governing the system, we must analyze the technical hierarchy of protection. Contrary to what the nomenclature suggests, the system prioritizes absolute safety over profit capture.
2. Level 2: The Inflection Point (BreakEven and Friction Protection)
Although termed "Level 2", the source code reveals a mathematical priority: this level activates before Level 1. It is the true Inflection Point where systemic exposure is neutralized.
Technical Execution Sequence:
1. Operational Trigger: Price reaches 1.0x ATR profit.
2. Safety Partial Close: The system automatically liquidates 30% (Prot_L2_ClosePct) of the total position volume.
3. Transition to BreakEven Plus: The Stop Loss moves to the opening price, but with a critical adjustment: 20 points (Prot_L2_BESpread) are added. This 20-point margin guarantees that, in the event of a violent pullback, the trade not only closes at "breakeven" but covers spread costs and commissions, transforming the operation into a mathematically positive "Free Trade".
3. Level 1: The First Shield (Alpha Assurance)
Once the trade has guaranteed its survival at Level 2, the robot seeks to shield the accumulated profit upon reaching a greater price extension.
Technical Sheet - Level 1:
- Trigger: 1.2x ATR (Configured in Prot_L1_ATR_Trig).
- Action: Close of 20% of the remaining volume.
- Strategic Logic: This level acts as a "high probability profit taking". Occurring after securing the breakeven point, its function is to reduce the trade load while preparing for longer-term trend movements. This inverted hierarchy (first securing capital at 1.0x ATR and then taking profits at 1.2x ATR) is what gives STARFOX its conservative yet highly effective risk profile.
4. Level 4: The Dynamic Runner (Trailing ATR)
Before seeking long-range targets, the system activates its most sophisticated trailing mechanism. The Trailing ATR begins to defend the trade even before final profit targets are reached.
- Pre-Consolidation Activation: Starts when price exceeds 1.5x ATR (Prot_L4_ATR_Active).
- Trailing Distance: The Stop Loss chases the price at a constant distance of 1.0x ATR.
- Volatility Management:
- Allows the trade to "breathe" according to the asset's current volatility.
- Unlike a fixed Trailing stop, the Stop Loss only moves if volatility justifies it, avoiding premature closures due to market noise.
- Acts as dynamic insurance protecting the 1.5x ATR while price heads towards the 2.0x ATR target.
5. Level 3: Critical Profit Consolidation
Level 3 represents the climax of a well-captured trend. It is the point where the robot claims the bulk of the reward for holding the position.
Consolidation Mathematics: Upon reaching a profit of 2.0x ATR (Prot_L3_ATR_Trig), the system executes a close of 50% of the volume still open. This is not 50% of the initial lot, but a drastic reduction of final exposure to capitalize on price extension before potential trend exhaustion.
This volume fragmentation ensures that by the time the market attempts to turn, the trader has already extracted most of the trade's value.
CAUTION - TECHNICAL WARNING: Minimum Volume Requirement
For these 4 levels to execute, the initial normalized volume must be sufficient. If operating with the minimum lot (0.01), the system cannot perform partial closes (20%, 30%, 50%) due to broker limitations. An initial lot of at least 0.05 lots is recommended to ensure the protection logic can fragment the position correctly.
6. Comparative Synthesis of Protection Escalation
Activation Order | Level | Trigger (ATR) | Main Action | Benefit for the Learner
--- | --- | --- | --- | ---
1st | 2: Inflection | 1.0x | Close 30% + BE+20 | Capital Preservation: Zero Risk.
2nd | 1: Shield | 1.2x | Partial Close 20% | Alpha Assurance: Real Profit.
3rd | 4: Runner | 1.5x | Trailing Stop (1.0 ATR) | Dynamic Defense: Protects the run.
4th | 3: Consolidation | 2.0x | Partial Close 50% | Maximization: Capture of trend bulk.
7. Conclusion: The "Zero Risk" Mindset
The architecture of STARFOX transcends manual trading by eliminating the psychological friction of profit management. The system does not "wait" to see what happens; it reacts mathematically to volatility. By automating these four levels, greed is transformed into an orderly liquidation process and fear into an armored stop loss structure.
The 3 Secrets of STARFOX Success:
1. Survival Priority: The system seeks BreakEven (1.0x ATR) before any other metric, ensuring capital is exposed for the shortest possible time.
2. Risk Fragmentation: Collecting in "installments" (20%, 30%, 50%) allows smoothing the equity curve and taking advantage of extended trends without giving back profits.
3. Algorithmic Trailing: The use of Trailing ATR ensures that, once the trade is a winner, the market must "eject" us with a secured profit rather than us deciding to exit on emotional impulse.
Legal Notice: Trading in financial markets involves a high level of risk and may not be suitable for all investors. High leverage can be either detrimental or beneficial to you. Past performance is not indicative of future results. Use of "Starfox" is at the user's sole discretion and risk. INVERJAAG is not responsible for any financial losses resulting from the use of this software.
Legal Notice: Trading in financial markets involves a high level of risk and may not be suitable for all investors. High leverage can be either detrimental or beneficial to you. Past performance is not indicative of future results. Use of "Starfox" is at the user's sole discretion and risk. INVERJAAG is not responsible for any financial losses resulting from the use of this software.
