Expert Advisors and Automated Trading - page 50

Hi everyone, How to close all positions instantly, without using the Sleep function as in the following code pls ? bool CloseAllPositions(){ int total = PositionsTotal (); for ( int i = total - 1 ; i >= 0 ; i--){ ulong positionTicket = PositionGetTicket (i); PositionSelectByTicket
This example is provided in build 3980: https://www.mql5.com/en/forum/454439 The iris.onnx model is generated through this python code: from sys import argv from skl2onnx import convert_sklearn from skl2onnx.common.data_types import FloatTensorType from sklearn.datasets import load_iris from
  i can help!  (10)
How do I make an EA from an elephant bar setup? and how can i handle the candle size issue? for example consider a 100p or 50p elephant bar vary depending on the chart I am using
Hi, I have an MQ4 indicator that formats date and time like this: 26.10.2023 - 09:11:45 using this code: // This will take broker time and turn it into format DD.MM.YYY string GetTime( datetime when= 0 ) { if ( when== 0 ) when= TimeCurrent (); return StringFormat ( "%02d.%02d.%04d -
  Best EA for Gold  (1)
Hello, what are the best Expert Advisors for XAUUSD that match this criteria? No Martingale No Grid No Averaging No Dangerous Methods of Money Management regards, Matt
Hello recently i found out someone renamed my ex4 and ex5 he/she removed my order send comment and copyright i don't know how this they managed to do thisi am thinking that my file had been decompiled or i dont know how else someone was able to remove my copyright and order send comment
Dear all, I am developing some experts in MQL5 and am running back tests on them. To make things faster, I also develop Power Shell (7) scripts which run tests in a non-interactive fashion, varying various trading parameters, including the leverage. I noticed that scripts sometimes give unexpected
Hi, After updating to build 4040 I'm experiencing problems with optimizations: my local agents (the threads of my PC) fail without any apparent reason. When this happens, the optimizations starts being much slower and the results are all zeros. I attached a screenshot of the Strategy Tester window
Hey gang, I've been at this one for a couple hours with no success yet. I've tried 2 brokers so far with the EA I'm porting over from MT4. One works fine, and on OspreyFX I get a retcode error 10030: Invalid order filling type. Print (" ORDER_FILLING_FOK =" + ( string )IsFillingTypeAllowed( _Symbol
I wanted to change AI's so after changing expert advisors I received a remark failed Trade is disabled and the new AI doesn't work. what can I do to change this
i create dialog and button UI, But cant Action after Click On Test Button BT10. Cant Print "Button Pressed" NewProject.mq5 #include <Trade\Trade.mqh> #include <GraphicalPanel.mqh> CTrade trade; CGraphicalPanel panel; int OnInit () { if (!panel.Oninit()){ return INIT_FAILED ;} return (
I'm currently learning how to apply moving average with indicators values. For example, in below code I am trying to have moving average data for Heiken Ashi indicator value. //+------------------------------------------------------------------+ //|Variable Initializer
hi, trading hours are not working, not sure if my news filter is working either. Does anyone want to check it for errors. just have to say that I am completely new to mql5 coding. THANKS
Hi, I want to store symbol name and symbol volume into an array. I found that array function ArrayFill can't be used on string data type, the only option that I found is using CArrayString. This is the first time that I used this library and this is the code that I tried to used to store 1 symbol
Hi all, purchased a pattern scanner and market structure breakout scanner on mql5. I've been using it for sometime now however, majority of the very good signals the scanners give have been missed. The scanner are mt5 based and they send me signals via mt5 terminal. Is there anyway to automate the
Hello community. I am currently coding an ea which will allow me to know if the market base line of the TDI indicator (trading dynamic index) which is an exponential moving average is inclined downwards or upwards. In my research I saw that I could use the slope which, if positive, means that the
Good day. I'm having an EA which is working very well without any problem but whenever I upload it to the market it always says Not validated and I don't understand why cause it has no errors. Can anyone maybe help me pass the validation 🙏. Thanks in advance
I have a trading algorithm set up with the MT5 python system and I noticed that it doesn't consistently execute trades as it should. I don't get any error messages, and if I re-run the algorithm again it will sometimes execute the exact same trade that didn't previously execute. No variables are
I've learned mql5 iteratively as I've been building my system. In the process, gotten better about abstraction, functional/oop design, using structures and arrays, reusing vars, constants, etc. My issue now is optimizing my code. It runs fine live since single thread performance isn't that big of a
When you close a trade partial, you see it get a comment "from # ticketnumber" and in the order history it get the comment "to # ticketnumber" When i want to code 3 partial close areas for a trade, then i need to count how often i have already close partial from the first trade, but i am looking for
for ( int i = PositionsTotal () - 1 ; i >= 0 ; i--) { ulong ticket = PositionGetTicket (i); if ( PositionSelectByTicket (ticket)) { pos.Side = ( ENUM_POSITION_TYPE ) PositionGetInteger ( POSITION_TYPE ); ENUM_POSITION_TYPE side = ( ENUM_POSITION_TYPE )
I have made an ea with my conditions and it cannot open a trade. Who can assist me
  Help With My EA  (5)
I keep getting this no money(error 134) Error when the strategy tester tries to Test the Ea on 1m timeframe ? test on EURUSD,H1 (netting) strategy tester report 21 total trades test on XAUUSD,D1 (netting) strategy tester report 16 total trades test on GBPUSD,M30 (netting) strategy tester report 9
Hi I am building a custom EA for MT5 When it is attached to a chart, the Socket Connection is made in OnInit() function & the connection is closed in OnDeinit() function while detaching the EA. My code is: int socket = - 2 ; // Socket Variable bool soc= false ; int OnInit () { if (socket == -
Hi all, My goal is to write a simple EA that cancels pending buy stops or sell stops whenever current price moves past original stop price. The EA - code attached below - works flawlessly for test sell stops (commented code for test sell stop). Yet, for test buy stops, the EA cancels pending order
[Deleted]
  EA Freezes  (3)
Sometime EA Freezes and there is no error. My EA runs on OnTimer I keep printing TimeLocal() on timer on comment but it also freezes How can i find the reason of Deinit or freeze? all works fine when I restart EA
Hello everyone I cannot get this thing to work. I am trying to read a moving average buffer from a downloaded indicator (AllAverages_v4.9_MT5), and want to read a few values to calculate entry (eg close above MA for a buy). I'll attach the indi file and paste my EA code. #include <Trade\Trade.mqh>
Hi all, maybe someone knows whether there will ever be the possibility of showing "Positions" in the backtest report? In MT4, they were clearly listed using their Open price + time, Close price + time and their total profit/loss. In MT5, only "Orders" and "Deals" are shown with no real connection to
Hi all, I developing an EA and I am using multiple currencies in it and I want to show arrow object on each chart for which I need chart id. The problem I am facing is I am unable to get chart if of the chart other then first chart while back testing. I am using following script to chartid of the
hello friend, I think there is a bug in mql5 an DeInit section, ObjectsDeleteAll(0) not working in OnDeinit. Error is 4022 When I remove expert drom "Expert List" it is ok but when I remove from Right top side of chart it's not working. Please see attached video . Does anyone know what the problem