Implementation of an Automated Trading System for XAG/USD Using Donchian Channel and Safe-F Risk Management on MetaTrader 5
Main Article Content
Abstract
This study aims to develop and evaluate an Expert Advisor (EA) based on the Donchian Channel indicator combined with the Safe-F Money Management strategy for trading the XAG/USD pair using the MetaTrader 5 platform. The EA is designed to capture breakout opportunities while adaptively managing trade size based on account balance. Testing was conducted using two approaches: backtesting with four years of historical data and real-time testing under actual market conditions. The backtesting results indicate that the H1 time frame scenario yielded more stable performance, with a Sharpe Ratio of 1.26 and low drawdown. In contrast, the real-time testing recorded less optimal outcomes, with profit factors below 1 and net losses in both scenarios. These findings suggest that although the EA performs well in simulations, real-time performance is affected by market volatility and execution factors. Therefore, further optimization and broader testing are recommended to enhance the system’s resilience in dynamic market environments.
Article Details

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
References
Abdurrahman. (2024). Metodologi research and development (Teori dan penerapan metodologi RnD). PT Sonpedia Publishing Indonesia.
Ali, J. (2023, November 21). What are the most popular metrics for trading performance? PineConnector. https://www.pineconnector.com/blogs/pico-blog/what-are-the-most-popular-metrics-for-trading-performance
Alqodri, F., Lestari, S., & Wardani, N. E. (2015). Teknologi trading berbasis expert advisor (EA) pada pasar valuta asing dengan teknik kalender ekonomi. Semnasteknomedia Online, 3(1), 5–12–21.
Anisha, B. (2023, April 26). Kenali Donchian Channel dan rumusnya. HSB. https://blog.hsb.co.id/forex/donchian-channel/
Anissa, B. (2025). Strategi cerdas investasi perak online. HSB. https://blog.hsb.co.id/emas/trading-perak/
Anugerah, D. (2023). Pengertian investasi dan jenis-jenisnya dalam pengalaman. Fakultas Ekonomi dan Bisnis Ekonomi. https://feb.umsu.ac.id/pengertian-investasi-daEn-jenis-jenisnya/
Astronacci. (2025, February 18). Teknik trading breakout base untuk waktu singkat. Astronacci. https://feb.umsu.ac.id/pengertian-investasi-daEn-jenis-jenisnya/
Aulia, A., Priyatna, B., Hananto, A. L., & Tukino, T. (2023). Perancangan expert advisor untuk trading forex dengan bahasa MQL4. Jurnal Cahaya Mlika, 4(2), 403–410. https://doi.org/10.36312/jcm.v4i2.1430
Axel. (2024). Pasar komoditas: Pengertian, jenis, mekanisme, dan cara berinvestasi. Equid. https://blog.eku.id/pasar-komoditas-pengertian-jenis-mekanisme-dan-cara-berinvestasi/
Butler, A. W., & Kazakov, A. (2020). The cost of immediacy in FX markets. Journal of Financial Markets, 49, 100519. https://doi.org/10.1016/j.jflm.2020.100519
Calvin. (2024). Analisis pengembangan Expert Advisor dengan indikator Stochastic dan MACD dalam trading forex: Studi kasus akun swap-free pada platform MetaTrader 5 [Skripsi sarjana tidak dipublikasikan]. Universitas Negeri Medan.
Candra, P. (2020). Analisis imbal hasil dengan automatic trading dalam perspektif money management: Studi eksperimental dengan expert advisor pada pasar futures. https://doi.org/10.26418/ejme.v8i4.43637
Chan, E. P. (2017). Algorithmic trading: Winning strategies and their rationale. John Wiley & Sons.
Chan, L., & Wong, W. K. (2013). Expert advisor development on MT4/MT5 for automated algorithmic trading on EURUSD M1 data. Finamatrix Journal, 1(1), 1–4. https://ssrn.com/abstract=2319073
Chen, J. (2021). Technical indicator: Definition, analyst uses, types and examples. Investopedia. https://www.investopedia.com/terms/t/technicalindicator.asp
Chen, J. (2024). Backtesting: Definition, how it works, and downsides. Investopedia. https://www.investopedia.com/terms/b/backtesting.asp
Denny. (2020, July 13). Bukan emas, logam termahal di dunia jarang yang tahu. CNBC Indonesia. https://www.cnbcindonesia.com/market/20240713134109-17-554286/
Eldeen, A. N. (2023, November 25). Evaluating trading strategy performance metrics: A comprehensive overview. MQL5 Blog. https://www.mql5.com/en/blogs/post/755078
Gary, G. G. P., & Wikartika, I. (2023). Penerapan money management dan risk management pada trading forex. Jurnal (ISSN: 2614-3097).
Gilang, P. (2022). Pengertian komoditas dan produk unggulan. Gramedia Literasi. https://www.gramedia.com/literasi/apa-itu-komoditas/
Groette, O. (2024, July 12). Profit factor in trading: Definition, calculator, video and formula. Quantified Strategies. https://www.quantifiedstrategies.com/profit-factor/
Hayes, A. (2025). T-test: What it is with multiple formulas and when to use them. Investopedia. https://www.investopedia.com/terms/t/t-test.asp
Hilman, T. (2024). Mengenal apa itu pasar komoditas, jenis dan contohnya. PINA. https://pina.id/artikel/detail/mengenal-apa-itu-pasar-komoditas-jenis-dan-contohnya-tpufb9t2aju
Iswandiari. (2024). Indikator forex: Pengertian, fungsi, dan jenis indikator trading forex. GIC Indonesia. https://www.pineconnector.com/blogs/pico-blog/what-are-the-most-popular-metrics-for-trading-performance
Jeong, D. W., & Gu, Y. H. (2024). Pro Trader RL: Reinforcement learning framework for generating trading knowledge by mimicking the decision-making patterns of professional traders. Expert Systems with Applications, 254, 124465. https://doi.org/10.1016/j.eswa.2024.124465
Juarsah, R. M. F., et al. (2020). Perancangan human machine interface pada stasiun kerja pick and place simulator bottling plant menggunakan metode V-model. Telkom University. https://openlibrary.telkomuniversity.ac.id/knowledgestock/210575.html
Maghfira. (2024). Niatnya trading malah berakhir investasi, kok bisa? Poems Sekuritas. https://www.poems.co.id/htm/Freeducation/Newsletter/v15/Vol114_NiatnyaTradingBerakhirInvestasi.html
Malathong, K., Konpang, J., & Sirikham, A. (2023). Money management for trading strategies. International Electrical Engineering Congress. https://doi.org/10.1109/ieecon56657.2023.10126531
Maverick, J. B. (2022, April 10). What is a Sharpe ratio? Understanding its use in investing. Investopedia. https://www.investopedia.com/ask/answers/010815/what-good-sharpe-ratio.asp
MetaQuotes. (2023). MetaTrader 5 user guide. MetaQuotes Software Corp. https://www.metatrader5.com/en/terminal/help
Modento. (2024). Pengembangan expert advisor berbasis indikator MA, Relative Strength Index, dan Bollinger Bands dalam trading forex EUR/USD di MetaTrader 5 [Skripsi Sarjana, Universitas Negeri Medan].
MQL. (2024). Reference – How to use algorithmic/automated trading language for MetaTrader 5. MQL5. https://www.mql5.com/en/docs
Mulyana, D. I., & Riswan, A. (2023). Implementasi expert advisor untuk trading otomatis forex menggunakan indikator RSI dan MA dengan metode martingale di platform MetaTrader 4. Jurnal Indonesia: Manajemen Informatika dan Komunikasi, 4(3), 1463–1471. https://doi.org/10.35870/jimik.v4i3.324
Murarka, K. (2024, December 27). Successful trading: Money management in Forex – Safe trades and maximize profits. Edge-Forex. https://edge-forex.com/money-management-in-forex-safe-trades-and-maximize-profits/
Nasution, M. A. (2024). Perancangan dan pengujian kinerja expert advisor berbasis indikator RSI, MA, dan optimasi lot pada 10 pair forex populer dengan akun swap-free. Jurnal Sains, Teknologi & Komputer, 1(2), 62–68. https://doi.org/10.56495/saintek.v1i2.760
Nasution, M. A. (2025). Pengujian backtesting expert advisor berbasis Donchian Channel pada 10 pasangan forex dengan volume perdagangan tertinggi. Journal of Computers and Digital Business, 4(1), 10–15. https://doi.org/10.56427/jcbd.v4i1.609
Noertjahyana, A., Christopher, A., Abas, Z. A., Yusoh, Z. I. M., & Setiawan, A. (2020). Stop hunt detection using indicators and expert advisors in the Forex market. Journal of Physics: Conference Series, 1502(1). https://doi.org/10.1088/1742-6596/1502/1/012054
Norris, E. (2022). How do I place a stop-loss order? Investopedia. https://www.investopedia.com/ask/answers/021815/how-do-i-place-stop-loss-order.asp
Okpatrioka. (2023). Research and development (R&D) penelitian yang inovatif dalam pendidikan. Darma Acariya Nusantara: Jurnal Pendidikan, Bahasa dan Budaya, 1(1), 86–100.
Oppermann, A. (2023, April 6). What is the V-Model in software development? Built In. https://builtin.com/software-engineering-perspectives/v-model
Paningrum, D. (2022). Buku referensi investasi pasar modal. Lembaga Cakhra Brahmada Lentra.
Prabandari, A. I. (2023, August 22). Observasi adalah tahap pengamatan penelitian, ketahui jenis dan etikanya. Merdeka.com. https://www.merdeka.com/jateng/observasi-adalah-tahap-pengamatan-penelitian-ketahui-jenis-dan-etikanya-15378-mvk.html
Prabowo, M. (2020). Metodologi pengembangan sistem informasi. LP2M Press IAIN Salatiga.
Quantified Strategies. (2024, September 16). Secure F Money Management: Definition, meaning and tips position sizing. QuantifiedStrategies.com. https://www.quantifiedstrategies.com/secure-f-money-management/?utm_source=chatgpt.com
Razlozki, J. (2023, January 17). Perdagangan harian: Dasar-dasar dan cara memulai agar berjalan dengan lancar sesuai harapan. Investopedia. https://www.investopedia.com/articles/trading/05/011705.asp
Rizka. (2024, November 13). Memahami konsep drawdown dalam money management forex. Didimax. https://didimax.co.id/pusat-edukasi-gratis-id/memahami-konsep-drawdown-dalam-money-management-forex-18866
Samudera, B. (2023, June 8). Trading santai dengan strategi trend following! HSB Investasi. https://blog.hsb.co.id/forex/trading-santai-dengan-strategi-trend-following/
Samudera, B. (2023, November 23). Berikut faktor yang mempengaruhi pergerakan harga komoditas silver (perak). HSB. https://hsb.co.id/emas/faktor-harga-perak/
Samudera, B. (2024, January 29). Berbagai macam jenis trading online. HSB. https://blog.hsb.co.id/trading/macam-macam-trading/
Samudera, B. (2025, January 16). Peranan penting position sizing dalam trading forex untuk mencapai profit yang berkeseimbangan. HSB. https://blog.hsb.co.id/forex/pentingnya-position-sizing-dalam-trading-forex/
Sapitri, D. (2021). Strategi trading dengan reversal trend. Astronacci. https://astronacci.com/blog/read/strategi-trading-dengan-reversal-trend
Satria, O. (2024). Memahami strategi Donchian Channels dalam trading. Dupoin. https://www.dupoin.co.id/insights/market-analysis/35136/
Schlossberg, B. (2023). Forex: Money management matters. Investopedia. https://www.investopedia.com/articles/forex/06/fxmoneymgmt.asp
Siaurence, F., & Pangaribuan, H. (2022). Perancangan expert advisor untuk trading otomatis forex menggunakan indikator stochastic dan MACD pada platform MetaTrader 4. Jurnal Comasie, 6(1), 42–48.
Siswanto. (2024). Analisis statistik adalah: Pahami pengertian dan jenis data yang digunakan. DQLab Powerfull Learning. https://dqlab.id/analisis-statistik-adalah-pahami-pengertian-dan-jenis-data-yang-digunakan
Tanyu, P. (2024, July 8). 5 basic key trading metrics. Medium. https://medium.com/basic-key-trading-metrics-/
Thompson, C. (2024, April 5). What commodities trading really means for investors. Investopedia. https://www.investopedia.com/investing/commodities-trading-overview/
Tommy. (2024). Commodity market: Definition, types, example, and how it works. Investopedia. https://www.investopedia.com/terms/c/commodity-market.asp
TrendSpider. (2022). Donchian Channels: A comprehensive guide for trend following traders. TrendSpider Learning Center. https://trendspider.com/learning-center/donchian-channels-a-comprehensive-guide-for-trend-following-traders/
Vince, R. (1992). The mathematics of money management: Risk analysis techniques for traders. John Wiley & Sons.
Yadav, R. S. (2012). Improvement in the V-Model. International Journal of Scientific & Engineering Research, 3(1), 2229–5518.
Yahya, S., & Fianto, B. A. (2020). The analysis of descriptive statistics on the use of syariah fintech in Indonesia. Jurnal Ekonomi Syariah Teori dan Terapan, 7(7), 1336–1349. https://doi.org/10.20473/vol7iss20207pp1336-1349
Yuliati. (2024). Mengenal money management, jurus jitu antisipasi kerugian. GIC Indonesia. https://www.gicindonesia.com/jurnal/trivia/mengenal-money-management-adala
Yuyun, S. (2022). Sistem informasi manajemen. CV Edupedia Publisher.