Mql5 code idea of indicators for beginners? - page 4

 

Hello
I made this code, it's very simple but should give you the basics.
You also have the code which is given in the doc on the IMA function to compare if you want
He's there
Free download of the 'Moving average code for beginners by William210' indicator by 'William210' for MetaTrader 5 in the MQL5 Code Base, 2023.08.24

Don't forget to put stars for SEO

Moving average code for beginners by William210
Moving average code for beginners by William210
  • www.mql5.com
Moving average beginner tutorial to learn how to code in MQL5
 
Gerard Willia G J B M Dinh Sy:
Hello
Are you okay?

I am looking for ideas for developing indicators for the dummies .

These codes will be put in CodeBase and therefore free. 
These codes will be very simple and therefore a very good support to start learning because that's the goal.
The beginner, or the confirmed can very easily complicate them for their own needs

I focus only on indicators, no EA, no script, no library

Thank you 

Hi, Willia! Thank you so much for your indicator coding tutorials. My question is, what template or platform are you using to do your indicator coding, because it doesn't match with mine, so, I don't know where am wrong because am not getting positive result because of that. I'm using MQL5 WIZARD template. I understand your teaching examples, but when it comes to filling the information on the wizard template, I find that some of the labels for the information are missing and I don't know what to do because yours in the example is little bit different from mine. I need more guidance. Thanks in advance for the answer.

 
Gerard Willia G J B M Dinh Sy #:

Hello
I made this code, it's very simple but should give you the basics.
You also have the code which is given in the doc on the IMA function to compare if you want
He's there
Free download of the 'Moving average code for beginners by William210' indicator by 'William210' for MetaTrader 5 in the MQL5 Code Base, 2023.08.24

Don't forget to put stars for SEO

Thank you for the moving average code, but there's an issue with the time frames that I'd like to see if it can be resolved. Let me explain: Let's say I want to use the code you provided with a 100-period moving average on a 1D time frame (daily), but I want to display it on a chart with a 12H time frame (12 hours, showing the 1D line). When I do that, the value of the 1D moving average distorts, causing the line itself to become distorted as well. I've experimented with the GBPAUD pair on September 29, 2023, where on the 1D time frame, I get a value of 1.916070. However, when I switch to the 12H time frame on the same date, the value distorts, giving me a result of 1.911762 (September 29, 2023, 00:00) and another value of 1.912179 (September 29, 2023, 12:00). I believe it should give me the original value of 1.916070 in either of the 12H time frames. Furthermore, as I reduce the time frames, the values distort even more, affecting the line. I'll send images for a better understanding. On another note, what is this about evaluating with stars? (I'm new to this). My sincere thanks for your response, greetings.

Files:
1D.png  28 kb
12H_0000.png  31 kb
12H_1200.png  27 kb
4H.png  30 kb
 
Thomas Salane # :
J'utilise le modèle MQL5 WIZARD

Good morning
Me too, from time to time I copy and paste another indicator which I modify as I wish in metaeditor because it is my default editor.


Beautiful day

 
jose221280 #:

Thank you for the moving average code, but there's an issue with the time frames that I'd like to see if it can be resolved. Let me explain: Let's say I want to use the code you provided with a 100-period moving average on a 1D time frame (daily), but I want to display it on a chart with a 12H time frame (12 hours, showing the 1D line). When I do that, the value of the 1D moving average distorts, causing the line itself to become distorted as well. I've experimented with the GBPAUD pair on September 29, 2023, where on the 1D time frame, I get a value of 1.916070. However, when I switch to the 12H time frame on the same date, the value distorts, giving me a result of 1.911762 (September 29, 2023, 00:00) and another value of 1.912179 (September 29, 2023, 12:00). I believe it should give me the original value of 1.916070 in either of the 12H time frames. Furthermore, as I reduce the time frames, the values distort even more, affecting the line. I'll send images for a better understanding. On another note, what is this about evaluating with stars? (I'm new to this). My sincere thanks for your response, greetings.

Good morning
Please use my code
I don't understand everything about your message because my code does not take into account the timeframe change

g_PtMA = iMA ( Symbol (), Period (), g_MAPeriod, g_MAShift, g_MAMethod, g_MAApplied)

You may have modified it to have the choice of TF, after all that's what I wanted, but unfortunately I can't help you much.


In some time I will offer my own code in the marketplace for the choice of symbol and period, but that is another story.

Best regards

Ps I wonder how you were able to display a TF of H12?

 
jose221280 #:

Thank you for the moving average code, but there's an issue with the time frames that I'd like to see if it can be resolved. Let me explain: Let's say I want to use the code you provided with a 100-period moving average on a 1D time frame (daily), but I want to display it on a chart with a 12H time frame (12 hours, showing the 1D line). When I do that, the value of the 1D moving average distorts, causing the line itself to become distorted as well. I've experimented with the GBPAUD pair on September 29, 2023, where on the 1D time frame, I get a value of 1.916070. However, when I switch to the 12H time frame on the same date, the value distorts, giving me a result of 1.911762 (September 29, 2023, 00:00) and another value of 1.912179 (September 29, 2023, 12:00). I believe it should give me the original value of 1.916070 in either of the 12H time frames. Furthermore, as I reduce the time frames, the values distort even more, affecting the line. I'll send images for a better understanding. On another note, what is this about evaluating with stars? (I'm new to this). My sincere thanks for your response, greetings.

No the other timeframes shouldn't hold the same value as the D1timeframe, why should it? The moving average is naturally different for all timeframes, it gets the moving average plot for the current timeframe. Different timeframes warp the moving average in terms of price sensitivity on that timeframe and shorter timeframes produce more signals. Use any moving average and you'll see


If you wanted the moving average to be fixed to the D1 timeframe, you will change the iMA call like so:

iMA( Symbol(), PERIOD_D1, g_MAPeriod, g_MAShift, g_MAMethod, g_MAApplied);
 

Good morning.

My developments in CodeBases are cited in the Mql5 community telegram group.


Thank you very much, it will make me have a great day and it will motivate me to do more.


On second thought, definitely the Keltner canal

Have a good day
 
Fernando Carreiro #:
Lets take for example, a Keltner Channel, which would require using both a moving average and the average true range. For this example, you would need to use the functions iMA and iATR, and use them together to form the Keltner Channel. In this way, you would be showing the "newbie" coder, not only how to use the native "iFunctions", but also how to combine them and build something more complex and useful.

Good evening.

Thanks for the code idea for the Keltner indicator.

I just made it in a very simple version


https://www.mql5.com/en/forum/456258

Indicators: Keltner Channel code for beginners by William210
Indicators: Keltner Channel code for beginners by William210
  • 2023.10.24
  • www.mql5.com
Articles, Library comments: Indicators: Keltner Channel code for beginners by William210
 
I am starting to study MQL5, and I have to say that I have really appreciated these codes of yours. Their simplicity makes it clear and simple for people that are just starting. No joke, but after months trying to figure out how MQL5 works, I saw your codes and said..men this is simple... I understand the need to create complex codes that will cover all basics, but for people that it just starting that level of complexity is overwhelming... anyway, my experience has been all but positive, and I am sure others that are just starting will appreciate your codes.
 
Camilo Mora #:
I am starting to study MQL5, and I have to say that I have really appreciated these codes of yours. Their simplicity makes it clear and simple for people that are just starting. No joke, but after months trying to figure out how MQL5 works, I saw your codes and said..men this is simple... I understand the need to create complex codes that will cover all basics, but for people that it just starting that level of complexity is overwhelming... anyway, my experience has been all but positive, and I am sure others that are just starting will appreciate your codes.

Good morning.
Thank you for your comment, it counts.