Hi i try to make from one indicator to work as an AI all is well til this 2 things i need some help
first erorr is, ')' - unexpected end of program
secand erorr is, '{' - unbalanced parentheses
Don't show screenshots of code.
If you need help with your code, then provide all relevant code as an attached file or use the CODE button (Alt-S) when inserting code in your post.
- www.mql5.com
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
//+------------------------------------------------------------------+ //| PricePosition_Corrected.mq4 | //| Copyright 2023, [Your Name] | //+------------------------------------------------------------------+ #property copyright "[Your Name]" #property version "1.00" #property strict // Define the 'corner' enum enum corner { RightHand = 1, LeftHand = 0 }; // Define the 'YN' enum enum YN { Yes = 1, No = 0 }; // Define the input variables input corner cor = RightHand; input YN UseAlert = Yes; input color BuyColor = clrAqua; input color SellColor = clrOrangeRed; input color clrNT = clrYellow; // Declare the indicator buffers double angle[]; double signal[]; double media1[]; double media2[]; // Define the day of the week string day[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; int xdis = 0; int ydis = 135; color clrfont; int cal; int pal; int prc; int pdn; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { // Indicator buffers mapping IndicatorBuffers(4); SetIndexBuffer(0, angle); SetIndexBuffer(1, signal); SetIndexBuffer(2, media1); SetIndexBuffer(3, media2); SetIndexStyle(0, DRAW_SECTION, STYLE_SOLID); SetIndexStyle(1, DRAW_NONE); SetIndexStyle(2, DRAW_NONE); SetIndexStyle(3, DRAW_NONE); SetIndexLabel(0, "Turn"); SetIndexLabel(1, NULL); SetIndexLabel(2, NULL); SetIndexLabel(3, NULL); IndicatorShortName("PricePosition"); xdis = cor == 1 ? 133 : 30; return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { ObjectsDeleteAll(); GlobalVariablesDeleteAll(); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int i, limit; limit = rates_total - prev_calculated; if (prev_calculated > 0) { limit++; } ArraySetAsSeries(angle, true); ArraySetAsSeries(signal, true); ArraySetAsSeries(media1, true); ArraySetAsSeries(media2, true); ArraySetAsSeries(open, true); ArraySetAsSeries(high, true); ArraySetAsSeries(low, true); ArraySetAsSeries(close, true); for (i = limit - 1; i >= 0; i--) { media1[i] = iMA(_Symbol, 0, 26, 0, 2, 4, i); media2[i] = iMA(_Symbol, 0, 20, 0, 0, 4, i); signal[i] = (media1[i] + media2[i]) / 2; } for (i = limit - 1; i >= 0; i--) { if ((open[i] <= signal[i]) && (close[i] >= signal[i])) angle[i] = low[i]; else if ((open[i] >= signal[i]) && (close[i] <= signal[i])) angle[i] = high[i]; else angle[i] = EMPTY_VALUE; } double priceturn = 0.0; int seek = 0; int s = 0; while (seek < 1) { if (angle[s] != EMPTY_VALUE) { priceturn = angle[s]; seek++; } s++; } if (close[0] > priceturn) { CreateLabel(0, "AngleDirection", "BUY", "Verdana", 28, BuyColor, cor, xdis, ydis); CreateLabel(0, "AngleLevel", "above " + DoubleToString(priceturn, _Digits), "Verdana", 10, BuyColor, cor, xdis, ydis + 45); clrfont = BuyColor; cal = 1; if ((cal != pal) && (UseAlert == 1)) { Alert("*" + WindowExpert
Please, don't request help for ChatGPT (or other A.I.) generated code. It generates horrible code.
Please use the Freelance section for such requests — https://www.mql5.com/en/job
-
Stop using ChatGPT.
Help needed to debug and fix an AI EA - Trading Systems - MQL5 programming forum #2 (2023)ChatGPT (the worst), “Bots Builder”, “EA builder”, “EA Builder Pro”, EATree, “Etasoft forex generator”, “Forex Strategy Builder”, ForexEAdvisor (aka. ForexEAdvisor STRATEGY BUILDER, and Online Forex Expert Advisor Generator), ForexRobotAcademy.com, forexsb, “FX EA Builder”, fxDreema, Forex Generator, FxPro, Molanis, Octa-FX Meta Editor, Strategy Builder FX, Strategy Quant, “Visual Trader Studio”, “MQL5 Wizard”, etc., are all the same. You will get something quick, but then you will spend a much longer time trying to get it right, than if you learned the language up front, and then just wrote it.
Since you haven't learned MQL4/5, therefor 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 yours.
We are willing to HELP you when you post your attempt (using Code button) and state the nature of your problem, but we are not going to debug your hundreds of lines of code. You are essentially going to be on your own.
ChatGPT - Even it says do not use it for coding. *
- Mixing MT4 and MT5 code together.
- Creating multiple OnCalculate/OnTick functions.
- OnCalculate returning a double.
- Filling buffers with zero in OnInit (they have no size yet). Setting buffer elements to zero but not setting Empty Value to correspond.
- Calling undefined functions.
- Calling MT4 functions in MT5 code.
- Sometimes, not using strict (MT4 code).
- Code that will not compile.
- Creating code outside of functions. *
- Creating incomplete code. *
- Initialization of Global variables with non-constants. *
- Assigning a MT5 handle to a double or missing the buffer and bar indexes in a MT4 call. *
- Useing MT4 Trade Functions without first selecting an order. *
- Uses NULL in OrderSend. *
bot builder Creating two OnInit() functions. * EA builder EATree Uses objects on chart to save values — not persistent storage (files or GV+Flush.) No recovery (crash/power failure.) ForexEAdvisor - Non-updateing global variables.
- Compilation errors.
- Not checking return codes.
- Not reporting errors.
FX EA Builder - Not checking return codes.
- Loosing open tickets on terminal restart. No recovery (crash/power failure.)
- Not adjusting stops for the spread. *
- Using OrdersTotal directly.
- Using the old event handlers.
-
You have only four choices:
-
Search for it (CodeBase or Market). Do you expect us to do your research for you?
- Try asking at:
- Coding help - MQL4 programming forum
- Requests & Ideas - MQL4 programming forum
- Make It No Repaint Please! - MQL4 programming forum
- MT4 to MT5 code converter - MQL5 programming forum
- Please fix this indicator or EA - General - MQL5 programming forum
- Requests & Ideas (MQL5 only!) - Expert Advisors and Automated Trading - MQL5 programming forum
- Indicator to EA Free Service - General - MQL5 programming forum
- I will write an advisor free of charge - Expert Advisors and Automated Trading - MQL5 programming forum
- I will write you an advisor for free - Trading Systems - MQL5 programming forum
- I will write the indicator for free - MQL4 programming forum
-
MT4: Learn to code it.
MT5: Begin learning to code it.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.
I need HEEEELP, please, it's URGENT...really ! - General - MQL5 programming forum (2017) -
Or pay (Freelance) someone to code it. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2019)
We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
No free help (2017) -
- 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 try to make from one indicator to work as an AI all is well til this 2 things i need some help
first erorr is, ')' - unexpected end of program
secand erorr is, '{' - unbalanced parentheses