Artwork

เนื้อหาจัดทำโดย MQL4 TUTORIAL เนื้อหาพอดแคสต์ทั้งหมด รวมถึงตอน กราฟิก และคำอธิบายพอดแคสต์ได้รับการอัปโหลดและจัดเตรียมโดย MQL4 TUTORIAL หรือพันธมิตรแพลตฟอร์มพอดแคสต์โดยตรง หากคุณเชื่อว่ามีบุคคลอื่นใช้งานที่มีลิขสิทธิ์ของคุณโดยไม่ได้รับอนุญาต คุณสามารถปฏิบัติตามขั้นตอนที่อธิบายไว้ที่นี่ https://th.player.fm/legal
Player FM - แอป Podcast
ออฟไลน์ด้วยแอป Player FM !

MQL4 TUTORIAL BASICS – 107 SIMPLE ARRAY REFERENCE

5:05
 
แบ่งปัน
 

ซีรีส์ที่ถูกเก็บถาวร ("ฟีดที่ไม่ได้ใช้งาน" status)

When? This feed was archived on December 18, 2021 00:33 (2+ y ago). Last successful fetch was on October 24, 2021 04:05 (2+ y ago)

Why? ฟีดที่ไม่ได้ใช้งาน status. เซิร์ฟเวอร์ของเราไม่สามารถดึงฟีดพอดคาสท์ที่ใช้งานได้สักระยะหนึ่ง

What now? You might be able to find a more up-to-date version using the search function. This series will no longer be checked for updates. If you believe this to be in error, please check if the publisher's feed link below is valid and contact support to request the feed be restored or if you have any other concerns about this.

Manage episode 293116769 series 1615247
เนื้อหาจัดทำโดย MQL4 TUTORIAL เนื้อหาพอดแคสต์ทั้งหมด รวมถึงตอน กราฟิก และคำอธิบายพอดแคสต์ได้รับการอัปโหลดและจัดเตรียมโดย MQL4 TUTORIAL หรือพันธมิตรแพลตฟอร์มพอดแคสต์โดยตรง หากคุณเชื่อว่ามีบุคคลอื่นใช้งานที่มีลิขสิทธิ์ของคุณโดยไม่ได้รับอนุญาต คุณสามารถปฏิบัติตามขั้นตอนที่อธิบายไว้ที่นี่ https://th.player.fm/legal

[This post contains video, click to play]

In this video, we are going to create an Expert Advisor that is able to pass a complete array as a parameter to different function. So let’s find out how to do that with MQL4. To get started, please click on a little icon here or press F4 on your keyboard. Now you should see the Metaeditor window and here you want to click on file. New file, Expert Advisor from template, continue. I will call this file simple array reference. Click on continue, continue and finish.

Now you can delete everything above the ontick function and the two comment lines here. We start by creating a small array. This is an integer array and we want to fill our array with a few numbers. Please keep in mind that the first array item is always index zero. These array items are like boxes and we assign values to these boxes. This is just for a simple example and it’s a good idea to create small little programs like this one to find out how things work, because now we want to find out if we are able to pass our array as a parameter to a user defined function that is called add values.

This function doesn’t exist so far, so we need to create it in a few seconds and we will get a returned result. So let’s create a chart output here. By using the comment statement. It will output the text the returned result is followed by the result that we have created, but this function doesn’t exist so far. So we need to create it now and our function will be called add values and it will get to the array as a single parameter.

And we are using this little trick here. This is for INT Integer and this little ampersands symbol is used for references, so now we can try to add a few values by adding the array indexes zero, one and two, and finally we use the return statement to return the result to the main function, and that’s about it. Well, if you have no idea what all the code here does or if this was too fast for you, maybe you want to watch one of the other videos in this basic video series.

And on our website, you can now find a link for basic courses that also contain the source codes for this basic video stuff. There is also the link for the Premium Course. This was another idea of a Premium Course member. And if you are already a Premium Course member and have an idea for a video like this one, please let me know. For now, please click on the Compile button or press F7 on your keyboard, that should work without any errors.

And if that is the case, you can click on a little button here or press F4 to go back to Metatrader. And in Metatrader we click on View, Strategy tester or press Control and R.

Please pick the new file simple array reference dot EX4.

Enable the visual mode here and start your test. Here is the Expert Advisor, and it says the returned result is fifty six. So now let’s go and check the source code. We have added up eight and 16. So this would be 24. The third item here is thirty two. And if we add all three items, the result is fifty six. So let’s actually add another value here for index three. Now recompile the code, stop the current test and restart it.

