Hello nik13,
You need to be very precise with your coding. Just a letter missing or added in the wrong place will stop it from working. Everything you write (or don't write) will have a meaning.
At the moment, your code will not compile because of missing or extra code where it shouldn't be. My guess is that you have cut and paste other bits of code (which is a good way to learn) but you've either cut-off part of it or pasted too much.
I suggest you start with the standard template and very carefully insert your code into it. Be very careful with brackets, commas and semicolons.
Do it little by little, checking that it compiles as you go along. That way you know exactly what has stopped it working and can fix it straight away.
Move your cursor onto anything that shows up as purple or blue and press F1. You can then read about what that bit of code is doing, and also examples of how it should be used.
//+------------------------------------------------------------------+ //| Template.mq4 | //| Copyright 2015, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict #property indicator_chart_window //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| 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[]) { //--- //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+
Hello nik13,
You need to be very precise with your coding. Just a letter missing or added in the wrong place will stop it from working. Everything you write (or don't write) will have a meaning.
At the moment, your code will not compile because of missing or extra code where it shouldn't be. My guess is that you have cut and paste other bits of code (which is a good way to learn) but you've either cut-off part of it or pasted too much.
I suggest you start with the standard template and very carefully insert your code into it. Be very careful with brackets, commas and semicolons.
Do it little by little, checking that it compiles as you go along. That way you know exactly what has stopped it working and can fix it straight away.
Move your cursor onto anything that shows up as purple or blue and press F1. You can then read about what that bit of code is doing, and also examples of how it should be used.
I'm glad that you replayed here, thanks!
Can you explain please what exactly is the string?
Well, at this point I know, that > extern string info=example < will be showed on the indicator/EA window as some sort of "description" of everything that is below/above of it.
But is that the only use for string? what else it can? unfortunately I was not able to find good explanation of it.
Hello nik13,
You need to be very precise with your coding. Just a letter missing or added in the wrong place will stop it from working. Everything you write (or don't write) will have a meaning.
At the moment, your code will not compile because of missing or extra code where it shouldn't be. My guess is that you have cut and paste other bits of code (which is a good way to learn) but you've either cut-off part of it or pasted too much.
I suggest you start with the standard template and very carefully insert your code into it. Be very careful with brackets, commas and semicolons.
Do it little by little, checking that it compiles as you go along. That way you know exactly what has stopped it working and can fix it straight away.
Move your cursor onto anything that shows up as purple or blue and press F1. You can then read about what that bit of code is doing, and also examples of how it should be used.
I'm glad that you replayed here, thanks!
Can you explain please what exactly is the string?
Well, at this point I know, that > extern string info=example < will be showed on the indicator/EA window as some sort of "description" of everything that is below/above of it.
But is that the only use for string? what else it can? unfortunately I was not able to find good explanation of it.
Hello nik,
I've sent you an email.
Hello Nik13,
sorry to tell you bu t I doubt that you are going to learn how to code straight out off the MQL language. The reason is that the manual is not really intended for that purpose but it is rather an informative book of the functions (not to be mixed with the functions as a part of the MQL language) , and the book present here is, as well, quite basic and introductory. My main advise is to learn first some C. I say "some" because you do not really have to go to the end when learning that language, but only a few parts out of it could suffice as well. I do not recommend C++ as it is unnecessary complex (IMO) and you are often forced to change the way you are programming, compared to the C language. But as I said, this is my personal view and nothing more and you may decide for your self. Now, to get you on I believe you have to grab a good book or site; sites are often free as well. I do not know if I am allowed to write about specific books here, but you may also find very good books online for low prices - that means you can buy and download books in electronic format if you wish.
best regards
Hello Nik13,
sorry to tell you bu t I doubt that you are going to learn how to code straight out off the MQL language. The reason is that the manual is not really intended for that purpose but it is rather an informative book of the functions (not to be mixed with the functions as a part of the MQL language) , and the book present here is, as well, quite basic and introductory. My main advise is to learn first some C. I say "some" because you do not really have to go to the end when learning that language, but only a few parts out of it could suffice as well. I do not recommend C++ as it is unnecessary complex (IMO) and you are often forced to change the way you are programming, compared to the C language. But as I said, this is my personal view and nothing more and you may decide for your self. Now, to get you on I believe you have to grab a good book or site; sites are often free as well. I do not know if I am allowed to write about specific books here, but you may also find very good books online for low prices - that means you can buy and download books in electronic format if you wish.
best regards
I found one good book, one video tutorial and one good guy who's willing to help, so I will make it somehow.
best regards
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
so here is my first indicator (nothing that much, just trying to code something that will work) but at the fine point, I do not know what I'm doing wrong. can you help me please? I do not want you to improve it, just tell me what I'm doing wrong and how to avoid such mistakes in the future.
Best regards