MQL4TUTORIAL.COM

MQL4TUTORIAL.COM

By MQL4TUTORIAL.COMBusinessInvesting
Download on the App Store

MQL4TUTORIAL.COM episodes

  • MQL4 TUTORIAL – 99 NEW LIVE CROWD ALGO TRADING SYSTEM
    In this video, I would like to talk about a new algorithmic trading system that I have released on January the 1st, 2021.   This is the system. I have published it on MyFxBook so you can see the live statistics. And in the last few days, I have done something that is really uncommon for me and I would like to talk about why I did it. Well, this is the System Statistics page. Currently we have a profit of one point five one percent. I started to publish the statistics on January the 1st and you can see that the balance curve is rising, but it gets flat here.   And I wanted to know if it is possible to improve that because I have seen for other systems that usually the first few days or weeks are better. Therefore, I decided to manually close trades. That was yesterday. And if you have seen a few of my videos, you know that I usually don’t do that. But actually, I’m curious to see if it is possible to increase the profits by doing just that. Therefore, I have coded a function.   When I click into the chart and the upper left corner, I will get this window. Would you like to close all positions? I will not do that right now, but I have done it yesterday and that means that currently we have a profit of four hundred and fifty dollars.   That means we have a gross profit and a net profit of one point five one percent. After 12 days, that translates to 15 percent and about 120 days and as a year has three hundred and sixty five days, we would expect forty five percent here. But you can check for yourself. I called this system Crowd Algo Trading System because Crowd Company is the name of my company. And if you copy that term and paste it into Google, you should already see a lot of results.   This is the YouTube channel. This is the video from yesterday. Actually, there is also a playlist. And when you go to the website and click on one of the videos, you might also run the automated video recordings here on the website. It’s automated because I need to do one of those each day. And below the videos you will find the download button, the download for the Expert Advisor demo version. And you can also download the current statistics here.   If you do that and open the statistics, you should see a current timestamp. Now, I’m curious about the next days and weeks. I expect the system to work because actually it is a cloned version of this system here. This one performed very well in 2020. You see the big draw down here, that is March 2020, when the first shutdown came up, but actually the system recovered very well. So I’m happy with the results and I hope that the new system will also be able to do that.   If you are interested to find out what works and why it works, you can go to the public system page on MyFxbook or just google the term. For now, I will let the system do its job, so that’s it for this video. If you have any questions or suggestions about this kind of system operation, please let me know. And for now, I would like to say thank you for watching.
    5 min
  • MQL4 TUTORIAL 98 – HOW TO CLONE YOUR MQL4 SYSTEM
    In this video, I would like to talk about how to clone an existing Metatrader4 system, including all the automated stuff, so let’s see how we can do that. To get started, you need a running system, like I have this one and this system is running on a Windows machine. Usually when you click on open data folder, you will see that you have an installation and that the data for the system is located in the user folder in windows.   But it’s possible to run a portable version. This is a different Windows 10 machine. Here we have an USB stick. On the USB stick I have the portable version. It contains all these directories and now I can copy the portable version and paste it anywhere in the file system. Here is all the stuff that I need. And when I double click on Terminal.exe, we should see that the Metatrader is started in the background and here it is.   Actually, this kind of portable version is the one that I have copied from my current Linux installation. I’m running it on wine and play on Linux, but I think it should be possible to do it on a Windows machine when you just create a folder and copy the content for these folders into that folder. And that includes the experts folder where I have my pre configured system and the Expert Advisor for the My MF Book Status Updates. You need to include the library folder and you need to provide your account settings because those are not copied.   So this is the original account. I’m using a roboforex pro cent account 5281754. So let’s pick the right server – 5281754.   I need to provide my password and save it. Click on Finish and now I’m connected and it looks like I’m able to do a strategy test with my pre configured system here. So that’s working as expected. And in this little video, you have learned how to clone an existing system and create a portable version for a different Windows PC.   If you have any questions or suggestions about this set up, please let me know.
    4 min
  • MQL4 TUTORIAL BASICS 97 – SIMPLE REVERSE POSITION
    In this video, we are going to create an Expert Advisor that is able to change the buy or sell direction for each position, 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 reverse position, click on Continue, continue and finish.   Now you can delete everything above the ontick function and let’s also remove the two comment lines here. First, we want to create a variable for the direction. This is a string variable called direction. And the initial value will be buy, for the simple example. Now let’s add an input variable. An input variable can be modified by the user without recompilation. It can be done by simply changing the Expert Advisor properties in the strategy tester or on real charts.   This variable will be an integer variable called take profit points and we are going to set the initial value to 50. Now let’s do that again, this time for the stop loss points. We are going to use 30 points for the initial stop loss. And inside the ontick function, we want to check if OrdersTotal equals zero. If that is true, we would have no open position. And we also want to check if the direction equals buy and if that is true, we want to open a buy ticket, that is done by using ordersend for the current symbol on the chart, we use OP_BUY because we want to open up by trade. For 10 Microlot, for the ask price, the tolerance value is three and this value here will set the stop loss for us to the value of points that we have created in the variable here, the next expression will set the take profit points. This could be a comment that we don’t need. We also don’t need a magic number and we do not need to set an expiration date.   The last parameter is for the color of the line, in this case, we use green. And because we want to change the direction every time, we are now going to set the direction variable to sell. That’s it for the buying part. For the selling part, it is almost equal.   We check if orders total delivers a value of zero and if the direction equals sell. And if that is true, we use OrderSend for the current symbol. This time we use OP_Sell because we want to sell 10 microlots. And when we sell, we need to use the Bit price, the tolerance value is the same. This will set the Stop-Loss above the current sell trade and this will set the take profit below the current sell trade. The rest is the same, except for the fact that we are using red lines for sell trades.   And after we have opened the ticket, we set the direction for the next trade to buy. Well, why would anybody do stuff like that? It’s a good way, for example, to check if the other components of a trading system work well. And when you do this here and set the values for the take profit and for the stop loss to different point values, you will likely learn something that you didn’t expect. Now, let’s add a comment statement for the text.   The current direction is followed by the direction. And that’s about it, if this was too fast for you or if you have no idea what all the code here does, maybe you want to watch one of the other videos in the basic video series. Or maybe even the Premium Course might be interesting for you, you can find that one on our Web page where we also offer a starter course for just one dollar right now. But for now, please click on the Compile button or press F7.   You shouldn’t get 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, you want to click on View, Strategy Tester or Press Control and R. Please pick the new file. Simple reverse position dot .ex4 mark the option for the visual mode here and start your test. Here we are. This is the first position you can see that the take profit value is bigger than the stop ...
    7 min
  • MQL4 TUTORIAL BASICS – 96 SIMPLE MOVING TEXT OBJECT
    In this video, we are going to create such a moving text label, this one is for the low price. It is moving as the low price for the current candle changes. So let’s find out how to do that with MQL4. To get started, please click on a little icon here 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 moving text. Click on continue. Continue and finish. Now you can remove everything above the ontick function and let’s also get rid of the two comment lines here, we start with object create that will create an object called moving text. This is the object name and this is the object type. There are two ways to do that.   If you click here, you can see that the number of parameters are changing. So let’s mark that and press F1. And now we see that we need to pass a few more parameters after the object type. We need to tell Metatrader the window in which we want the object to be created. And two more variables for the time and the price. I have set all three parameters to zero. Window zero is the main window with the candles and for the time and the price we are going to use object move.   Now we can use object set text for our moving text object. We want to see the text low price followed by a colon, and afterwards we want the value for the low price for candle zero. The font size will be eight. We are going to use this font type and it should be a red text. I would like to have a vertical text output. So no, I’m going to change a property that is done by using ObjectSetDouble.   The first parameter is for the current window. We want to change the property for the object called moving text. The property I want to change is object property angle and I set it to ninety degrees. Afterwards we are going to move the object, that is done by using object move for the object called moving text.   This is the anchor point of the object. Basically it’s for the alignment and we want to move the object to the point in time for the current candle zero to the low price of candle zero and that’s about it. Not much code. But if it was too fast for you or if you have no idea what all the code here does, maybe you want to watch one of the other videos in our basic video series. Or maybe even the Premium Course on our website might be interesting for you, for now, please click on Compile or Press F7.   You shouldn’t get any errors here, 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 you want to click on View Strategy Tester or press Control and R. Please pick the new file Simple moving text dot .ex4, mark the option for the visual mode here and start a test. Here we are, our object is drawn on the chart. Actually, this was a question from a Premium Course member, and if you would like to become a Premium Course member or if you would like to download other source codes for MQL4, you can do that on our website, because now you know how to create a moving price object in MQL4. And you have coded it yourself with a few lines of code in Metaeditor.
    5 min
  • MQL4 TUTORIAL BASICS – 95 SIMPLE LOW GANN FAN
    In this video, we are going to create this kind of object. This is a LowGannFan object from the lowest candle to the current candle. 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 you want to click on file. New file Expert Advisor from Template, continue. I will call this file simple LowGannFan, click on Continue, continue and finish. Now you can delete everything above the Ontick function and the two comment lines here. First, we want to calculate the number for the first visible bar. And that can be done by using this function. It is called Window First Visible Bar, that will return the index of the first visible bar.   So that’s not the value. That’s just the number.   Now we can calculate the number for the lowest candle on the chart. And that can be done by using the function ilowest, because that will give us the lowest value over a specific number of bars, depending on time, for the current symbol on the chart and the currently selected period on that chart. We use ModeUnerscoreLow because we are interested in the lowest prices of the candles, and that is for all the candles on the chart up to the current candle zero, before we create a new object, we use object delete, that will delete all the objects called simple LowGannFan.   Because we want to avoid that we draw several objects at the same time, the very first time we call this function, we will not have such an object. But afterwards, we want to make sure that we remove the old object before we draw a new one. Once that is done, we use object create to create a new object. And this will need a few parameters. So let’s go through the parameter values one by one. The first parameter is for the chart ID, that’s chart ID zero in our case.   The second is the object name. In our case it is called simple LowGannFan. You can call it whatever you like as long as you use the same name everywhere. Parameter three is for the object type. We are using OBJ_GannFan. If you mark that and press F1, you will see that there are other object types, depending on the type of the object, you would need to use other parameters. We are going to create this kind of object, and in the next parameter we are going to tell Metatrader that we want to draw it in the main window, that’s window zero, the one with the candles, the object should be drawn from the point in time where the lowest candle appears on the chart.   This is always the time scale and here are the values. The next parameter is for the lowest price of the lowest candle. So these two values here define the starting point. The object should be drawn to the point in time where the current candle is drawn and the last parameter is for the low of the current candle. And that’s it for this object creation. Of course, you could change the parameters here, but for this simple example, this is good enough.   Now let’s continue and change a few values, that can be done by using ObjectSetInteger for the current chart ID zero. We want to change a property for the object that is called simple LowGannFan. The property I want to change is called object property underscore color and I would like to see a red color. Let’s change another property. The first part is the same. But I would like to change object property, Ray, and set it to true, that will give us a kind of object prediction because that will draw the object to the current candleand into the future.   So far, so good. If this was too fast for you or if you have no idea what all the code here does, maybe you want to watch one of the other videos in the basic video series or maybe even the Premium Course on our website might be interesting for you. For now, please click on the compile button or press F seven on your keyboard. You shouldn’t get any errors. And if that is the case, you can click on a little button here or press F4 to go back to Metatrader.
    7 min
  • MQL4 TUTORIAL BASICS – 94 SIMPLE SPREADSHEET FILE WRITER
    In this video we are going to create an expert advisor that is able to write values for the high and the low price of the last candle into a spreadsheet. So let’s find out how to do that with MQL4. To get started, please click on the 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 Spreadsheet Writer. Click on Continue, Continue, and Finish. Now you can delete everything above the OnTick function and the two comment lines here. Static means that a variable will remember the value inside of this function for as long as the program is running. I need two variables, one for the last high price and one for the last low price, because that makes it possible to compare if the value for the last high is equal to the high price for candle one, and if the last low price is not the one that we see for candle one now, we know that we have a new candle, and that’s when we want to write the values into our file. We need to define a file name. In my case, I used the file name Spreadsheet.CSV. This file extension here is recognized by most spreadsheet solutions like Excel or LibreOffice. I think it stands for Comma Separated Values. And now that we have the file name, we try to open the file. That can be done by using File Open. For our spreadsheet, here we want to use File Read and File Write. The mode for the file is File_CSV, and we are going to use File ANSI, so let’s mark that and press F1. And you will see that we can use Unicode or ANSI code. Unicode would be used for special characters, but we are only going to use values and simple text. I don’t want to replace the current content in the file, so I use FileSeek for our file handle here. I start with the index zero, and I want to go to the end of the file, so I use SeekEnd for the file end. And now we can append the content. To do that we use File Write for our spreadsheet handle, and each value is separated with a comma here. This is text. This is the value for the time stamp. Time is a value in seconds since the 1st of January in 1970. This is for candle one, and I would also like to append the text High and the high price for candle one, followed by the text Low and the low price for candle one. After we have written, we need to close the file. That is done by using File Close for our spreadsheet handle. And finally, we are going to assign the current value for the high price and the low price of candle one to the variables Last High and Last Low, because the next time we call the function, the current values will be the last ones. Now let’s close the IF loop here. I would like to add a comment statement to output the values on the chart, and that’s about it. If this was too fast for you, or if you have no idea what all the code here does, maybe you want to watch one of the other videos in the basic video series, or maybe even the premium course on our website might be interesting for you. For now, please click on the Compile button or press F7 on your keyboard. We don’t have any errors here, and if that is the case, you can click on a little button here or press F4 to go back to MetaTrader. In MetaTrader you want to click on View, Strategy Tester, or press control and R. Please pick the new file Simple Spreadsheet Writer.ex4. Mark the option for the visual mode and start your test. Here we see different values. So let’s find out if we have created the spreadsheet file. So please click on File, Open Data Folder. This will show me all the folders below the Terminal folder here. I need to click on Tester, Files, and here is my Spreadsheet.CSV file. Let’s double click it. Here is the preview. I click on Okay, and indeed the spreadsheet file is working. So now you could append other values here. All you would need to do is to change this one line here. And in this little video you have learned how to create an expert advisor th...
    7 min
  • MQL4 TUTORIAL BASICS – 93 SIMPLE HIGH GANN FAN
    In this video we are going to create such an object here. It’s a Gann Fan object, and we want to find out how to code that with MQL4. To do that, 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 one SimpleHighGannFan. Click on continue. Continue and finish. Now you can remove everything above the OnTick function, and let’s also remove the two comment lines here. The first thing I want to do is to calculate the number for the candles on the chart. I can do that by using WindowFirstVisibleBar. If you mark that and press F1, you will see that it will return the index of the first visible bar in the current chart window. That’s the number of the bar not the value. And the result will be assigned to this variable. The next step is to calculate the number for the highest candle, and that can be done by using iHighest. If you mark that and press F1, you will see that it will return the maximum value. In our case, for the current symbol on the chart and the currently selected period on that chart, we use MODE_HIGH because we want the high prices. You could also use numbers, but this one is better to read. And I would like to calculate the highest price for all the candles on the chart, starting from the current candle, zero. Now that we know how many candles we have on our chart, and we know which one is the highest candle, we want to use ObjectDelete to delete former objects with that name, SimpleHighGannFan, because whenever we want to draw a new object, we want to remove the old values. This object will not exist the very first time we call the function, but afterwards, we want to use it every time. That will remove the old object before we create a new one. And to create a new one, we use ObjectCreate. That can be used to create different objects. Here is the list with the object types. There are several object types. Depending on the type you want to use you need to pass different parameters. In our case, we are using this one to create such a Fan object. So let’s go through the values. The first one is zero. That’s for the current chart. The second one is the name of the object. In our case, SimpleHighGannFan, parameter three is the object type. And we are using OBJ_GANNFAN. Please use capital letters. The object should be drawn in the main chart. That’s windows zero. I would like to start with the highest candle and we are using the point in time when the highest candle was drawn. The next parameter is for the high of the highest candle. And I would like to draw until the point in time where we have the current candle zero. And the last point is the highest price for candle zero. You can modify these values, but for this simple example, it’s good enough. That’s the object create part. Now let’s modify two properties. The first property I want to change is the color. And I can do that by using ObjectSetInteger for chart ID zero. And for the object that is called SimpleHighGannFan, the property I want to change is called object, property, color. And I would like to have orange. Let’s set another property. And that one is called object, property, ray. And it will create a kind of prediction because it will draw the object to the current candle and into the future. So, let’s set this property to true and that’s about it. 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 our basic video series. Or maybe even the premium course on our website might be interesting for you. For now, please click on the compile button or press F7 on your keyboard. You shouldn’t get any errors. And if that is the case, you can click on a little icon here or press a four to go back to MetaTrader. And in MetaTrader, we want to click on view, strategy tester or press control and R. Please pick the new file,
    7 min
  • MQL4 TUTORIAL BASICS – 92 SIMPLE DEVIATION CHANNEL OBJECT
    In this video, we are going to create a deviation channel object like this one. 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 SimpleDevChannelObject. Click on continue. Continue and finish. Now you can delete everything above the OnTick function and the two comment lines here. First, we need to calculate the number of candles on the chart and to do that, we use the function WindowsFirstVisibleBar, that will return the index or the number of the first visible bar on the current chart. I also would like to know the number for the lowest candle, and we can calculate that by using iLowest for the current symbol on the chart and the currently selected period. For low prices, we use MODE_LOW, for all the candles on the chart starting with the current candle, 0. Now let’s repeat the whole process and calculate the highest candle. That can be done by using iHighest. For the current symbol on the chart and the currently selected period, this time we use MODE_HIGH, for all the candidates on the chart. And we also start with candle 0. Now, before we create a new object, we use ObjectDelete to select the last channel object that we have created. We will not have such an object the very first time we call this function, but afterwards, we want to make sure that the former object that is called SimpleChannel will be deleted and afterwards we can draw another one. And that is done by using ObjectCreate. So let’s find out what parameters we need to fill. The first parameter is 0, that is for the current chart that we are using. The second parameter is the name of the object. It is called SimpleChannel. The next parameter is called OBG_STDDEVCHANNEL. So let’s mark that and press F1. Here is the object type that we want to create. There are lots of different object types and when we click on this one, we see that it will create a standard deviation channel right on our chart. That’s what we want. And then the next one parameter we are telling MetaTrader to draw it on the window 0, that’s the main window with the candles. If you like to use oscillators, you know that there are things like the MACD and when you use that one, you will create a second window below the candle chart window, but we don’t want to do that. The next parameter is for the point in time, that’s here. We have date times here and values here, and I would like that the deviation channel is drawn from the point in time where the first candle on the chart is drawn. The next parameter is for the lowest price of the lowest candle. I would like the channel to be drawn for the current candle that’s candle 0. Once again, I pass the low of the LowestCandle as a parameter here. And the second line should be drawn for all the candles on the chart. And here, I would like to have the high of the HighestCandle as a point of reference. And that’s it for the object creation. These values might not be perfect for you, so feel free to use your own values here, but it works for this simple example. Now let’s change a few values. The first one is for the color and to change that we use ObjectSetInteger for the chart ID 0, and the object that is called SimpleChannel, we want to change the property called object property color, and change it to yellow. Let’s continue and do that again. This time we want to change the object property style and use a solid line. So we use STYLE_SOLID. The next one is for the object width. This one is called OBJPROP_WIDTH and we use 3. That will give us a thick line. Let’s add another one. This one is called ObjectSetInteger for OBJPROP_RAY. That will give us a prediction and draw the channel right into the future. And there is another one. This one is called OBJPROP_DEVIATION. Let’s set this value to 2, and that’s about it.
    8 min
  • MQL4 TUTORIAL BASICS – 91 SIMPLE CHANNEL OBJECT
    In this video we are going to create a channel object that will show us the highest and the lowest prices on the chart, so let’s find out how to do that with mql4. To get started please click on the 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 channel object, click on continue, continue and finish. Now you can delete everything above the ontick function and the two comment lines here. First, we need to find out how many candles we have on our chart that can be done by using the function, window first visible bar because it will return the index of the first visible bar in the current chart window. Afterwards, we need to calculate the lowest candle on the chart – that’s the number of the candle – and we can do that by using ilowest for the current symbol on the chart and the currently selected period on that chart, we use mode underscore low – all in capital letters – we want to do that for all the candles on the chart up to the current candle zero. Let’s repeat the process this time for the highest candle! Now we use the function ihighest for the current symbol on the chart and the currently selected period on that chart. This time we use mode underscore high for all the candles on the chart up to candle zero. Now we want to delete old objects by using object delete. I want to delete each object that is called simple channel, we will not have such an object the first time we call this function but afterwards, we want to delete the old value before we create a new object. And to do that we use object create that uses a lot of parameters, so let’s go through the list here. The first parameter zero stands for the current chart, parameter two is the name of the object, I have called it simple channel but you can call it whatever you like as long as you use the same name everywhere. The next parameter is for the object type, we are using obj channel and if you mark that and press F1 you will see that there are lots of different object types depending on the type you use you might need to other parameters. Now let’s continue! This parameter will tell Metatrader where to draw the object. I would like to have the channel in the main window where we have the candles if you use oscillators like here you will have separate windows. Now let’s define the points for our line! The first one is a time parameter because this here is telling us the time of the candles and I would like to start from the first visible candle on the chart. Now let’s define the price point. I would like to use low that’s the lowest price for a candle and I would like to have the lowest price for the lowest candle, that’s a value because here we have the different values, so now we have a point in time where we want to start and we have a value and I would like our channel line to be drawn to the current candle zero but actually, not to the low of the current candle, I use low of the lowest candle again and for the second line I would like that line to start at the point in time for the first visible bar on the chart like we did here and this one should go through the high of the highest candle on the chart. Now our object is finished. Let’s change some properties that can be done by using object set integer for the chart id zero and the object that we have called simple channel, I would like to change the object property color and change that to yellow. Let’s repeat that! This time I want to set the object property style and I would like to have a solid line, so I use style solid here. Let’s continue! This time we want to change object property width, I use three that will give us a thicker line and the last property is called object property ray that will give us a kind of prediction and draw the line into the future. So that’s it. If you have no idea what all the code here does or if this was too fast ...
    7 min
  • MQL4 TUTORIAL BASICS – 90 SIMPLE LOW PRICE TREND LINE OBJECT
    In this video we are going to draw a line object from the lowest low of the lowest candle of the chart to the current low of the current candle, 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 low price line, click on continue, continue and finish. Now you can delete everything above the ontick function and the two comment lines here. First, we want to calculate the number of candles on the chart and that can be done by using the function, window first visible bar. If you mark that and press F1 you will see that it returns the index of the first visible bar in the current chart window so the current candle is always candle zero and the first visible bar is the first candle here on the left side. Now let’s find out which one is the lowest candle and we can calculate that by using the function, ilowest for the current symbol on the chart and the currently selected period on that chart, we are going to use mode underscore low because mode underscore low will give us the low price for the candles, in this case for all the candles on the chart starting with candle zero – that’s the current candle – and the result will be stored in the variable called lowest candle. Afterwards, we want to delete formal line objects that are called simple low line trend. The first time we run the code we will not find such an object but afterwards, we want to make sure that the old objects are deleted before we draw a new one. And that is done by using object create, we need to pass a few parameters here. The first parameter is zero and it stands for the current chart, the second parameter is for the name of the object, parameter three is for the object type, we use obj underscore trend. There are lots of different object types that are available. Now we need to tell Metatrader where to draw the object and I would like to draw the line in the main window that’s the one with the candles. For the starting point, we want to start at the time in point where we have the lowest candle, this here is the timeline, the next parameter is for the price point of the lowest candle, this is the price value-line, so now we have defined the starting point, and I would like the line to be drawn to the current candle zero and once again we need to provide the time followed by the value that’s the low of the current candle zero and now our object is finished. Let’s change a few properties! To do that we use object set integer for the chart id zero and the object that is called simple low line trend, we want to change the object property color and I would like to have a red line. Similar is it to change the object property style, we have object set integer, same chart id and the same name for the object but this time we change another property called object property underscore style, I would like to have a solid line, so I use style underscore solid. If you prefer another style you could use something like style underscore dot for a dotted line. Now let’s continue! This time I would like to change the property object property width, I use one because I want a thin line and finally, let’s set the object property ray to true that will draw the line from the lowest low to the current low and into the future. Now we are finished. 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 the basic video series or maybe even the premium course on our website might be interesting for you, for now, please click on the compile button or press F7 on your keyboard, you shouldn’t get any errors here and if you have some that might be caused by a simple mistake. In the last video, I missed a semicolon here and after I clicked on the compile button,
    7 min

About MQL4TUTORIAL.COM

From the publisher's feed

MQL4 Tutorial for Metatrader 4 or MT4 about automated trading, trading robots, MQL 4 and MQL programming