icustom EA errors

 

Hi All


So I am trying to code an EA using and indicator called "FL11" but I seem to be getting about 7 errors. 


What I want is for the indicator to show then buy or sell, maybe I'm missing some code as well.


Code attached

#property copyright "Copyright 2022, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict


input double      Period1        = 12.0;
input double      Period2        = 34.0;
input double      Period3        = 69.0;
input string      Dev_Step_1     = "5,3";
input string      Dev_Step_2     = "5,3";
input string      Dev_Step_3     = "5,3";
input int         Symbol_1_Kod   = 172;
input int         Symbol_2_Kod   = 174;
input int         Symbol_3_Kod   = 82;              
input string      ____           = "";
input bool        Box.Alerts     = false;
input bool        Email.Alerts   = false;
input bool        Sound.Alerts   = true;
input bool        Alert.Lv1      = false;
input bool        Alert.Lv2      = false;
input bool        Alert.Lv3      = true;


//////////////////////////////////////////////////////////////////////////////////

int OnInit()
  {

   return(INIT_SUCCEEDED);
  }
void OnDeinit(const int reason)
  {

   
  }


//////////////////////////////////////////////////////////////////////////////////

void OnTick()
  {
int indicator_buffer = iCustom
(
NULL, //NULL means current symbol
0, //0 means the current chart timeframe
"FL11", //indicator name(always have it in the main directory)
Period1,
Period2,
Period3,
Dev_Step_1,
Dev_Step_2,
Dev_Step_3,
Symbol_1_Kod,
Symbol_2_Kod,
Symbol_3_Kod,
____,
Box.Alerts,
Email.Alerts,
Sound.Alerts,
Alert.Lv1,
Alert.Lv2,
Alert.Lv3, 
0, //mode
0 //shift
);

if(indicator_buffer > 0) // If the buffer is showing a positive value (buy signal)

{ 
  
  double lot_size = 0.01; // Set the lot size for the order
  double stop_loss = Bid - 100 * Point; // Set the stop loss for the order
  double take_profit = Bid + 100 * Point; // Set the take profit for the order
  
  OrderSend(Symbol(), OP_BUY, lot_size, Ask, 3, stop_loss, take_profit, "Buy order", 0, 0, Green); // Place the buy order
  
}
   
  }

////////////////////////////////////////////////////////////////////////////////////////


Discover new MetaTrader 5 opportunities with MQL5 community and services
Discover new MetaTrader 5 opportunities with MQL5 community and services
  • 2023.02.19
  • www.mql5.com
MQL5: language of trade strategies built-in the MetaTrader 5 Trading Platform, allows writing your own trading robots, technical indicators, scripts and libraries of functions
Files:
Capture.JPG  128 kb
 

Please edit your post to use the CODE button (Alt-S)!

Use the CODE button


 
  1. Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
              Messages Editor

  2. Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
              General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
    Next time, post in the correct place. The moderators will likely move this thread there soon.

  3. Stop using chatgpt.

    Chatgpt (the worst), EA builder, EA Builder Pro, EATree, Etasoft forex generator, Forex Strategy Builder, ForexEAdvisor, ForexRobotAcademy.com, forexsb, FX EA Builder, fxDreema, Forex Generator, FxPro, Molanis, Octa-FX Meta Editor, Online Forex Expert Advisor Generator, 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.

    1. 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.

    2. Chatgpt
      1. Mixing MT4 and MT5 code together.
      2. Creating multiple OnCalculate/OnTick functions.
      3. OnCalculate returning a double.
      4. Filling buffers with zero in OnInit (they have no size yet). Setting buffer elements to zero but not setting Empty Value to correspond.
      5. Calling undefined functions.
      6. Sometimes, not using strict.
      EA builder makes bad code:
      1. Counting up while closing multiple orders.
      2. New bar code: Bars is unreliable (Max bars in chart), volume is unreliable (miss ticks.) Always use time.
      3. Not adjusting for 4/5 digit brokers, TP/SL and slippage.
      4. Not adjusting for ECN brokers. pre-Build 500)
      5. Not checking return codes.
      EATree
      uses objects on chart to save values — not persistent storage (files or GV+Flush.) No recovery (crash/power failure.)
      FX EA Builder makes bad code:
      1. Not checking return codes.
      2. Loosing open tickets on terminal restart. No recovery (crash/power failure.)
      3. Not adjusting stops for the spread.
      4. Using OrdersTotal directly.
      FOREXEADVISOR STRATEGY BUILDER makes bad code:
      1. Non-updateing global variables.
      2. Compilation errors.
      3. Not checking return codes.
      ForexEAdvisor makes bad code:
      1. Not checking return codes.
      2. Not reporting errors.
 
Sergey Golubev #:

Please edit your post to use the CODE button (Alt-S)!



Edited my post thank you

 
William Roeder #:
  1. Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
              Messages Editor

  2. Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
              General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
    Next time, post in the correct place. The moderators will likely move this thread there soon.

  3. Stop using chatgpt.
Thank you for the advice, I did use chatgpt but I did also implement some of my own code trying to fix the errors
 
Taariq Gamieldien #Thank you for the advice, I did use chatgpt but I did also implement some of my own code trying to fix the errors

There is nothing to be done. ChatGPT produces such bad code that it is more difficult to try fix it than it is to learn to do it properly.

Instead search the CodeBase for something similar to what you are trying to achieve and then adapt it to your needs.

 
Fernando Carreiro #:

There is nothing to be done. ChatGPT produces such bad code that it is more difficult to try fix it than it is to learn to do it properly.

Instead search the CodeBase for something similar to what you are trying to achieve and then adapt it to your needs.

I didn't know it was that bad. I'm still a beginner when it comes to code that is why I did not notice it
 
Quick Start: Short Guide for Beginners
Quick Start: Short Guide for Beginners
  • www.mql5.com
Hello dear reader! In this article, I will try to explain and show you how you can easily and quickly get the hang of the principles of creating Expert Advisors, working with indicators, etc. It is beginner-oriented and will not feature any difficult or abstruse examples.
Reason: