I Upgraded the HFT Bot (Advanced Trailing Logic + Full Code)

I Upgraded the HFT Bot (Advanced Trailing Logic + Full Code)

Introduction to High-Frequency Trading Robot Modifications

Overview of Previous Work

  • The speaker previously shared the complete coding for a high-frequency trading (HFT) robot and demonstrated its application in live trading.
  • Due to health issues, modifications to the Expert Advisor (EA) were delayed, but the speaker is now ready to share updates.

New Features and Modifications

  • The primary modification discussed is implementing an aggressive trading stop-loss from a scalping strategy, aligning with the bot's aggressive nature.
  • The EA is designed for short-term use due to its high order generation; prolonged usage may lead to broker restrictions.

Key Considerations for Using the EA

Trading Conditions

  • Optimal performance occurs during high momentum periods, such as market openings or news releases; otherwise, profits may diminish.
  • The speaker emphasizes that they are not endorsing any specific trading bot for guaranteed success but sharing insights based on personal experience.

Coding Changes: Trailing Stop-Loss Management

Implementation Steps

  • The session begins by revisiting the original code and planning to add trailing stop-loss management features.
  • An enumeration (enum) will be created for different trailing types: default trailing, scalping trail, previous candle trail, fast moving average trail, and Ichimoku 10% trail.

User Input Configuration

  • Users will select their preferred trailing type through an input dropdown menu integrated into the EA settings.
  • Additional user inputs will determine trigger points and distances for trailing stop-loss activation based on selected methods.

Detailed Variable Definitions

Customization Options

  • For each trailing method selected by users, specific variables must be defined—such as how many candles to consider or which moving average period to apply.

Initialization of Indicators

Setting Up Indicators

  • Handles for moving averages and Ichimoku indicators are initialized within the code structure based on user-defined parameters.

Functionality Expansion: On-Tick Processing

Creating Separate Functions

  • A new function called trail_stop is introduced to manage all conditions related to trailing stop-losses separately from other operations in the main loop.

Position Processing Logic

Handling Open Positions

  • Existing logic processes open positions based on whether they are buy or sell orders while integrating new trailing mechanisms without cluttering code complexity.

Finalizing Stop-Loss Adjustments

Conditional Checks

  • For buy positions: checks if current prices allow adjustments above opening prices while ensuring compliance with broker requirements.
  • For sell positions: similar checks ensure that adjustments do not violate market price constraints.

Testing New Features

Live Testing Results

  • After implementing changes, initial tests show successful execution of modified stop-loss strategies under various market conditions.

Turn any video into a summary like this

YouTube links, meetings, lectures — with transcripts, search, and chat.

Video description

In this sequel, I upgrade my High Frequency Trading bot with advanced trailing stop logic for smarter exits and better risk management. I walk through the full implementation step by step and share the complete code, explaining the architecture behind the new trailing mechanisms and how they improve performance in fast-moving markets. This is a continuation of the original HFT bot build — focused on precision, control, and intelligent exit strategies. -------------------------------------------------------------------------------------- The complete code file is available in the store for convenience and reference. https://no-nonsense-forex-shop.fourthwall.com/ However, I strongly recommend following the video and coding along — understanding the logic is what will truly help you build and improve your own EAs. -------------------------------------------------------------------------------------- My Broker I have used ICMarkets for a very long time and never had to look anywhere else. If you do go that direction, use the code below to get extra discount on commissions/spreads https://icmarkets.com/?camp=83590 or https://www.ictrading.com?camp=87546 (For EU friends.. apparently there is 1:100 or 1:500 leverage available to EU people as well) if you are already on ICMarkets, you can send an email to partners@ICMarkets.com and give them your account details and partner code 83590 to enjoy the discounts. if you are already on ICTrading, you can send an email to partners@ICTrading.com and give them your account details and partner code 87546 to enjoy the discounts. =================================================================== Disclaimer: The content of the video are for the purpose of Forex and trading education purpose only. Forex and Trading is risky and the content of the video should be taken as educational material for forex and trading strategies only Please back test yourself all forex and trading education provided and found for reliability and education on forex trading and education 00:00 Introduction to changes 00:43 4 Important Points about the Bot 01:46 Start of the Coding 23:48 Testing the new Trailing Stops 26:11 Very Important to Understand