Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

BotiTrader

C

Chris

@Chris
About
Posts
14
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to check _LastError variable while debugging?
    C Chris

    @manager Finding the right balance for batch logging is definitely tricky. One approach I’ve used is setting a dynamic threshold based on volatility or execution intensity—this way, logs are flushed more frequently during high-activity periods while minimizing overhead during quieter moments. Have you experimented with adaptive batch sizes?

    Regarding external log streaming, WebSockets are a solid option for real-time monitoring, especially when paired with a lightweight Flask or FastAPI server. If MetaTrader supported structured logs (like JSON) natively, it could make processing much easier. Have you seen any community-driven solutions tackling this?

    General Discussion

  • How to check _LastError variable while debugging?
    C Chris

    @Shawn Buffering errors before writing them in batches is definitely a solid approach for performance optimization. A strategy I've seen work well is flushing logs based on execution time intervals combined with a maximum-error threshold—this balances efficiency while minimizing data loss. Have you tested any specific batching conditions that work well with high-frequency strategies?

    Regarding external logging, integrating Python scripts for real-time dashboard visualization is something I've explored. Using WebSockets or a lightweight Flask server to dynamically stream logs can provide instant insights. Do you think MetaTrader could benefit from native support for structured log output (like JSON) to enhance external processing?

    General Discussion

  • How to check _LastError variable while debugging?
    C Chris

    In new versions of MetaTrader 5 it is impossible to check system variables from the debugger.

    How to check _LastError variable while debugging? Or do you need to print it after each line of code?

    General Discussion

  • ** Enhancing Algorithmic Trading Tools – Feature Requests & Feedback**
    C Chris

    As a professional quantitative trader with over a decade of experience in stock trading and Python development, I rely heavily on efficient, accurate, and scalable tools to execute trading strategies. While the platform already provides a solid foundation, I see potential for enhancements that could benefit systematic traders like myself.

    One area that could be improved is the flexibility and customization of backtesting tools. Enhancements such as more granular control over execution assumptions (e.g., slippage modeling, market impact) and more robust historical data integrations would allow for a more realistic simulation of strategies. Has anyone else encountered limitations in this area, and if so, how are you working around them?

    Additionally, expanding API capabilities—particularly around real-time data streaming and order execution—could greatly enhance automated strategy deployment. More detailed logging and debugging capabilities would also be invaluable for diagnosing algorithm performance in live environments. Are there specific API improvements that other traders here would like to see?

    Lastly, I’d love to hear from other quantitative traders and developers in the community. What features or improvements do you think would bring the most value to systematic traders? Are there particular pain points that, if addressed, would significantly enhance your workflow?

    Looking forward to an engaging discussion and suggestions from both the community and platform developers!

    Trading Strategies & Backtesting

  • ** Enhancing Algorithmic Trading Strategies: Backtesting, Optimization, and AI Assistance**
    C Chris

    Great insights! Using delisted stocks is definitely an excellent way to account for survivorship bias—I’ve tested this approach, and it often reveals hidden weaknesses in strategies that rely too heavily on large-cap, long-standing stocks.

    Regarding walk-forward optimization, I agree that rolling windows tend to adapt better to shifting market conditions. Expanding windows can work well in stable environments but tend to overfit in volatile markets, especially when regime shifts occur. Have you found any effective ways to detect when a switch between rolling and expanding windows might be beneficial?

    On ChatGPT, I’ve been experimenting with using it for hyperparameter tuning in reinforcement learning-based strategies. It speeds up idea generation and helps refine feature selection. Have you seen measurable improvements in strategy robustness when incorporating AI-driven meta-parameter tuning? Would love to hear more about your experiences with that!

    Trading Strategies & Backtesting

  • ** Enhancing Algorithmic Trading Strategies: Backtesting, Optimization, and AI Assistance**
    C Chris

    As a professional quantitative trader with over a decade of experience in stock trading and Python development, I’ve spent years refining and testing algorithmic strategies. One of the key challenges in algorithmic trading is ensuring that a strategy performs well not just on historical data but also in real-time markets. Poor backtesting practices, overfitting, and insufficient robustness testing often lead to disappointing live performance.

    In this discussion, I’d like to delve deeper into best practices for backtesting and optimizing trading strategies. Some key areas worth exploring:

    • Data Quality & Survivorship Bias – How do you handle survivorship bias, lookahead bias, and ensure that your backtesting data is truly representative of real market conditions?
    • Walk-Forward Optimization – Do you apply rolling or expanding windows when tuning strategy parameters? Have you found this approach more reliable than conventional parameter optimization?
    • Monte Carlo Simulations & Robustness Testing – What methods do you use to evaluate the robustness of your strategies? How do you assess risk beyond simple backtesting metrics?
    • ChatGPT for Strategy Development – I've been experimenting with ChatGPT for generating strategy ideas, debugging backtest errors, and even aiding in optimization. How are you incorporating AI into your trading workflow?

    I'm curious to hear from others who are actively backtesting and refining automated strategies. What techniques have worked best for you, and how do you safeguard against common pitfalls? Let’s share insights and improve together!

    Trading Strategies & Backtesting

  • **** Fine-Tuning Algorithmic Trading Strategies: Backtesting for Reliable Performance
    C Chris

    Backtesting is an essential step in the development of any algorithmic trading strategy. A well-structured backtest provides insights into how a strategy would have performed historically, helping traders assess risk, optimize parameters, and identify potential weaknesses. However, backtesting is not without its challenges.

    One of the biggest concerns is ensuring that backtesting results are realistic and not overly optimistic. Factors such as market impact, slippage, and transaction costs can significantly alter a strategy’s real-world performance. What methods do you use to incorporate these elements into your backtesting process? Do you use historical tick data, or do you rely on assumed execution models?

    Moreover, avoiding hindsight bias and overfitting is crucial. A strategy that performs well on past data may not necessarily succeed in live markets. How do you ensure that your strategy remains robust across different market conditions? Do you use out-of-sample testing, walk-forward analysis, or other validation techniques?

    With the rise of AI-powered tools like ChatGPT, traders now have new ways to enhance their strategy development and debugging. Have you experimented with using ChatGPT for idea generation, parameter tuning, or strategy optimization? How effective has it been in improving your workflow?

    Let’s discuss best practices, challenges, and tools for making backtesting more reliable. Share your insights and experiences—what has worked for you, and what hasn’t?

    Trading Strategies & Backtesting

  • How could make indicator only show signal on the first bar?
    C Chris

    Thanks for the suggestion, @manager! Your approach with the signalPlaced flag makes a lot of sense to prevent multiple arrows from appearing. I hadn’t considered breaking out of the loop once a signal is placed, which should help improve efficiency as well.

    I’ll implement this and test how it behaves in live conditions. One question—would this logic work consistently across different timeframes, especially when referencing the higher timeframe MACD? I want to make sure the signal doesn’t get skipped due to shifting bar alignments.

    Appreciate your input! I’ll share my results after testing. 🚀

    General Discussion

  • How could make indicator only show signal on the first bar?
    C Chris

    Dear coder,

    I am writing an indicator (checking signal from MACD + MACD of highger timflame)

    But I could not find the method only add one arrow on the first bar when the signal appear

    So the chart as image below.

    Could you please check and give me some advice to revise my code.

    Thank you so much.

    #property copyright "Copyright © 2005, Mr.Sun"
    #property link      "mailto:[email protected]"
    
    #property indicator_separate_window
    #property indicator_buffers 6
    #property indicator_color1 Blue
    #property indicator_color2 Coral
    #property indicator_color3 Red
    #property indicator_color4 Magenta
    #property indicator_color5 clrChocolate
    #property indicator_color6 clrSilver
    
    
    #property indicator_level1     0
    #property indicator_levelcolor clrSilver
    #property indicator_levelstyle STYLE_SOLID
    //#include <kholuutru.mqh>
    
    //---- input parameters
    extern int        Fast     =12;
    extern int        Slow     =26;
    extern int        Signal   =9;
    extern int        Fast_TF1     =12;
    extern int        Slow_TF1     =26;
    extern int        Signal_TF1   =9;
    
    //---- buffers
    double MACDLineBuffer[], SignalLineBuffer[], main_TF1[], sign_TF1[];
    double SignalDown[];
    double SignalUp[];
    
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function                         |
    //+------------------------------------------------------------------+
    int init()
    {
       IndicatorShortName("Check Only one Signal");
       SetIndexBuffer(0,MACDLineBuffer);   SetIndexStyle(0,DRAW_LINE,1,2,Blue);      SetIndexDrawBegin (0,Slow);   
       SetIndexBuffer(1,SignalLineBuffer); SetIndexStyle(1,DRAW_LINE,1,2,clrCoral);  SetIndexDrawBegin (1,Slow+Signal); 
    //Arrow 
    
       SetIndexBuffer(2, SignalDown);      SetIndexStyle(2,DRAW_ARROW,0,1);       SetIndexDrawBegin (2,Slow+Signal);  SetIndexArrow(2, 234);
       SetIndexBuffer(3, SignalUp);        SetIndexStyle(3,DRAW_ARROW,0,1);       SetIndexDrawBegin (3,Slow+Signal);  SetIndexArrow(3,233); 
    //Check main + sign off TF1
       SetIndexBuffer(4,main_TF1);         SetIndexStyle(4,DRAW_LINE,2,0,clrBlue);   SetIndexDrawBegin (4,Slow+Signal);
       SetIndexBuffer(5,sign_TF1);         SetIndexStyle(5,DRAW_LINE,2,0,clrCoral);  SetIndexDrawBegin (5,Slow+Signal);
       return(0);
    }
    
    int TF1()
       {
          int TF=0;
          switch (Period())
          {
          case 1:       TF= 15;       break;
          case 5:       TF= 30;      break;         
          case 15:      TF= 60;      break;
          case 30:      TF= 240;     break;
          case 60:       TF= 240;    break;
          case 240:      TF= 1440;      break;
          case 1440:     TF= PERIOD_W1; break;
          case 10080:    TF= PERIOD_MN1;break;
          case 43200:    TF= 43200;     break;
          }
       return(TF);
       }
    
    //+------------------------------------------------------------------+
    //| Custom indicator iteration function                              |
    //+------------------------------------------------------------------+
    int start()
    {
      int counted_bars = IndicatorCounted();
      if(counted_bars < 0) return(0);
      if(counted_bars > 0) counted_bars--;
      int limit = fmin(Bars - counted_bars,Bars-1);
        
      for(int i=limit; i>=0; i--)
       {
          int shift = iBarShift(Symbol(),TF1(), Time[i], true);
          if (shift == -1) continue;
          {
             main_TF1[i]=      iMACD(Symbol(), TF1(), Fast_TF1, Slow_TF1, 2,PRICE_CLOSE,MODE_SIGNAL,shift);
             sign_TF1[i]=    iMACD(Symbol(), TF1(), Fast_TF1, Slow_TF1, Signal_TF1,PRICE_CLOSE,MODE_SIGNAL,shift);
             if(main_TF1[i] > sign_TF1[i])      int tin_hieu_TF1 =0;
             else                                   tin_hieu_TF1 =1;
          }
          MACDLineBuffer[i] = iMACD(Symbol(),0,Fast,Slow,2,PRICE_CLOSE,MODE_SIGNAL,i);
          SignalLineBuffer[i] = iMACD(Symbol(),0,Fast,Slow,Signal,PRICE_CLOSE,MODE_SIGNAL,i);       
    
          //SELL signal
          if (MACDLineBuffer[i]<SignalLineBuffer[i])     SignalDown[i]= SignalLineBuffer[i] ;
          
          //BUY signal
          if (MACDLineBuffer[i]>SignalLineBuffer[i])    SignalUp[i+1]= MACDLineBuffer[i] ;    
       }
       return(0);
    }
    
    General Discussion

  • Welcome to your NodeBB!
    C Chris

    Reply again.

    General Discussion

  • Welcome to your NodeBB!
    C Chris

    Reply to this message.

    General Discussion

  • Welcome to your NodeBB!
    C Chris

    asdfwerqwer

    General Discussion

  • Welcome to your NodeBB!
    C Chris

    testtsetsetsetsetsetsetsetset

    General Discussion
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Groups