Your code is incomplete. Please show all relevant code when asking for help with your code.
Also please use the CODE button (Alt-S) when inserting code.
// Expert Advisor properties #property strict // Global variables double maxDrawdown = 0; double dailyDrawdown = 0; datetime lastDay = 0; int drawdownLabel; // Expert Advisor initialization function int OnInit() { // Create drawdown label on chart drawdownLabel = ObjectCreate(0, "DrawdownLabel", OBJ_LABEL, 0, 0, 0); ObjectSetInteger(0, "DrawdownLabel", OBJPROP_CORNER, CORNER_LEFT_UPPER); ObjectSetInteger(0, "DrawdownLabel", OBJPROP_XDISTANCE, 10); ObjectSetInteger(0, "DrawdownLabel", OBJPROP_YDISTANCE, 20); ObjectSetInteger(0, "DrawdownLabel", OBJPROP_FONTSIZE, 10); ObjectSetString(0, "DrawdownLabel", OBJPROP_FONT, "Arial"); ObjectSetInteger(0, "DrawdownLabel", OBJPROP_COLOR, clrRed); return(INIT_SUCCEEDED); } // Expert Advisor deinitialization function void OnDeinit(const int reason) { // Remove drawdown label from the chart ObjectDelete(0, "DrawdownLabel"); } // Expert Advisor tick processing function void OnTick() {} datetime currentDay = TimeCurrent(); { if (currentDay != lastDay) // New day, update daily drawdown and display on chart // Calculate equity change for the current day double equityChange = AccountInfoDouble(ACCOUNT_EQUITY) - AccountInfoDouble(ACCOUNT_EQUITY_PREVIOUS); // Calculate daily drawdown dailyDrawdown = MathMax(dailyDrawdown + equityChange, 0); // Update maximum drawdown if necessary }
This is the whole code :)
The code is a mess. Please stop using ChatGPT.
We cannot help you if you have no knowledge or understanding of how to code.
Either you take the time to learn to code (which will take a long time) or you hire someone to code it for you.
Stop using ChatGPT.
Help needed to debug and fix an AI EA - Trading Systems - MQL5 programming forum #2 (2023)
If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, I get an error: '{' - function definition unexpected
I have no clue what I am doing wrong, it's about the first bracket that the system just does not want to do. Please help.