And this time it says that the returned result is one hundred and twenty. And in this little video, you have learned how to add up all the elements of an array that we have passed by a reference, and you have coded it yourself with a few lines of MQL4 code.


Not sure what to do? Click on the automated trading assistant below

The post MQL4 TUTORIAL BASICS – 107 SIMPLE ARRAY REFERENCE appeared first on MQL4TUTORIAL.COM.

  continue reading

32 ตอน

Artwork
iconแบ่งปัน
 

ซีรีส์ที่ถูกเก็บถาวร ("ฟีดที่ไม่ได้ใช้งาน" status)

When? This feed was archived on December 18, 2021 00:33 (2+ y ago). Last successful fetch was on October 24, 2021 04:05 (2+ y ago)

Why? ฟีดที่ไม่ได้ใช้งาน status. เซิร์ฟเวอร์ของเราไม่สามารถดึงฟีดพอดคาสท์ที่ใช้งานได้สักระยะหนึ่ง

What now? You might be able to find a more up-to-date version using the search function. This series will no longer be checked for updates. If you believe this to be in error, please check if the publisher's feed link below is valid and contact support to request the feed be restored or if you have any other concerns about this.

Manage episode 293116769 series 1615247
เนื้อหาจัดทำโดย MQL4 TUTORIAL เนื้อหาพอดแคสต์ทั้งหมด รวมถึงตอน กราฟิก และคำอธิบายพอดแคสต์ได้รับการอัปโหลดและจัดเตรียมโดย MQL4 TUTORIAL หรือพันธมิตรแพลตฟอร์มพอดแคสต์โดยตรง หากคุณเชื่อว่ามีบุคคลอื่นใช้งานที่มีลิขสิทธิ์ของคุณโดยไม่ได้รับอนุญาต คุณสามารถปฏิบัติตามขั้นตอนที่อธิบายไว้ที่นี่ https://th.player.fm/legal

[This post contains video, click to play]

In this video, we are going to create an Expert Advisor that is able to pass a complete array as a parameter to different function. So let’s find out how to do that with MQL4. To get started, please click on a little icon here or press F4 on your keyboard. Now you should see the Metaeditor window and here you want to click on file. New file, Expert Advisor from template, continue. I will call this file simple array reference. Click on continue, continue and finish.

Now you can delete everything above the ontick function and the two comment lines here. We start by creating a small array. This is an integer array and we want to fill our array with a few numbers. Please keep in mind that the first array item is always index zero. These array items are like boxes and we assign values to these boxes. This is just for a simple example and it’s a good idea to create small little programs like this one to find out how things work, because now we want to find out if we are able to pass our array as a parameter to a user defined function that is called add values.

This function doesn’t exist so far, so we need to create it in a few seconds and we will get a returned result. So let’s create a chart output here. By using the comment statement. It will output the text the returned result is followed by the result that we have created, but this function doesn’t exist so far. So we need to create it now and our function will be called add values and it will get to the array as a single parameter.

And we are using this little trick here. This is for INT Integer and this little ampersands symbol is used for references, so now we can try to add a few values by adding the array indexes zero, one and two, and finally we use the return statement to return the result to the main function, and that’s about it. Well, if you have no idea what all the code here does or if this was too fast for you, maybe you want to watch one of the other videos in this basic video series.

And on our website, you can now find a link for basic courses that also contain the source codes for this basic video stuff. There is also the link for the Premium Course. This was another idea of a Premium Course member. And if you are already a Premium Course member and have an idea for a video like this one, please let me know. For now, please click on the Compile button or press F7 on your keyboard, that should work without any errors.

And if that is the case, you can click on a little button here or press F4 to go back to Metatrader. And in Metatrader we click on View, Strategy tester or press Control and R.

Please pick the new file simple array reference dot EX4.

Enable the visual mode here and start your test. Here is the Expert Advisor, and it says the returned result is fifty six. So now let’s go and check the source code. We have added up eight and 16. So this would be 24. The third item here is thirty two. And if we add all three items, the result is fifty six. So let’s actually add another value here for index three. Now recompile the code, stop the current test and restart it.

And this time it says that the returned result is one hundred and twenty. And in this little video, you have learned how to add up all the elements of an array that we have passed by a reference, and you have coded it yourself with a few lines of MQL4 code.


Not sure what to do? Click on the automated trading assistant below

The post MQL4 TUTORIAL BASICS – 107 SIMPLE ARRAY REFERENCE appeared first on MQL4TUTORIAL.COM.

  continue reading

32 ตอน

ทุกตอน

×
 
Loading …

ขอต้อนรับสู่ Player FM!

Player FM กำลังหาเว็บ

 

คู่มืออ้างอิงด่วน