Expert Advisors and Automated Trading - page 13

Hello everyone, I'm seeking help with an initialization issue with the MetaTrader5 Python library. My script is as follows: import os import MetaTrader5 as mt5 from dotenv import load_dotenv load_dotenv() print ( "Initializing..." ) # Initializes the MetaTrader5 connection if not mt5.initialize()
How can I test or use classes derived from CExpertSignal without using the StrategyTester? For example, I have CSignalMA (a child from CExpertSignal, located in Expert/Signal) . I want to have something like this: 1. go to the last 200 bars 2. show entry, exit signals derived by CSignalMA in
Is there a way to programmatically, or using Settings on MetaQuotes, to have an EA automatically selected and run on a chart? It would be nice if the account could be set up to automatically select a Chart currency, timeframe and an EA to run on the chart whenever the account is started. How is this
I have discovered that during MT5 backtesting, when a symbol's swap type is set to "in percentage terms," the swap fee is calculated as zero. This is likely because the value is too small and the program rounds it down to zero. Taking ******* US100 as an example: the current price per lot is
Hello, I’ve developed a custom EA that has a maximum memory footprint of 1.5GiB per agent/thread when running locally. With an average memory utilization of under 1GiB (~600-800MiB) Whenever I run the current year period, that is from January 2025 until August 2025, I get a critical error displayed
Hello All, I've seen this mentioned in various places, but I haven't been able to find a solution on any of the threads that have worked for me. When I run a optimisation session on my EA, the "backtest" results section matches up with the "run single test" perfectly everytime, whereas the forward
I have an EA that assigns a different magic number to a particular strategy or setup within the single EA. Is there a way to get MQ5's HistorySelect() to retrieves the history of deals and orders for only a specific Magic number? Does HistorySelect use a Magic number when it creates its lists of
Hi, I have a technical question regarding automated preset management for Expert Advisors in production environments. I wonder if it is possible to programmatically load .set preset files into already-running Expert Advisors using MQL5 code? or can MQL5 scripts automatically attach Expert Advisors
  VPS (mt5)  (2)
If i buy 12 months sub for the vps ; but also have 1k free minutes, what is used first? I have 22 charts, but in terms of the vps, can only have 16 charts migrated to the vps when on free minutes, so -- will my full 22 charts be migrated or just 16
Hay, I am new to programming and this is my first EA. I used PositionsTotal()<=0 to count all positions, now I want to use magic numbers to count positions. I would like to ask if there are any other solutions or methods. if (PriceInfo[ 1 ].open > Buffer_belowlin_FS[ 1 ] && PriceInfo[ 1 ].open >
I use CExpert and initialize the constructors in int OnInit() : int OnInit () { if (!myExpert.Init( Symbol (), Period (),ExpertEveryTick,ExpertMagicNumber)) { //--- failed printf ( __FUNCTION__ + ": error initializing expert" ); myExpert.Deinit(); return (- 1
  EA settings  (3)
I bought <EA name removed> and after installation I change the settings but when I open it next day the settings change to default, how to solve this problem thanks
Repost with photos... I am using a custom symbol with imported tick data and am testing the spread option where it lets you input your own desired spread number. But for me I have found that no matter what I input in that spread box, either 1 or 100, the results in the backtest do not change. I have...
In the following script, history_order.PriceOpen() returns value of 0.0. Why
Hi,  I try to program  a simple script.  My question: How do I get the value of the ATR (average true range) indicator in a script? I've found the function "iATR" (https://www.mql5.com/en/docs/indicators/iatr) but it does not return the current ATR value. Any ideas?   Thank you. Best, Chris 
In MQL4, OrderSend() has a color parameter (see https://docs.mql4.com/trading/ordersend). Since I'm using MQL5 with the CExpert class, I added the standard CTrade class to the CExpert instance. CTrade has an OrderOpen() function, which unfortunately doesn't have a color property. However, it does
Hi MQL5 Community, I'm working on an EA specifically for XAUUSD and running into some interesting challenges that I'd like to discuss with fellow developers. The Technical Challenge: Gold's behavior differs significantly from major currency pairs. While EUR/USD responds predictably to technical
I have recently run some 1, 3 , 5, 10 and 15 year back tests with my EA. I came across something I have never noticed before and I am pretty concerned about it. I ran a backtest from Jan of 2015 to Current data and my maximal DD was at roughly 10% See picture one. But when I run from 2015 to 2020
I guess if an EA work well in live account, it may not be good in tester. If I am right, what should I do to improve my EA ?
Hi I have the following MQL4 code:- if (CountOrders( 0 )!= 0 || CountOrders( 1 )!= 0 ) { for ( int b= OrdersTotal ()- 1 ; b>= 0 ; b--) { if ( OrderSelect (b,SELECT_BY_POS)== true ) { if (OrderSymbol()== _Symbol && OrderMagicNumber()==OrderMagic)
Is there an easier way to do a Git Commit on multiple source files at the same time than to select each file individually and then doing a single file Git Commit? I have multiple source files that I would like to do a Git Commit at the same time as a group. How can I Commit multiple files at the
Hi, I am currently trying to use the class CMoneyFixedRisk::CheckOpenLong(double price, double sl) (from the Expert/Money/MoneyFixedRisk.mqh library) to estimate the appropriate volume to open a long position, for a given risk per trade and a given SL value. My first attempts systematically retuned
Hi all, I have a helper class that saves the pnl history and some other metrics that I use for analytics on my strategies. It runs on the OnTester funcion and locally stores under a backtests folder inside the MetaQuotes\Terminal\Common\Files path. However, when running on the MT5 Cloud Network I
My Expert Advisor (EA) supports multiple virtual trading "agents", each with different trading parameters and lotsizes. The Expert Advisor ID ( magic number) is a parameter in the MqlTradeRequest input structure to OrderSend (). It would be very useful to be able to distinguish the various trade
I have a mqproject (consisting of a MyEa.mq5 and a .mqproj file within the folder called "custom") and would like to use indicators from MQL5/Indicators/Examples in my EA. With a simple EA without embedding it in a .mqproj , indicators can be loaded successfully without the need to include them
please correct me if i am wrong i have found that the mql5 bot cant know the on real time while testing the strategy , the values of the indicator and they know only the values at the closure of the candle like for example a 30 min candle how can i fix this ? as i want for example a value to be
Hello All, With the latest MT5 update, I am hitting something I don't understand; a little script to illustrate the compiler warning am hitting: #include <Internal\TimeSpan\TimeSpan.mqh> /* Note: from <Internal\TimeSpanTimeSpan.mqh>: void operator=(const TimeSpan &t) {
Moring to all Im trying to install Metatrader 5 in google colab looking to get some databases. On the next screen shot the errors that I´m getting. Can any one give me a hand or an code or any ideas on how to install this library
This is an ATR step based trailing stop and it works fine in the strategy tester but would like feedback on the SERIES_SYNCHRONIZED and iBarShift checking. Did I do it correctly or am I missing something crucial? Originally I was storing the ATR value in the trade comment since my broker never
The function Oncalculate() can not be used in an expert. So we have to create our indicator separately from our expert and run both the expert and the indicator on the chart. I have a global variable in my indicator(that I wrote it in metaeditor) and I want to change the amount of this variable when