Could you please write script for Expert tick function of EA of MT5 trding bot?
- User
Could you please write script for Expert tick function of EA of MT5 trding bot?
- Assistant
- User
do you have any sophisticated logic which helps to trade maximizing profits and recovering previous number of lots losses consecutively?
- Assistant
- User
do you have any sophisticated logics which helps to trade maximizing profits and recovering previous number of lots losses consecutively? could you please employ martingale or anti-martingale strategy in above EA by ensuring maximizing profit and minimizing overall loses?
- Assistant
- User
Does above scripts need any additional mqh files to be included?
- Assistant
The provided EA script does not require any additional
.mqhfiles or libraries to function. It is a self-contained script that uses standard MQL5 functionalities available in the MetaTrader 5 environment.Components Used in the EA
-
Standard MQL5 Functions: The script utilizes built-in MQL5 functions such as:
-
- User
I just now compile AntiMartingaleEA in Meta Editor, it returns few errors: following is error description and line numbers 'OP_BUY' - undeclared identifier 96 'OrderSend' - wrong parameters count 96 built-in: bool OrderSend(const MqlTradeRequest&,MqlTradeResult&) 96 'OP_SELL' - undeclared identifier 107 'OrderSend' - wrong parameters count 107 built-in: bool OrderSend(const MqlTradeRequest&,MqlTradeResult&) 107
- Assistant
- User
could you please add more Additional risk management and trading logic for above script for high speed trading?
- Assistant
- User
do you have EA named Francisco.mhq for MT5 Trading bot?
- Assistant
As of my last update in October 2023, I'm not able to directly access external databases or provide specific user-created EAs like "Francisco.mqh" if it's not widely recognized or part of public repositories. The name does not correspond to any widely known or publicly available EA as far as I am aware.
If you are looking for a specific EA named "Francisco" or similar, you would usually find these in trading forums, EA marketplaces, or communities focused on algorithmic trading. Here are a few general steps for finding or creating such an EA:
-
Search on Trading Forums: Websites like MQL5 community, Forex Factory, or dedicated trading forums may have threads or users discussing their custom EAs, including "Francisco".
-
MQL5 Market: The official MQL5 market offers a wide range of EAs, and you might find something similar by searching there.
-
Building Your Own EA: If you have specific functionalities in mind, I can help guide you through writing an EA based on your requirements. Just describe the trading strategy you have in mind!
-
- User
previously the details I have give to you to create an EA, it is from Francisco. The script you created have many errors.
- Assistant
- User
Thanks the errors are disappeared magically except following few lines: please sort it out and fix them: //+------------------------------------------------------------------+ //| Function to Check if trend is up | //+------------------------------------------------------------------+ bool IsTrendUp() { double maCurrent = iMA(Symbol(), MA_Timeframe, MA_Period, 0, MODE_SMA, PRICE_CLOSE, 0); double maPrevious = iMA(Symbol(), MA_Timeframe, MA_Period, 0, MODE_SMA, PRICE_CLOSE, 1); return (maCurrent > maPrevious); }
//+------------------------------------------------------------------+ //| Function to Check if trend is down | //+------------------------------------------------------------------+ bool IsTrendDown() { double maCurrent = iMA(Symbol(), MA_Timeframe, MA_Period, 0, MODE_SMA, PRICE_CLOSE, 0); double maPrevious = iMA(Symbol(), MA_Timeframe, MA_Period, 0, MODE_SMA, PRICE_CLOSE, 1); return (maCurrent < maPrevious); }
- Assistant
- User
Following lines are giving error description: 'iMA' - wrong parameters count line number 51
- Assistant
The error you're encountering regarding the
iMAfunction is often due to the specific requirements for the parameters in MQL5. In MQL5, when using the function, the syntax has changed slightly from MQL4, and certain parameters might be different. - User
Could you please re-write following codes by defining parameters, identifiers and constructions properly without needing additional mqh libraries? bool IsTrendUp() { double maCurrent = iMA(Symbol(), MA_Timeframe, MA_Period, 0, MODE_SMA, PRICE_CLOSE, 0); double maPrevious = iMA(Symbol(), MA_Timeframe, MA_Period, 0, MODE_SMA, PRICE_CLOSE, 1);
if (maCurrent < 0 || maPrevious < 0) // Optional: Check for invalid MA return false; // Return false if MA values are invalid return (maCurrent > maPrevious);}
//+------------------------------------------------------------------+ //| Function to Check if trend is down | //+------------------------------------------------------------------+ bool IsTrendDown() { double maCurrent = iMA(Symbol(), MA_Timeframe, MA_Period, 0, MODE_SMA, PRICE_CLOSE, 0); double maPrevious = iMA(Symbol(), MA_Timeframe, MA_Period, 0, MODE_SMA, PRICE_CLOSE, 1);
if (maCurrent < 0 || maPrevious < 0) // Optional: Check for invalid MA return false; // Return false if MA values are invalid return (maCurrent < maPrevious);}
- Assistant
- User
in above script now this error is coming: error message is wrong parameter count in line number 156 // Trading Logic based on closing prices and moving averages bool isBuySignal = lastClose > prevClose && IsTrendUp(); bool isSellSignal = lastClose < prevClose && IsTrendDown();
- Assistant
- User
everything seems works fine except following few lines; I have pasted here error descriptions and its line numbers 'ORDER_BUY' - undeclared identifier 169 'slippage' - undeclared identifier 170 'ORDER_SELL' - undeclared identifier 187 'slippage' - undeclared identifier 188
- Assistant
- User
- Assistant
- User
if I use it request.slippage instead of request.stoplimit. and ORTER_BUY and ORDER_SELL it returns errors.
- Assistant
- User
it does not fix it by encoding request.slippage and ORDER_BUY ORDER_SELL instead. what is request.slippage means in the EA?
- Assistant
- User
Still same error, this time give you error description, linu number and column number so that you could locate exact where the error is taking place:
'ORDER_BUY' - undeclared identifier 151 24 'slippage' - undeclared identifier 152 17 'ORDER_SELL' - undeclared identifier 169 24 'slippage' - undeclared identifier 170 17
- Assistant
- User
now only remained errors is Slipapage undeclared identifier, what to do? do I need to encode #define slippage=3;?
- Assistant
- User
yes it is defined at the top exactly copy of input int Slippage = 3;
- Assistant
- User
After testing the //Test Minimal EA, it returns the same error: 'slippage' - undeclared identifier at line 11 at column 13
- Assistant
- User
Nope! no improvement, still same error: 'slippage' - undeclared identifier 27 13 'slippage' - undeclared identifier 29 39
- Assistant
- User
same error: 'ORDER_BUY' - undeclared identifier 35 'slippage' - undeclared identifier 36 'slippage' - undeclared identifier 39 is it experiencing the error because of version difference of MT5?
- Assistant