Podcasts about mql4

  • 5PODCASTS
  • 218EPISODES
  • 6mAVG DURATION
  • ?INFREQUENT EPISODES
  • Feb 22, 2024LATEST

POPULARITY

20172018201920202021202220232024


Best podcasts about mql4

Latest podcast episodes about mql4

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE COMMODITY CHANNEL INDEX

MQL4 TUTORIAL

Play Episode Listen Later Feb 22, 2024 5:43


In this video we are going to trade the Commodity Channel Index, that's the Indicator right here; you see the two dotted lines and whenever the line here crosses the upper dotted line we consider that to be a sell signal and when it crosses the lower dotted line that would be a buy signal. In this video we are going to find out how to automatically calculate this signal with a few lines of MQL4 code. To do that please click on the little button here and now you should see the Metaeditor window and here you want to click on “File New Expert Advisor (template)” from template, “Continue”, I will call this file: “SimpleCommodityChannelIndex”, click on “Continue”, “Continue” and “Finish” and now you can remove everything above the “OnTick” function and the two comment lines here. Let's start with a string variable for the signal, that variable will also be called: “signal” – we don't assign a value because we are going to calculate that later on. Let's define our indicator that is done by using the “iCCI” function that comes with MQL4 and if you mark it and hit the F1 key you will see it takes a few parameters. The first parameter is for the symbol – that's actually the currency pair on your chart –, the second one is for the time frame, in our case we use the 1 minute time frame – another time frame could be 5 minutes or 15 minutes and so on –, the third parameter is for the averaging period, that's actually the period we use to calculate the signal and if you click on “Insert Indicators Custom CCI” you will see that the CCI period is 14, so that's what we are using here followed by a typical price. You could also use a close or an open price, the highest or the lowest price, and the last parameter here is for the shift. You could use a shift value to move the Indicator window to right or to the left. We are not going to use it so our last parameter will be 0. Now that we know the value we want to find out if it is above 100, so if the “ICCIValue” we have defined here is greater than 100 – that would be the case when it's above the dotted line here, because this is the 100-plus line –, we consider our currency pair to be oversold so we assign the word: “sell” to our signal. In the other case if our value is below -100, so if our “ICCIValue” is below -100 – that would be the case when the line is below the dotted line here, because the lower line is the minus 100 line – in that case we consider it to be a buy signal so we assign the word: “buy” to our signal. In the last step we create a chart output that is done by using the “Comment” function and we want to output the word: “Signal:” followed by the calculated signal (signal) and in a new line we want to have the output: “ICCI Value:” followed by the current ICC I value (ICCIValue). Okay. Please don't forget the closing bracket and when you are done you can click on the “Compile” button here or press F7 on your keyboard and now you should see an output like this. We have compiled it without any errors and without any warnings and in that case you can click on a little button here or press F4 to go back to Metatrader and in Metatrader we use a little trick; please click on “Insert Indicators Custom CCI” we will go with the default values here so please click on “OK”. Now you should see the little window with the Indicator below the candles and now we right-click in our chart and select: “Template Save Template” and save it as: “tester.tpl” because this is the template that our strategy tester is going to use for the next back test. If you don't see the strategy tester panel you can click on “View Strategy Tester” or press CTRL and R,

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE BOLLINGER BANDS EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Oct 15, 2023 7:36


In this video, we are going to talk about an Expert Advisor that can tell you if you should buy or sell based on the Bollinger Bands indicator. The Bollinger Bands indicator has three bands. This is the lower band. This is the middle band, and this is the upper band. Whenever a candle closes above the upper band and reenters into the bands this is a signal for a sell trade. In the other case when the candle closes below the lower band and you see a reentry from below this is a buy signal. Usually you won't see the Bollinger Bands in your back-testing and to change this you can insert the Bollinger Bands indicator, we are going to use the period of 20 candles and deviation value of 2 because that is the standard when you click reset. Now click on ok. I will change the properties here because I like the bands to have the red color. No I right click on the chart, click on Template/Save Template. I will call this one: Bollinger Bands.tpl. Tpl stands for Template. Now let's save this and when you start a new back-test you simply need to right click the chart, select template, Bollinger Bands and here we are. Now we are going to create an Expert Advisor that can calculate Bollinger Bands entry signals. To do that please click on the little button here or press F4 in your Metatrader and now you should see Metaeditor and here you want to click on File/New/Expert Advisor (template) from template. Continue (Next). I'll call this one Simple Bollinger Bands. Continue (Next), Continue (Next), and Finish, and now you can delete everything above the OnTick() function and the two comment lines here. Now let's create an empty string for the signal. I'll call it signal and it has no value here, and to calculate the lower Bollinger Band we use the function iBands. iBands is a built-in function of MQL4 and it takes a few parameters. The first one is _Symbol; that's the symbol on the chart, the second parameter is _Period; that's the currently selected period on the chart, like the minute or the hour chart. We will use 20 candles and the deviation of 2 because that is what you see when you click on the Bollinger Bands properties. Period 20 candles, deviation 2, we have no shift and we apply it on the close price so the parameter for the shift is 0, and we use: PRICE_CLOSE for the close price and because this is the lower Bollinger Band we use MODE_LOWER and it will be calculated for candle 1. To calculate the upper Bollinger Band, you basically do the same but this time we use MODE_UPPER, everything else is like in this line. Candle 1 is the candle before the current candle, now when this candle isn't finished this would be candle 1, and this would be candle 2. To calculate the value for candle 2 we repeat those two lines here and now the only thing we need to change in the two new lines is the last parameter for candle 2. Let's calculate a buy signal. Now if the Ask price is above the close price of the last candle; that's candle[1] and if the close price for candle[2] was below the lower band. That's close 2 is below the value of the previous lower Bollinger Band and if the close price for candle[1] is above the lower band so that's close 1 is greater than lower Bollinger Band that would be a signal to buy. In the other case if the price is below the last close so if Bid is below close 1 and if close 2 was above the upper band so close 2 is above previous upper Bollinger Band and close 1 is below the upper band so the close price for candle[1] is now below the upper Bollinger Band that would be a crossing like here and that would be a sell signal so we assign the word: sell to our signal.

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE SAR EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Sep 2, 2023 6:42


In this video we are going to create an Expert Advisor that uses the parabolic SAR indicator you see to create buy or sell signals here. Whenever these little dots here are below the current price, that would be a buy signal like right now, and when the direction changes like here and the dots appear above the price, that's a sell signal. Now how can we create an Expert Advisor that is able to produce buy and sell signals based on this indicator here? To do that please click on the little button over here or press F4 in your Metatrader. Now you should see the Metaeditor window here. Here you want to click on “File/ New/ Expert Advisor (template)” from template. Continue. I will call this one: Simple Parabolic SAR (SimpleParabolicSAR). Continue and finish. Now you can delete everything above the “OnTick” function and the two comment lines here. The first step is to create a string variable, we need it for the signal, so it's also called: “signal” and we do not assign any value here because we are going to calculate the value later on. Now let's actually calculate the SAR indicator, that is done by using the built in iSAR function. The first parameter will be the current symbol on the chart, the second parameter is the period, and you might ask yourself what these two values here mean? Well if you click on to: “Insert /Indicators /Trend /Parabolic SAR” you will see that the parabolic SAR indicator has a stat value of 0.02 and a max value of 0.2. This is actually what we use here 0.02 equals the step value and 0.2 equals the max value. The last parameter here is for a shift, but we don't want to shift the indicator value to the right or to the left so we use zero. Now let's find out if the SAR indicator is below the bid price because we know when it's below, that's an indicator for an uptrend and in MQL4 we simply use an “if” statement to find out if the SAR value we have calculated here is below the bid price. If that is the case that would be a buy signal, so let's assign the word “buy” to the variable signal we have created here. In the other case if the SAR indicator is above the ask price – that would be the case here – and it would be a little sell trend and to find out if that is the case we would use the “if” statement and find out if “MySARValue” is above the current ask price. In that case we would have a sell signal, so let's assign the word sell to the signal variable we have created. And last but not least we want to create a chart output, so we use the built-in command function to output the text: “MySARValue”, followed by the calculated value. This backslash “n” (“/n”) statement creates a new line for the output, and in the second line we want to output the word: “signal” followed by the calculated signal. Okay that's it! Don't forget the closing bracket here and when you are finished you can click on the compile button here or press F7 on your keyboard – Oh! I've accidentally out commented the “OnTick” function so let's recompile the code here, and now it says we don't have any errors and we have no warnings, and if that is the case for you, you can click on a little button here to go back to Metatrader. In Metatrader we use a little trick please click on “Insert /Indicators /Trend /Parabolic SAR”. Okay. Now right click into the template, select template, and save the template as: “tester.tpl” because the tester template is what Metatrader 4 is going to use for your back test. Let's click on save and select “View/ Strategy Tester” or press CTRL and R and in the Strategy Tester you want to select the “SimpleParabolicSAR.ex4” file. Don't forget to enable the visual mode here and now click on start.

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE EMA STOCHASTIC STANDALONE EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Aug 11, 2023 3:51


  In this video, we are going to create an Expert Advisor that uses the Parabolic SAR and Stochastic Oscillator indicators to generate buy and sell signals in MetaTrader. Let's see how we can do that. First, start the MetaEditor. You can do this by clicking on its icon or simply pressing the F4 key. We begin with the #include directive to import the Trade.mqh library. This library provides us with essential trading functions. Following this, we create an instance of the CTrade class named trade. This instance will be our primary tool for executing buy and sell orders. Next, we calculate the current asking price using the Symbol Info Double function with the parameters Symbol and SYMBOL ASK. This gives us the price at which we can buy. To ensure precision, we use the Normalize Double function, inputting the price and Digits to adjust the number of decimal places. Similarly, we determine the bid price using the Symbol Info Double function with the parameters Symbol and SYMBOL BID. This is the price at which we can sell. This price is also normalized using the Normalize Double function. We then set up an array named Price Info of type Mql Rates. This array will store our price data for specific time periods on the chart. Within the On Tick function, we sort our Price Info array using the Array Set As Series function to prioritize the latest data. We then fill this array with price data for the current symbol and time frame using the Copy Rates function. Here, we're copying data for three candles, giving us a snapshot of recent price movements. The closing price of the most recent candle is then determined using the Price Info[0].close reference. We then call the Check Entry function. Inside this function, we use the Parabolic SAR indicator to check the current and previous values to determine if there's a buy or sell signal. If the current SAR value is below the current price and the previous SAR value was above the previous price, it suggests a buy signal. Conversely, if the current SAR value is above the current price and the previous SAR value was below the previous price, it suggests a sell signal. Additionally, the Check Entry Stochastic function is used to refine our signals. This function checks the Stochastic Oscillator values. If the K line crosses the D line from below in an oversold area, it suggests a buy signal. If the K line crosses the D line from above in an overbought area, it suggests a sell signal. With these signals in hand, the code decides whether to execute a buy or sell trade. If both the trading signal and the filter signal return a buy and there are no open positions, the trade.Buy function is used to buy 0.10, equivalent to 10 Micro Lot. If both signals return a sell, the trade.Sell function is used to sell 0.10 Microlot. Once you've input all the code, press F7 to compile it. If this was too fast for you or if you don't understand what all the code is doing, you might want to check out the Premium course on our website or watch one of the basic videos first. After a successful compilation, return to MetaTrader by pressing the F4 key or clicking on its icon. Once in MetaTrader, press Control and R to start the strategy tester. Select the Expert Advisor you've just created, enable the visual mode, and start a strategy test. You should then see the Expert Advisor in action on the chart. If you're already a Premium course member and have an idea for a video like this one, please send us an email. By the end, you'll have a deeper understanding of what you've learned and the Expert Advisor you've coded yourself with jus...

MQL4 TUTORIAL
How to code a standalone Bollinger Bands Expert Advisor

MQL4 TUTORIAL

Play Episode Listen Later Aug 7, 2023 5:38


  Here is a detailed summary of the video The video starts with an introduction on how to automate the Bollinger Bands indicator to automatically open four trades for Metatrader 0:01. It shows that a first open position is already in place 0:13. The speed is slightly increased to demonstrate that it works 0:16. It is explained that the Bollinger Bands indicator was the indicator with which the first profits were made in automated trading 0:23. Next, it shows how to automate this indicator with MQL4 for Metatrader 0:32. This is done by clicking on the small button or pressing the F4 key on the keyboard to call up the Meta Editor 0:41. In the Meta Editor, a new Expert Advisor is created and named “SimplerBollingerBandsStandAloneEA” 0:55. Everything above the On Tick function is deleted, as are the two comment lines 0:64. A variable for the signal is created 0:71. Then it goes to the determination of the Bollinger Bands 0:86. It is explained that entry signals should be created whenever a candle closes outside one of the bands and a re-entry takes place 0:93. The Bollinger Bands are calculated with the built-in iBands function for the current currency pair on the chart and the period selected on the chart 1:09. This is calculated for twenty candles 1:20. It shows how to insert the Bollinger Bands in Metatrader by clicking on Insert, Indicators, Trend, Bollinger Bands 1:33. It explains how the actual order commands are executed. If the signal has the value “Buy” and the OrdersTotal function returns zero, i.e., if there are no open positions, then ten micro lots are bought 2:40. The same applies if a sale is to be made 2:77. Finally, it shows how to create a chart output. The comment command is used for this 2:94. The video ends with the explanation that in this short video, you have learned how to generate buy and sell signals for the Bollinger Bands and how to automatically trade the recognized signals with Metatrader four 3:83. Not sure what to do? Click on the automated trading assistant below MQL4 TUTORIAL BASICS - 102 SIMPLE BUY CROSSOVER STOP   This video, we are going to create an Expert… MQL4 TUTORIAL - SIMPLE COMMODITY CHANNEL INDEX In this video we are going to trade the Commodity… MQL4 TUTORIAL BASICS - 88 SIMPLE ALLIGATOR INDICATOR In this video we are going to create an expert… MQL4 TUTORIAL - SIMPLE MODULAR EXPERT ADVISOR In this vid...

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE IADX EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Jul 2, 2023 6:41


In this video, we are going to talk about this Indicator here; it is the Average Directional Movement Index. Basically it's a trend confirmation oscillator. Whenever the line here is rising that's a trend confirmation; in our case for a short trend that is developing on the chart here and as soon as the IADX Indicator is falling, you see, the trend is interrupted here, now its rising again and we see an uptrend and when the IADX Indicator starts to decline – like in this case – the uptrend is interrupted. Now how can we create an Expert Advisor that is able can calculate the Average Directional Index in MQL4? To do that please click on the little button here or press F4 on your keyboard. Now you should see the Metaeditor window and here you want to click on “File/ New/ Expert Advisor (template)” from template. “Continue” (Next). I'll call this one Simple IADX (SimpleIADX), click on “Continue” (Next) “Continue” (Next), and “Finish”, and now you can delete everything above the “OnTick” function and the two comment lines here. In the first step we want to create a signal, especially a string variable for the signal that will also be called signal and we don't assign any value because we are going to calculate that later. Let's calculate the IADX value (IADXValue) by using the function: “iADX” that comes with Metatrader 4. If you mark it and press F1 the reference will tell you that it needs some parameters; the first one is for the symbol on the chart, the second one for the time frame you use on the chart, the third one is for the period for the calculation. If you right-click on the Indicator and select “ADX properties” you will see that the period is 14 and we calculate the values based on the close price so that's what we use here; 14 and PRICE_CLOSE for the close price. This parameter is for the buffer, so what is a buffer? You see the Indicator produces 3 lines here, let's hit the pause button and the value for the blue line is 29.93555 – that's exactly what you see here. The 2 dotted lines have a different value and you could calculate the 2 other values if you exchange buffer 0 with buffer 1 or buffer 2. The last parameter here is the shift value – that's also 0. We want to calculate the current IADX Indicator for the current value (IADXValue) here and to get the last IADX value (LastIADXValue) we use exactly the same parameters accept we use a 1 to get the last value. If we use a 10 instead we would get the value for 10 candles before. If the IADX value (IADXValue) is higher now so IADX value (IADXValue) is greater than last IADX value (LastIADXValue) we want to output: “IADX is rising” so that's what we assign to our signal variable. In the other case if the IADX value (IADXValue) is lower now so the current IADX value (IADXValue) is below the last IADX value (LastIADXValue) we assign the text: “IADX is falling” to our signal. Let's create a screen output by using the “Comment” function. It would output the text; “IADXValue:”, the calculated value and in a new line a text: “Signal:” and the calculated signal we have created here or here. So, that's basically it, let's click on “Compile” or press F7 on your keyboard. That worked without any errors so now we can click here or press F4 to go back to Metatrader. In Metatrader we are going to use a little trick; please click on “Insert/ Indicators/ Trend/ Average Directional Movement Index”, click on “OK”, leave the parameters as they are, click on “OK” and now you should see the Average Directional Movement Index in a separate window below the candles and because Wikipedia says: “The ADX does not indicate a trend direction or momentum and is only used to calculate the ...

MQL4 TUTORIAL
MQL4 TUTORIAL – PROFITS IN A DRAWDOWN

MQL4 TUTORIAL

Play Episode Listen Later Jun 24, 2023


Trading can be like a high stakes game where the challenge is not just in making profits, but also in managing risks and dealing with losses. That's true for the robot trading system too, a tool that seeks to reshape traditional trading by emphasizing resilience and reward. I began using this live trading system about a week ago, and as with all new things, it wasn't a smooth start. I found myself in a drawdown situation which can be a nightmare for traders. Despite opening a sell position during a downtrend, the market didn't move in the predicted direction. This meant my trading account didn't see any profit for a week.   Some might see this as an inefficient system, but I'd disagree. Although there was no influx of profit, the noteworthy thing is that there were no losses either. This is due to the system's intelligent algorithm that hedges positions, maintaining an equilibrium even when the market doesn't behave as expected. On the 23rd of June, despite the week's market turbulence, my account was at a net gain of a single dollar, which isn't much, but when taken in context, it's evidence of the system's effectiveness in protecting against losses.   If you want to test the system's operations and features, there's a demo account available. It provides a risk free opportunity. The robot trading system stands out from the other trading systems. Thanks to its focus on resilience and risk management. It may not give you instant profits, but it offers a buffer against potential losses during volatile market phases, making it a safer option. For anyone looking for a reliable stress tested system that can withstand market unpredictability, the robot trading system is worth a look. Here's the link and as always, thanks for watching. I'll see you in the next video. Not sure what to do? Click on the automated trading assistant below var aiBot = new AiBot({embedId: 'Qq4PT6s3KaCG', remoteBaseUrl: 'https://humanchat.net/', version: '1.4.18'}); MQL4 Tutorial - How to get more advanced live trading…   TO THE STATISTICS   You can now evaluate and… MQL4 TUTORIAL BASICS - 73 SPREAD FILTER In this video we are going to create an expert… LEARN MQL4 TUTORIAL BASICS - LEVEL 1C BUILD YOUR OWN ALGO… Our new documentation series on setting up your own Algo… MQL4 TUTORIAL - 101 WHAT HARDWARE FOR ALGORITHMIC TRADING   In this video, I would like to talk about…

MQL4 TUTORIAL
MQL4 TUTORIAL – 135 SIMPLE LOT SIZE ROUNDING

MQL4 TUTORIAL

Play Episode Listen Later May 29, 2023 3:31


Let's look at how to determine a lot size using the account balance in this video, as well as how to round the result up or down to fit. So let's look at how to use MQL4 to accomplish that. Please use the F4 key or click this button in MetaTrader to do that. The MetaEditor should then appear. In this case, we choose File, New Expert Advisor from template, and then provide a name. I've previously completed this. Simple Lot Size Rounding is the name of my file, which is already pre-programmed. Ontick will be our first function to deal with. We want to first determine the account balance there. The position size is calculated depending on the account balance using the Account Info Double, Account Balance function. In this instance, we divide the gross balance value by 100,000. Additionally, we construct two variables—one rounded up and one rounded down—for the rounded numbers. With the aid of the corresponding function, which we ourselves program, we can calculate that. The determined lot size and the value for the decimal rounding are passed as parameters to the first function, which is called Round up, and the second, Round down. This should be rounded to the nearest whole number. We can output the final results in a more structured manner by using Normalize Double. Despite the fact that we have given two decimal places here, we can see that the first digit of our results is truncated. We then display the entire thing onto the chart using the Comment function. On to the actual functions now. We pass our input value to round up. That is both our rounding value and the position size that we previously passed. For the decimal places, let's add the second parameter. We multiply the rounded value by the function's output in order to obtain the result. Once you press F1, you may access the help and notice that an integer value has been returned. We also pass the input value and the rounded value to the MathCeil function for further calculation. Then we return our outcome to the function using Return. Similar principles apply to the second function for rounding the value. But in this case, MathFloor is used rather than MathCeil. And in this case, we also return the result to our main function. And so, for a 0.25 lot determined lot size, this yields the rounded up value of 0.3 and the rounded down value of 0.2. You can alter this in accordance with the type of account you have and so pass the proper values so that a position can also be opened correctly. Not all account types can deal with microlot sizes that are staggered to the second decimal place. By the way, another premium customer had suggested this video topic. Additionally, if you're a premium customer and have an idea for a video like this, please email me. If not, the premium course is available on our website. Additionally, you learned how to round lot sizes up or down with ease in this video so that they meet your account type. And you wrote these few MQL4 lines here to program that yourself. Not sure what to do? Click on the automated trading assistant below var aiBot = new AiBot({embedId: 'Qq4PT6s3KaCG', remoteBaseUrl: 'https://humanchat.net/', version: '1.4.18'}); MQL4 TUTORIAL - SIMPLE SELL LIMIT EA In this video,

MQL4 TUTORIAL
MQL4 TUTORIAL BASICS – 134 STANDALONE BOLLINGER MACD EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later May 14, 2023 3:21


In this video we are going to create an expert advisor that is able to use the Bollinger Bands to create a Buy or a Sell signal. And we are going to use the MACD as a filter. 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 we have the precoded solution. In my case, I'm doing an include function for the Bollinger Bands module and for the MACD module. Both are separate files and the include function can import the content of those files. And they will be compiled when you compile the main module, which is the one with the Ontick function. And here we create a string variable for the trading signal and another string variable for the filter. And to get the trading signal we are opening a function that is called CheckEntry Bollinger. And to create a filter signal we open a function that is called Check Entry MACD. And when we have a Buy signal and the filter for the MACD also says that we should buy and if the return value for Orders total equals zero, that would mean all conditions are good for a Buy signal. And that's when we use Order Send to open a Buy Trade for ten microlot. Otherwise, when the trading signal equals Sell and when the filter also equals Sell and we have no open positions, that's when we use Order Send to open a Sell Trade for ten microlot. Finally, we use the comment statement to output the trading signal and the filter signal on our chart. That's it for the main module. For the entry signal and the filter signal we use precoded entry modules that we have created before. If you don't know what all that code here means, you maybe want to watch one of the other videos in our basic video series, or maybe even the premium course might be interesting for you. You can find that one on our website and there are also more precoded source codes available in our store. So this is it. Once you have all three modules in place you can click on the compile button. Here we are. And if you don't have any errors you can click on the little button here or press the F4 button to go back to MetaTrader. And in MetaTrader you want to click on view, strategy tester, or press CTRL and R. Please mark the option for the visual mode here and start your test. Now our little expert advisor is running. So the expert advisor seems to work. Now let's go to full speed for a few seconds. You see that we have several positions that are opened. Now let's pause the whole thing and click on the graph tab. We have a few positions here. So it looks like our expert advisor works as expected. And in this little video you have learned how to create an expert advisor that is able to calculate buy and sell signals by using an external module for the Bollinger Bands. You also used a filter for the MACD signal and you have coded it all yourself with a few lines of MQL4 code. Not sure what to do? Click on the automated trading assistant below var aiBot = new AiBot({embedId: 'Qq4PT6s3KaCG', remoteBaseUrl: 'https://humanchat.net/', version: '1.4.18'}); MQL4 TUTORIAL - SIMPLE MODULAR EXPERT ADVISOR In this video we are going to creat...

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE POSITION MULTIPLIER

MQL4 TUTORIAL

Play Episode Listen Later May 7, 2023 4:28


In this video we are going to create an Expert Advisor that contains a position multiplier (SimplePositionMultiplayer). In our case we are trading 5 positions at once, let's stop the Expert Advisor, click on “Expert properties/ Inputs/ NumberOfPositionsToTrade” and increase the value to 10, confirm it with okay. I start another test and this time our Expert Advisor is trading 10 positions and now we are going to find out how to code an Expert Advisor in MQL4 that is able to offer a user adjustable value that can be changed without changing the source code. To do that please click on the little button here or press F4 on your keyboard and now you should see the Metaeditor window and here you want to click on “File/ New/ Expert Advisor (template)” from template, “Continue”, I will call this one: “SimplePositionMultiplier”, click on “Continue”, “Continue” and “Finish” and now you can remove everything above the “OnTick” function and the two comment lines here. So now let's create an external variable for the number of positions to trade that will be called: “NumberOfPositionsToTrade”; most coders like to use short names and a few weeks afterwards they ask themselves: “What the hell is this variable doing?” but I think if you invest a few seconds to type in a good name for the variable is always time that is good Invested. Okay. In the “OnTick” function we want to create a double variable that is called: “Candle1Close” and it contains the value for the close price of candle 1. Let's do that same thing again but this time we call it: “Candle2Close” because it contains the close price for candle 2 and now we want to stack a few conditions to open a new trade. If “OrdersTotal” delivers a value that is below the “NumberOfPositionsToTrade” we have defined here and if that is the case we come to our second condition; the second condition is we want to test if the last close price was higher than the close price before and that would be the case if the “Candle1Close” price is bigger than the “Candle2Close” price. The current candle is always candle 0, this is candle 1 the candle before is candle 2 and so on, so if this expression is true our price is higher now and now we want to send a buy order that is done by using the “OrderSend” statement. To find out about all the different parameters here just watch the Simple Buy Order video; basically we buy 10 micro lots and our take profit will be 150 points above the “Ask” price and when you are done you can click on the little “Compile” button here or press F7 on your keyboard. That worked without any errors, so now we can click here or press F4 to go back to Metatrader. In Metatrader please click on “View/ Strategy Tester” or press “CTRL and R”, now select the “SimplePositionMultiplayer.ex4” file we just have created and enable the visual mode here, set the “Expert properties”, let's say we want to have 3 trades, click on “OK” and start your test and this time we see 3 open trades on the chart and now you know how to create an Expert Advisor that is able to deliver a user-defined variable that can be adjusted by the user when he clicks on “Expert properties” 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 var aiBot = new AiBot({embedId: 'Qq4PT6s3KaCG', remoteBaseUrl: 'https://humanchat.net/', version: '1.4.18'});

MQL4 TUTORIAL
MQL4 TUTORIAL – 3 Percent Monthly Trading Profit a month? Is it possible?

MQL4 TUTORIAL

Play Episode Listen Later Apr 30, 2023


A curious novice MQL programmer asked me today if it was possible to get at least 3% profit each month in an email request. Even Warren Buffett, one of the richest men in the world, is only able to generate a 20% profit on his investments annually. According to what I've heard, an annual gain of roughly 36% from a 3% monthly profit would be significantly greater than Warren Buffett's typical return. Does that imply that it is impossible? Actually, if you want or need to reach at least 3% per month, it is tough to find and run a lucrative solution over a longer period of time. Essentially, the goal is to minimize mistakes, especially in the beginning, and to lose as little money as possible rather than to instantly turn a particularly high profit. The majority of new traders lose the majority of their trading capital within the first few months. Therefore, the first step is to minimize losses while you are still learning and have enough capital rather than to maximize profits. This has a second issue in that every month is a little bit different. Profits from automated trading cannot be compared to a steady paycheck. There may be months when you make less money, but you might make a little bit more money the following month. There is also the issue of people constantly wanting to change and improve their own systems. If you can't follow your own rules, you will, at least by the third or fourth exception, know that you made the incorrect decision at the incorrect time. Frustration from this can give rise to actions like trading in revenge. Humans are emotional, and as a result, awkward situations or reckless actions arise frequently. Despite having good intentions, it frequently has disastrous effects. Additionally, a lot of people mistake automatic trading for gambling or a form of fortune telling. However, the actual focus is more on statistical probabilities, which allows for some exceptions to the rule. You shouldn't assume that you will make that much money, on average, every week or month you trade. Whether you like automatic trading or manual trading, you will essentially struggle if you can't maintain your own trading technique over an extended length of time, create a sound strategy, abide by your own standards, and stay away from emotional choices. If you want to succeed, the only way to consistently make money trading over the long term is done. That way, you can invest your profits into your own system, and that makes it even better. However, one should also be realistic in their expectations and understand that trading is a discipline that takes time, patience, and ongoing learning, rather than being a quick route to riches. Long term success depends on continuous testing and adjusting to shifting market conditions. Not sure what to do? Click on the automated trading assistant below var aiBot = new AiBot({embedId: 'Qq4PT6s3KaCG', remoteBaseUrl: 'https://humanchat.net/', version: '1.4.18'}); MQL4 TUTORIAL - SIMPLE MARKET TIME EXPERT ADVISOR In this little Expert Advisor we are going to find…

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE BULLS POWER EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Mar 12, 2023 6:10


In this video we are going to talk about the Bulls Power Indicator, it is drawn in a separate window below the candles. The Bulls Power Indicator basically can tell us if the bulls are stronger than the bears. Whenever those lines of the histogram are above the zero line we will put out a buy signal here and whenever the direction changes and the histogram is drawn below the zero line that would be a sell signal. Okay. To create the Indicator and the Expert Advisor that is going to trade it you need to click on the little button here or press F4 on your keyboard and now you should see the Metaeditor window and here you want to click on “File/ New/ Expert Advisor (template)” from template, “Continue”, I will call this file Simple Bulls Power (SimpleBullsPower.ex4) click on “Continue “, “Continue” and” Finish” and now you can remove everything above the “OnTick” function and the two comment lines here. Let's create a string variable for the signal here – I will also call it signal – it doesn't contain a value so far because that is what we are going to calculate in this simple Expert Advisor and to do that we can use the “iBullsPower” function that is included in MQL4, that will calculate the Bulls Power Indicator and return its value. Now what is meant by value? If we passed the execution here we will have a value. In this case it's 0.0006 and that matches the value of the last bar here of the histogram and to calculate it we need to pass a few parameters. The first one is the current symbol on the chart, the second parameters for the selected period on your chart, in my case I'm trading a 1 minute chart, the period could also be something like 5 minutes 15 minutes and so on and “_Period” makes sure that we are calculating the correct period that is the period from the chart you are trading right now. The next parameter has the value 13 and when you click on “Insert/ Indicators/ Oscillators/ Bulls Power” you will see the period has a value of 13 and we calculate the value based on the close price and that's exactly why the 13 is used here as the third parameter and “PRICE_CLOSE” is parameter number 4. Well this last parameter stands for the shift. What is a shift? Actually you can move the current indicator value to the right or to the left depending on the shift value. We don't want to do that so we use 0 and if the Bulls Value is above 0 and the histogram is drawn above the line here we consider that to be a buy signal so we assign the word: “buy” to our signal variable. In the other case if the Bulls Value is below 0 or in MQL4 if BullsPowerValue is smaller than 0 we assign the word: “sell” to our signal. Last but not least we create a screen output by using the built in “Comment” function to output the words: “BullsPowerValue:” followed by the calculated value and in a new line we output: “Signal:” followed by the calculated signal. Okay. That's it. Now you can click on the compile button here or press F7 to compile your code and that should work without any errors and in that case you can click on the button here or press F4 to go back to Metatrader. In Metatrader we will use a little trick, please click on “Insert/ Indicators/ Oscillators/ Bulls Power”, click “OK”. Now the Bulls Power Indicator will be drawn on your chart and now we right click in the chart, select “Template/ Save Template” and save it as: “tester.tpl” because that is the template that is going to be used for your next back-test. To start the Strategy Tester you can click on “View/ Strategy Tester” or press CTRL + R, please select the newly created “SimpleBullsPower.ex4” file and start your test.

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE WPR EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Feb 25, 2023 5:46


In this video we are going to create an Expert Advisor to output buy or sell signals on your chart based on the WPR Indicator. This is the Williams' Percent Range Indicator, it's based on the last 100 candles and whenever the blue line here crosses one of the dotted lines, that will produce a buy or a sell signal, when it's below it's a buy signal, and when it's above the upper dotted line here, that would be a sell signal. Now how can we create an Expert Advisor that is able to output buy or sell signals for the Williams' Percent Range Indicator directly on your Forex chart? To do that please click the little button here or press F4 on your keyboard and now you should see the Metaeditor window, and here you want to click on “File/ New/ Expert Advisor (template)” from template. Continue. I will call this one: Simple WPR (SimpleWPR) for Williams' Percent Range. Click on continue, continue and finish. Now you can delete everything that is above the “OnTick” function here and please also delete the two comment lines. We will start with a variable for the signal – this is a string variable called signal – and so far, we will not assign any value because we are going to calculate the signal later. Now let's calculate the WPR value, we are doing it by using the “iWPR” function that comes with MQL4. It needs the current symbol on your chart, the selected time frame like 1 minute or 60-minute charts, this is the period for the calculation, we will use 100 candles here because when you right-click on the indicator and select properties, you will see that 100 candles are the period for the calculation in the default value. And the last parameter is for a shift value, we could use that to move the Indicator to the left or to the right, but we don't need to do that. We use “_Symbol” for the symbol on the chart, _Period for the selected period on the chart, this parameter is for our 100 candles and because we are not going to use any shift value the last parameter is zero. When the WPR value is below minus 80 – that would be the case when the blue line is below the dotted line here, that's the minus 80 mark – we want to create a buy signal, and here is how that is done with MQL4: if WPR value is below minus 80 we want to create a buy signal, so we assign the word: “buy” to our string variable with the name signal. In the other case if the WPR value is above minus 20 – that's whenever the blue line here crosses the upper dotted line – we want to create a sell signal. So, if WPR value is bigger than minus 20 we create a sell signal by assigning the word: “sell” to our signal variable. In the last step we are going to create a screen output by using the “comment” function and that will output the word WPR value followed by the calculated value. This will produce a new line and in the second line we want to have the text signal followed by our calculated signal. Please don't forget the closing bracket and when you are done you can click on the compile button here or press F7 on your keyboard. If you don't get any errors and no warnings here, you can click on a little button here or press F4 to go back to Metatrader. In Metatrader we are going to use a little trick, just click on “Insert /Indicators /Oscillators /Williams' Percent Range” and click on OK. Now your chart should look like this, and you want to right-click, select “Template /Save template” and save it as tester.tpl because this is the template the strategy tester is going to use for your back test. If you are ready, please click on select “View/ Strategy Tester” or press CTRL and R. Now you should see the Strategy Tester panel here and you want to select the file: “SimpleWPR.

MQL4 TUTORIAL
MQL4 TUTORIAL BASICS – SIMPLE ACCOUNT CHECK (translated with AI which is a bit scary)

MQL4 TUTORIAL

Play Episode Listen Later Feb 19, 2023 3:09


In this video we want to take a look at how you can limit the account number for the use of an Expert Advisor, so that only the account number can be used that you allow. So let's take a look at how you can program something like this in MQL4. We are currently seeing an output on the chart that says the account number is wrong. And if you click on Journal here, we can also see that we have a license problem.   So let's take a look at how you can program something like this in MQL4. Okay, this is now our simple example of an Expert Advisor that is able to check and limit an account number. We start here with the declaration for an integer variable called account number. Then comes the ontick function, which is always called up in the Expert Advisor when there is a change in the price. And here we use an if-question to call up the function account number and check whether it is correct or whether it is wrong. If it is correct, then we would get the output that the account number is correct. In the other case, if the return value is false, then we get the message that the account number is wrong. The actual function is a bool function, which means it can only return two values.   It has the name check account number and this addition here export, which would allow us to use the function in a library and import it into an Expert Advisor. We start by creating a bool variable with the name isLicensedAccount and giving the initial value here false. Then we get the account number with the function accountInfoInteger and transfer this to the parameter accountLogin. This returns the account number that is used and we now check here whether this account number matches the account number value that we transfer in our Expert Advisor. If that is the case, then we set our variable here to true and make an output that tells us that we are using the correct account number. In the other case, if our variable has the value wrong, then we use the print command to issue a license problem. And finally, we use the return function here to return the return value of our variables here to the onTick function, which then shows us the corresponding return value on the chart. By the way, this complete example would also work in mql5 and if you haven't switched to MetaTrader 5 yet, it will be real time for that.   For the moment, let's click on Compile or press the F7 key. This should work without errors and if that is the case with you, then you can click on this little button up here or press the F4 key to return to the MetaTrader. Okay, if everything worked well, then you should now have an Expert Advisor with which you can test it. I have the wrong account number here. We change that now, log in with the correct account and if we stop the test now and restart it again, then we should see the account number is correct, the entries in the journal also fit now and you learned in this short video how you can create an Expert Advisor with a few lines in mql4 that is able to ask for a certain account number to protect against the use of illegitimate account numbers.   And you programmed that yourself with these few lines here in mql4. That is how you can create an Expert Advisor with a few lines in mql4 that is able to ask for a certain account number to protect against the use of illegitimate account numbers. And you programmed that yourself with these few lines here in mql4. That is how you can create an Expert Advisor with a few lines in mql4. And you programmed that yourself with these few lines here in mql4.

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE IOSMA EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Feb 13, 2023 5:33


In this video we want to calculate this oscillator here, it's a Moving Average of Oscillator, that's a strange name but actually it produces buy or sell signals whenever it crosses the 0 (zero) line here. So when it crosses from above this will create a sell signal and when it crosses from below 0 (zero) it creates a buy signal. Now how can we create an Expert Advisor that is able to output the buy or sell signals for our oscillator here? To do that please click on the little button here or press F4 on your keyboard and now you should see the Metaeditor window, until you want to click on: “File/ New/ Expert Advisor (template)” from template, “Continue”, I will call this file: “SimpleIOSMA” click on “Continue”, “Continue” and “Finish” and now you can delete everything above the “OnTick” function and the two comment lines here. First we need to create a string variable for the signal, this is called: “signal” and we don't assign a value now, it's a string variable because we are going to assign a text but before we can do that we need to calculate the IOSMA that is done by using the included function “iOsMA” that comes with MQL4. It takes a few parameters; the first one is for the current symbol – we use the constant “NULL” here –, the second is for the current time frame – that's the number 0 –, when you click on the “ENUM_TIMEFRAMES” link here you will see that the 0 (zero) stands for the current period. We have values for 12, 26 and 9, that's also what we see here and when you click on “Insert/ Indicators/ Oscillators/ Moving Average of Oscillator” you will see the fast EMA is 12, slow EMA is 26, and MACD SMA is 9, so that's why we use this. The result will be calculated based on the close price and the 0 (zero) stands for the current candle but for a crossover we want to compare the current candle with the last candle. This line is exactly the same as the one above except of the last parameter because the candle here is candle 0 and the candle before is candle 1 and whenever we want to find a crossover we need to compare the two candles, so that's why we calculate candle 1 here and here is how we use the values; if the last IOSMA value (IOSMAValue) was below 0 (zero) and if the current IOSMA value (IOSMAValue) is above 0 (zero) that would be a buy signal so we assign the word “buy” to our signal. In the other case if the last IOSMA value (IOSMAValue) was above 0 (zero) and if the current IOSMA value (IOSMAValue) is below 0 (zero) that would be a sell signal so we assign the word “sell” to our signal and in the last step we want to output the signal directly on our chart, so we use the built in “Comment” function to output the word: “Signal: “ followed by our “signal” that we have calculated. Okay, that's it. Please click on the “Compile” button or press F7 on your keyboard; that should work without any errors here and in that case you can click on a little button here or press F4 to go back to Metatrader. In Metatrader we use a little trick; let's click on “Insert/ Indicators/ Oscillators/ Moving Average of Oscillator”, go with the default values here and press “OK” and now the oscillator shows up, now let's right click into the chart, select “Template/ Save Template” and save it as: “tester.tpl” because this is the template that our back-test is going to use now. If you don't see the “Strategy Tester” please click on “View/ Strategy Tester” or press CTRL and R and here you want to pick the file: “SimpleIOSMA.ex4”, enable the visual mode here and start a test. …and here is our little Expert Advisor at work, it produces buy or sell signals directly on our chart and now you know how to code the Moving Average of Oscill...

MQL4 TUTORIAL
MQL4 TUTORIAL – 197 DAYS – REAL TRADING RESULTS WITH MQL5

MQL4 TUTORIAL

Play Episode Listen Later Feb 4, 2023 2:38


  This video shows how 197 days of real trading turned out. Today is February 3, 2023, and I wanted to help my system work better. By accident, I just started a new trade here again. We're going to end the trade now because I already reached my goal on February 1, 2023. The whole plan was to make a 10% profit and close the system. If you look at this, you can see that we just went over $11,000. Here in the order history, you can see that I put down $10,000 on July 18 (as far as I can remember), and on February 1, I made more money than I had planned. This is the corresponding statistic on my website. If you click here, you can go to the FX Blue website and see the exact statistics of all the data for this system. Here, the whole thing can be shown again as the total profit. Just now, on February 3, I closed the last trade. The first trade I made was on July 18, 2022. Overall, we've grown by 10%, and each month we've grown by 1.4%. Only 68% of all trades made money when the system was active, and on average, we made 12 trades per day for 199 days. If I hadn't opened a position by accident when I started this video, it would only be 197 days. With the help of a calculator, if we divide 10% by 197 days and multiply by 365, we get an annual growth of 18.5%. What's interesting to me is the equity issue, because you can see here that most of the time during the time we traded, the equity was very close to being in balance. That means the system didn't have many drawdowns. You can see that we only traded in Euros and Dollars. That was 2408 orders, a gross profit of more than $2,000, and a gross loss of $1,112. With a profit factor of 1.9, the total profit was $1,001.28. Here are some more facts and figures. For example, the average number of hours it takes to trade. At 334.9 hours, this one stands out. But as a whole, you can say that most of them were less than 100 hours. fxblue's numbers show that there is a 0% chance of losing everything. You can also look at 100 more facts and figures here. Those who want to can do it here on FX Blue or by calling the website PlatinSystem.com. This is currently being redirected, but you can look at the statistics here as well. And the link to the playlist is still somewhere down here. You have to turn on YouTube content here for GDPR, but once you do, you can look at the playlist. This is the very first video. Overall, I took a few notes on this, and I'll add this video right now. I'm very happy with the results, and I am going to contunue to work on the system now.   Not sure what to do? Click on the automated trading assistant below var aiBot = new AiBot({embedId: 'Qq4PT6s3KaCG', remoteBaseUrl: 'https://humanchat.net/', version: '1.4.18'}); MQL4 TUTORIAL BASICS 97 - SIMPLE REVERSE POSITION   In this video, we are going to create an… MQL4 TUTORIAL ENGLISH - POSSIBLE OR PROBABLE?     Today's topic is possibilities and probabilities. Because I've…

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE MARKET TIME EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Jan 22, 2023 5:59


In this little Expert Advisor we are going to find out if the market is closed or if it is open, like right now. The Expert Advisor contains some external variables where you can define when the market opening and closing time is for your country. In my case here in Germany the trading hours start at 9:00 am and they end at 5:30 pm – in German notation that is 17:30 so, when we see 9:00 this line here will change to “Market is open” and when it says 17:30 the “Market is closed”. Now how can we create an Expert Advisor that is able to read the local time and generate a signal for the market opening or closing time? Well, to do that please click on the little button here or press F4 on your keyboard. Now you should see the Metaeditor here and here you want to click on “File/ New/ Expert Advisor (template)” from template, continue — I will call this one: ”SimpleTime” — click on continue, continue and finish. Now you can delete everything above the “OnTick” function and the two comment lines here. Above the “OnTick” function we are going to define 2 string variables for the opening and closing time of the market. The modifier “extern” makes it possible that you will be able to modify the variable settings here in the Expert properties. Let's also define two integer variables; one is for the index of the market opening time and the second one for the index of the market closing time. And I would also like to have a string variable for the market state. We will actually start with a closed market and in the “OnTick” function we need to find out the time with seconds and that can be done by using “TimeToStr” and we use “TimeLocal” we want to have the “TIME_DATE” and the “TIME_SECONDS”. Let's press F1 and here you can see “TIME_DATE” will give you the year the month and the day and the output for “TIME_SECONDS” is hours minutes and seconds. That will give us the current time on our computer and now we want to find out if the opening time is in the time string, so we use “StringFind” to find the market opening time in the time with seconds that we have calculated here. The last parameter here is used for the starting position, we want to start to search from the first character in the string and we do exactly the same for the closing time. This time we use “StringFind” to find the market closing time in our time string and if the opening time was found the value for index market opening time will be greater than zero and in that case we want to set the market state to open, otherwise if the closing time was found the index market closing time is greater than zero and so we would set the market state to closed. Last but not least we use the “Comment” function to output the text “Time:” followed by the current time we have calculated and the text: “Market is” followed by the market state directly on our chart. So, let's compile the code here by clicking on a little button here or pressing F7 and that worked without any errors and without any warnings so now we are finished and we 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 CTRL + R that should bring up the Strategy Tester panel and here you want to select the Expert Advisor called: “SimpleTime.ex4”, please make sure that you enable the visual mode here and start your test. Now you should see that the market is closed until the time reaches 9 am – that should be the case in a few seconds now and then it will change to market is open and it did. So, now you know how to find out the market open and closing time, maybe to use it for entry and exit signals and you have calcula...

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE CHART CLICK EVENT

MQL4 TUTORIAL

Play Episode Listen Later Jan 15, 2023 6:27


In this video I wanted to talk to you about something that is called an event. Maybe you know about events, they are pretty common in object-oriented programming. If you click on anything in your Metatrader, that's actually an event. Pressing F2 on your keyboard will bring up the “History Center” and the reason is that; Metatrader is waiting for keystrokes, so if you press F2 it would bring up the “History Center” and if you press F4 you would see in the Metaeditor. Those events also exist on your chart, in this case I'm clicking on the chart here and here comes a message box that is telling me that the chart was clicked. It also tells me the X and the Y value. For example if I click in the upper left corner here you will see that the X value is 1 and Y value is -1. When I click the lower right corner here the value for X and Y is very high, it's counting the number of pixels from the left upper corner. This is the X direction and this is the Y direction. So, if you know how to code an event you can use the information where somebody clicked to do something on your chart like placing a trade or setting a stop loss. Now how can we create an Expert Advisor that is looking for chart events? To do that please click on the little button here or press F4 in your Metatrader, and now you should see the Metaeditor window and here you want to click on “File/ New/ Expert Advisor (template)” from template. Continue. I will call this file: Simple Chart Event (SimpleChartEvent). Click on continue. Continue and finish. Now you can remove everything that is above the “OnTick” function here and let's remove the two comment lines. Usually we would start in the “OnTick” function here but this time we are not going to use it because “OnTick” is what happens whenever price changes. In our case we want to check for a chart event when a mouse is clicked. If you mark that and hit F1 you will see that the “OnChartEvent” function is the handler for a group of chart events. One event for example would be the key down event when you press a key. There are also events to change objects, and there even is an event to find out if you drag something on the chart. The “OnChartEvent” will take a few parameters here: the first parameter is the event ID and there are three more parameters called: “lparam”, “dparam” or “sparam” for long, double, or string. So let's add these parameters here and like any function we need an opening and closing bracket and now we want to check if the “EventID” we have provided here equals the event “CHARTEVENT_CLICK”. Now let's press F1, this is the event we are looking for. You could also check for other events like: mouse move and you could even create a custom event, but for this simple example we want to check if somebody clicked on the chart. If that is the case we want to output a message box and this message box will output the text: “Chart was clicked” followed by the X value – that's the “lparam” – and the Y value – that's the “dparam”. This one is the headline, so let's replace that and we only need one button so with “MB_OK” we create just a single button. Let's have a look at this one that's the “MB_OK” button, you could create other buttons like: yes or no and based on what the button returns you could make another choice but one button and one option is enough for this simple example. So let's compile the code by pressing the little button here or hitting F7 on your keyboard and we made a mistake, we shouldn't use a hyphen here, so let's replace this expression, recompile the code and now it says zero errors and no warnings! If that is the case for you please click on the little button here or press F4 to go back to Me...

MQL4 TUTORIAL
MQL4 Tutorial – Simple RSI Expert Advisor

MQL4 TUTORIAL

Play Episode Listen Later Jan 8, 2023 6:36


What you see here on the chart is the RSI indicator, it is a very popular indicator and whenever the blue line here crosses one of the dotted lines that will create a signal. Let's speed it up a little bit! Now you see that the blue line is between the two dotted lines most of the time, but when it's above the upper line that is considered to be a sell signal. In the other case if it's below the lower dotted line that would be a buy signal and now we want to find out how we can create an Expert Advisor that is going to output buy or sell signals directly on our chart. To do that please click the little button here or press F4 on your keyboard! Now you should see the Metaeditor window here. Here you want to click on “File/ New/ Expert Advisor (template)” from template. Continue. I will call this one: Simple RSI (SimpleRSI). Continue, continue and finish. Now you can delete everything above the “OnTick” function and the two comment lines here. The first thing we need is to create a string variable for the signal – a string variable is for text – we will also call it signal, but we will not assign any text here, because that is what we are going to calculate later on. Now we want to calculate the RSI value that can be done by using the “iRSI” function that comes with MQL4. It needs some parameters. The first one is the symbol on the chart, the second one is the selected period on the chart; like one minute or one hour, the third parameter is the number of the candles that are used for the calculation. If you right click the indicator and select RSI properties you will see that the period is 14 candles in the default settings and the indicator is calculated based on the close price. So, that's what we are going to use for the next parameter. The last parameter here is for a shift but we are not going to use it because we don't want to move the indicator to the right or to the left. And now that we have calculated the RSI value we want to find out if the value is below 20 – that would be the case when the blue line here is below the lower dotted line. In MQL4 we can use the “if” statement to find out if the RSI value is below 20 and in that case, we would have a buy signal, so we assign the word “buy” to our signal. In the other case, if the RSI value is above 80; so, if RSI value is greater than 80 we consider that to be a sell signal and we assign the word “sell” to our signal. Let's create a screen output! To do that we use the built-in comment function to output the text: RSI value (RSIValue) followed by the calculated value we have created here. This backslash n (“n”) produces a new line and in that second line we output the text: “signal” followed by our signal. That's actually it. Now click on “Compile” or press F7 and that should work without any errors or warnings, and in that case please click here on the little button or press F4 on your keyboard to go back to Metatrader. In Metatrader we use a little trick; please click on “Insert /Indicators /Oscillators /Relative Strength Index” and click on OK. Now the RSI window should appear on your chart and now you want to right click in the chart window, select “Template /Save Template” and save it as tester.tpl because that is the template that the strategy tester is going to use for your next back test. After you have done that please click on “View / Strategy Tester” or press CTRL + R and in the strategy tester you want to select the file: SimpleRSI.ex4, enable the visual mode here and start your test. Now you should see… Oh, something is going wrong here! The signal is always present. Obviously I have missed something, and yes, this is only a comment!

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE SELL LIMIT EA

MQL4 TUTORIAL

Play Episode Listen Later Dec 3, 2022 5:35


In this video, we want to create an Expert Advisor to place a sell limit order. This sell limit order is a pending order and it will be triggered when the price rises and crosses this line and as soon as that happens we will have a sell trade. It might be a little hard to understand the sense, especially in the beginning. Why should anybody wait for the price to rise and sell afterwards, but in charting there are actually strategies where this makes sense. For now, we want to answer the question: how can we create an Expert Advisor in MQL4 that is able to place such a pending sell limit order automatically? To do that please click on the little button here or press F4 in your Metatrader. Now you should see the Metaeditor and here you want to click on File/ New/ Expert Advisor from template. Continue. I will call this one: Simple Sell Limit EA. Continue. Continue and finish. Now everything above the OnTick function can be deleted and please also delete the two comment lines here. The first thing we do is to check if no open order exists and that would be the case if the OrdersTotal function returns zero. In that case we want to send a sell limit order and we do that by using the OrderSend command, but actually we have to pass a few parameters. So, let's start the parameter list with a round bracket. The first parameter is the current currency pair on the chart. That is delivered with the MQL4 function: Symbol. In the second parameter, we say that we want to trade a sell limit. That is done by using the constant: OP_SELLLIMIT. If you mark this constant and hit F1 you will see that there is also a buy limit, a buy stop or a sell stop. These four constants here are used for pending orders, while OP_BUY or OP_SELL would cause a direct order. Now we have to tell MQL4 how much we want to order. In our case the position size will be 10 micro lot, the pending order will be placed 20 points above the current Ask price and if you click on one of the currency pairs here you will see that you have a red line and a blue line. The red line is for the Ask price. That is the price we have to pay if we buy something. The blue line here is the Bid price, that is what we would get if we sell something. We have to tell MQL4 how much movement and deviation is allowed. We only want to allow 3 pips, so if the price movement… so whenever the volatility is too high here our OrderSend command will not be triggered. In this simple example, we don't use a Stop Loss, so the next parameter is a zero. Our Take Profit will be 10 points below the Bid price. We don't need a comment so we use the constant: NULL, we also use zero for the id number because we don't need one. The same is for the expiration date because we don't want our Expert Advisor order to expire and last but not least, we pass the color green, to show a green arrow on the chart. If you mark that and press the F1 key you will see a lot of other colors that you could use. Okay. We started our parameter list with a round bracket, so let's add a closing round bracket and a semicolon. Please don't forget the closing curly bracket and if you are finished you can click on the compile button or press F7. You should have no errors and no warnings here and in that case, you can click on the little button here or press F4 to go back to Metatrader. In Metatrader please click on: “View/ Strategy Tester” or press CTRL and R and now please pick the file: SimpleSellLimitEA.ex4, mark the visual mode option here and start your test. Here is our pending order, you can see that Metatrader has placed a sell limit above the current Ask price and now you know how to create an EA to automatically trad...

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE EMA EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Nov 27, 2022 6:41


In this video we want to talk about an Exponential Moving Average that is creating buy or sell signals, the signals are based on the direction. If the Moving Average is above or below the candles; whenever the candles are below the Moving Average this would be a sell signal and when the candles are above the Moving Average this creates a buy signal. Now how can we create an Expert Advisor in MQL4 that is able to output the buy and sell signals based on an Exponential Moving Average? To do that please click on the little button here or press F4 on your keyboard and now you should see the Metaeditor window and here you want to click on “File/ New/ Expert Advisor (template)” from template, “Continue”, I will call this one: “SimpleEMA” for Exponential Moving Average, click on “Continue”, “Continue” and “Finish” and now you can delete everything that is above the “OnTick” function and let's remove the two comment lines here. Okay, we start by creating a string variable for the signal, we call it: “signal” and we don't assign a value because we are going to calculate it in the next step and this is how it's done: we use the built-in “iMA” function that comes with MQL4. It needs to have a few parameters; the first one is the current symbol on the chart – in our case the symbol is the British Pound against the Australian Dollar (GBP/AUD) – the second parameter is the period that we have selected on our chart, we are using the 1-minute chart here and these two variables: “_Symbol” and “_Period” are able to find out what kind of currency pair you trade and which of the timeframes you use. The next parameter is for 20 candles, so the value here is calculated based on the last 20 candles here and this parameter is a shift value. If you mark the “iMA” function and press F1 you will see that we have a shift value here that is called: “ma_shift” and another one here that is also called: “shift”. Let's open a new chart window: click on “Insert/ Indicators/ Moving Average”, let's ad a Moving Average with a shift value of 0 and another one in yellow with a shift value of 20 and now you see what it does, it moves the drawing of the Moving Average into the future. I could also use -20 here and now it was moved to the past, this expression: “MODE_EMA” actually lets you select between a Simple Moving Average and Exponential Moving Average, a Smooth Moving Average and a Linear Weighted Moving Average. To find out what the differences are you might maybe want to look up the 4 types on investopedia or vikkipedia. The Exponential Moving Average basically is a simple Moving Average but the last few current candles play a bigger role in the calculation. You could play around with the 4 types here to see the differences on your chart, for now we go with the Exponential Moving Average and it should be calculated based on the close price, so we use “PRICE_CLOSE” here. This is the offset shift and this is the shift that we have, and this is the shift value we have changed in this example to move the drawing of the Moving Average to the right or to the left. It might take you some time to get used to it but for now both values are 0 and if the SMA is below the bid price – that would be the case if my Moving Average (MyMovingAverage) is smaller than “Bid” – that would create a buy signal so we assign the word: “buy” to our signal. Of course we also want to calculate the other case. If our SMA is above the ask price; so if my Moving Average (MyMovingAverage) is bigger than “Ask” that would be a sell signal so we assign the word: “sell” to our signal variable. In the last step we want to create an output on our chart so here we use the “Comment” function that ...

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE ACCELERATOR EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Nov 19, 2022 5:18


In this video we are going to talk about the Accelerator Indicator, it's an oscillator and it produces green and red bars. Whenever this zero line here is crossed by the bars we create a buy or a sell signal. Now how can we create an Expert Advisor that is able to output buy or sell signals directly on our Forex chart? To do that please click on a little button here or press F4 on your keyboard, and now you should see the Metaeditor window. Here you want to click on “File/ New/ Expert Advisor (template)” from template. Continue. I will call this one: Simple Accelerator (Simple Accelerator). Continue, continue and finish. Now you can remove everything above the “OnTick” function and the two comment lines here because now we want to create a variable for the signal – it will hold text, so we use a string variable call it signal – and so far, it has now value here because we are going to calculate that later on. To calculate the “IACValue”, we use the built-in “iAC” function. If you select it and press the F1 key you will see that it takes 3 parameters. The first one is the symbol, the second one is the time frame, and the third one is the shift. If you click on insert “Indicators /Bill Williams /Accelerator Oscillator” you will see that we don't have any shift value here, so we use _Symbol for the currently selected currency pair on the chart, _Period for the selected period on the chart – that can be 1 minute, 1 hour or 4 hours or anything else up to 1 month – and the last parameter here would be the shift, we use zero here because we don't need to move the Accelerator Indicator to the left or to the right. Now that the calculation is done we want to find out if the IAC value (IACValue) is above zero. We do that with an “if” statement; so, if “IACValue” is greater than zero (IACValue>0) that would create a buy signal, so we assign the word “buy” to the variable signal here. In the other case if the “IACValue” is below zero (IACValue Not sure what to do? Click on the automated trading assistant below MQL4 TUTORIAL BASICS - 47 SIMPLE STOCHASTIC EA In this video we are going to create an expert… MQL4 TUTORIAL BASICS - 72 SIMPLE TRIPPLE EMA In this video we are going to create an expert… MQL4 TUTORIAL BASICS - 114 SIMPLE SHIFTED PRICE EA In this video, we are going to create an Expert… MQL4 TUTORIAL - SIMPLE MOUSE CLICK EXPERT ADVISOR This time we are going to talk about chart events;...

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE MOVING AVERAGE SHIFT

MQL4 TUTORIAL

Play Episode Listen Later Nov 13, 2022 7:45


In this video we are going to talk about a simple SMA shift function that is included in MQL4. You see a red and a green line here, this one is a Moving Average for 20 candles. Actually, if you pause the system and zoom in by hitting the minus key on your keyboard you will see that both SMA's are identical except one of those is shifted. Whenever the green one is above the red one that's a buy signal for us and when we have a crossover and the red one is above the green one it will change to sell here. Now how can we create an Expert Advisor that is able to calculate one and the same Simple Moving Average and create a signal out of the shifted second SMA? To do that please click on the little button here or press a F4 on your keyboard and now you should see the Metaeditor window and here you want to select “File/ New/ Expert Advisor (template)” from template. Continue. I will call the file: Simple SMA Shift (SimpleSMAShift). Click on continue, continue and finish. Now you can delete everything that is above the “OnTick” function and please also remove the two comment lines here. First we need to create a string variable for the signal, that will also be called signal and it will not be assigned any value here because we are going to calculate that later on. Now we want to calculate the Simple Moving Average for 20 minutes and we can do that by using the “iMA” function. This “iMA” will be calculated for the current symbol on the chart, it will be calculated based on the 1-minute period and we use 20 candles to calculate it. Now if you mark the “iMA” function and press F1 you will see that this parameter is a shift value and the last parameter also is a shift value! I found that to be extremely difficult to understand when I was starting out, so let me explain here. This shift value here is used to move the red line here 20 candles into the future. If I click the pause button here, move the mouse above the red SMA and select MA properties you will see that I have selected a shift value of 20 here. Let's change that to 5 for testing purposes and you will see that the red line now is much closer to the green line. I will change that back now, the shift value is 20 again and when I click on “OK” it is drawn 20 candles into the future once again. So, that's what you can do with parameter 4 here. The last parameter here is the second shift value and this one is used to tell MQL4 which candle should be calculated. We use the shift value of 1 to calculate the close price of candle 1. Now if I change this shift value here to a higher value the indicator wouldn't be calculated for the last candle but for a candle long ago. We use a Simple Moving Average here and the calculation is based on the close prices so this parameter here is: “MODE_SMA” for a Simple Moving Average and we use: “PRICE_CLOSE” to do a calculation that is based on the close price of candle 1 here. Okay! This was our first Simple Moving Average. Let's calculate the second one! It will also be calculated for 20 minutes but we use a shift value of 20 because we want the red Simple Moving Average line to be drawn 20 candles ahead. If My Moving Average1 (MyMovingAverage1) is above My Moving Average2 (MyMovingAverage2) – in MQL4 that's; if (MyMovingAverage1>MyMovingAverage2) we want to set the signal to buy, so we assign the word: “buy” to the variable called signal. In the other case if My Moving Average1 (MyMovingAverage1) is below My Moving Average2 (MyMovingAverage2) – let's assign the word: “sell” to the signal. And last but not least we create an output for the signal directly on the chart by using the “Comment” function and that will output the words: “The cur...

MQL4 TUTORIAL
MQL4-TUTORIAL-PLATIN-SYSTEM-MACD-OSCILLATOR

MQL4 TUTORIAL

Play Episode Listen Later Oct 13, 2022 3:53


      In this video, we want to calculate the main signal for this Oscillator here. This is the MACD. It's very popular. So let's find out how we can code an entry signal with MQL4.   A separate chart below the candle chart shows the Mac D oscillator.   It has two values that each show a signal value.   In this case, we want to figure out the signal for the main line.   To use it, we create a new MQ4 file and put it in the same directory as the other Platin System files.   The name of the file is CheckEntryMacD.mq4, and it has only one function called CheckEntry.   This function works out the buy and sell signals for our system and sends them back.   In fact, oscillators aren't made to send signals. They are instead used to confirm or filter out other signals.   But that doesn't mean we can't use them, since all we need for our trading system is a clear entry signal.   First, the signal is put into a string variable. But for now we don't assign a value as we need to calculate it now.   That can be done by using the integrated function called I MacD.   It comes with MQL4 and we need to pass a few parameters.   The first two parameters are for the currently selected symbol on the chart and the currently selected time period on that chart.    Three more values follow to define the period for the fast exponential moving average, then the slow exponential moving average and the signal period.   The values are 12, 26 and 9 as these are the standard values for the MacD oscillator.   Then we need to define that we want to calculate the result based on the close price.   In this example we use Mode_Main to calculate the main signal for the Mac D oszillator.   And the last value is 0 as it is a shift value which is not required.   Now we can calculate the signal by using the Mac D value.   If that number is greater than 0, we want to sell, so we give our signal the word “sell” when that happens.   If the value is less than 0, that means we want to buy, so we've given the signal the word “buy.”   And when our function is done, we want to send the MacD signal back to our main module, which has the OnTick function.   Please don't forget to save your entry file, but you don't have to compile it right now.   The compilation is done in the main module, but before you do that, you need to find the include statement for the entry signal and change it to use our new file, CheckEntry MacD.mq4.   You can turn off other entry modules by putting two slashes at the beginning of a line.   By the way, you can also use this entry signal file in your own system, if you have one.   Then, press F7 or click the compile button to compile your main module and the entry signal file that came with it.   No error messages should come up.   If you have trouble, you might want to buy the Premium course or watch one of the beginner videos to learn how it works.   Okay, by now, you should have working entry signal for the MACD Oscillator. So this is it for this video. And I will see you in the next one.   Not sure what to do? Click on the automated trading assistant below

MQL4 TUTORIAL
MQL4-TUTORIAL-PLATIN-SYSTEM-ACCUMULATION-DISTRIBUTION-OSCILLATOR

MQL4 TUTORIAL

Play Episode Listen Later Oct 11, 2022 4:00


      In this video, we are going to create an entry module for this Oscillator here.    It is called the accumulation distribution oscillator. Usually, Oscillators are used as filters, but in this video, we are going to create an MQL file to create an entry signal.    So, let's see how this is done.   The Accumulation Distribution Oscillator is shown on a separate chart below the candlestick chart.   It has a single signal line that indicates a value.   To use it, we need to make a separate MQ4 file in the same folder as the other Platinum System files.   The name of the file is CheckEntry_ I A D.mq4, and it only has one function called CheckEntry.   The buy and sell signals for our system are calculated by this function.   In fact, oscillators are usually not used to make signals, instead, they are used to filter other signals.   But that doesn't mean we can't use them, because all we need for our trading system is a clear signal that works.   We start by creating the signal string variable.   This will eventually be sent back to our main function, but first we need to make the signal.   That can be done with the builtin MQL4 function IAD.   We only need to provide three parameters.   The first one is for the current symbol on the chart.   The second parameter is for the period that we have selected on that chart.   Parameter three is for the candle.   We want to calculate the value for candle 0 and store it in a variable and we also calculate it for the candle 1 and store that in a different variable.   Now we are able to calculate the entry signal.   If the current value is bigger than the value for the last candle, we would consider that to be a buy signal.   Therefore we assign the word buy to our signal.   Otherwise if the current value is smaller than the last value, that would be a sell signal and then we assign the word sell to our signal.   Finally we want to return the calculated signal to the main module, therefore we use the return statement.   Please don't forget to save your input file, but you don't have to compile it right away.   Compilation is done in the main module, but before you do that, find the include statement for the input signal and change it to use our new file, CheckEntry_ I A D.mq4.   If you put two slashes at the beginning of a line, you can turn off other input modules.   After this, you can press F7 or click the Compile button to compile your main module and the entry signal file that we have included.   There shouldn't be any mistakes.   If you do have mistakes, you might want to buy the premium course or watch one of the basic tutorial videos to learn how to do it.   Okay, if everything is okay, you should have a working version for the Accumulation distribution oscillator, now.    As I said, you can use it as a filter, or use it as an entry signal in the Platin System or in your own system.    Thank you for watching, and I will see you in the next video.   Not sure what to do? Click on the automated trading assistant below MQL4 TUTO...

MQL5 Tutorial
MQL5 TUTORIAL – WHY THE ONINIT FUNCTION WILL NOT SAVE YOU

MQL5 Tutorial

Play Episode Listen Later Oct 9, 2022 3:27


  In this video, I’d like to talk about something that seems so obvious that it’s almost blinding.   When you use the strategy tester to test something, you might miss things that are important when you trade in real time.   This is an example of that.   When you test your strategy, you probably forget one or two things that could hurt you when trading in real time.   The first thing is that real time conditions are not the same.   When you’re using the strategy tester, you might not have a lot of different conditions, but that’s part of the game when you’re trading in real time.   If you lose power or have trouble connecting to the internet, your Expert Advisor might not work for a few hours or even days.   That happened to us a lot.   And if there’s one thing that’s likely to happen, it’s that one of these power outages will happen at the worst time and in the worst way.   It could happen while you are on vacation, for example. What happened a few years ago is as follows.   The Expert Advisor knew what the last price to buy was and what the last price to sell was, but then it was disconnected.   During the outage, the market changed, but the Expert Advisor didn’t notice.   Later, the Expert Advisor kept making decisions based on conditions that were no longer true.   You can’t simulate a 7-hour internet outage in a strategy test, so that’s not tested in backtests.   People were very hard on me when I first started using MQL4 because I didn’t use the OnInit function.   Yes, it takes more processing power to figure out everything every time a new Tick comes in.   But it is worth the CPU time when you want to avoid values and assumptions that don’t match up.   Think of something from the real world.   You might have ended up wearing the wrong clothes because the weather changed while you weren’t paying attention.   For example, you might come home from a summer vacation and find that a T-shirt is not enough because the airport in your home country is covered in snow.   The OnInit function will only run once, when the Expert Advisor starts up, so it is a good idea to check every time the price changes to see if some important conditions are still true.   In our Platin System, we do this with a function called CheckForTick.   If you only use one file and don’t import any libraries, you can use your own Expert Advisor right in the MQL OnTick function.   And don’t just go by the results of strategy tests. Those are good ways to tell if something will work or not.   But nothing beats trading in real time, even on a Cent account.   So, when you trade in real time, make sure you check the conditions and assumptions you have, because as Mark Twain once said:   “It’s not what we don’t know that gets us into trouble. It’s the things we know for sure that aren’t true.”   Not sure what to do? Click on the automated trading assistant below MQL5 TUTORIAL ENGLISH - 3 COMMON ERRORS CAN LEAD TO… MQL5 TUTORIAL BASICS 98 - HOW TO CLONE YOUR MQL5 SYSTEM MQL5 TUTORIAL BASICS - 115 SIMPLE ENVELOPESBUY TRAILING STOP MQL5 TUTORIAL BASICS - 95 SIMPLE LOW GANN FAN OBJECT MQL5 TUTORIAL - PLATIN SYSTEM - ACCELERATOR OSCILLATOR The post MQL5 TUTORIAL – WHY THE ONINIT FUNCTION WILL NOT SAVE YOU appeared first on MQL5 Tutorial.

MQL5 Tutorial - Automatisch traden mit Metatrader5
MQL5 TUTORIAL – WARUM DIE ONINIT FUNKTION NICHT AUSREICHT

MQL5 Tutorial - Automatisch traden mit Metatrader5

Play Episode Listen Later Oct 9, 2022 3:26


  In diesem Video möchte ich über etwas sprechen, das so offensichtlich scheint, dass es fast schon blendet.   Wenn Sie den Strategietester verwenden, um etwas zu testen, können Sie Dinge übersehen, die wichtig sind, sobald Sie in Echtzeit handeln.   Dies ist ein Beispiel dafür.   Wenn Sie Ihre Strategie testen, vergessen Sie wahrscheinlich ein oder zwei Dinge, die Ihnen beim Handel in Echtzeit schaden könnten.   Die erste Sache ist, dass die Bedingungen im echten Trading nicht dieselben sind.   Wenn Sie den Strategietester verwenden, haben Sie vielleicht nicht viele verschiedene Bedingungen, aber das gehört zum Spiel, wenn Sie richtiges Geld handeln.   Wenn der Strom ausfällt oder die Internetverbindung gestört ist, kann es sein, dass Ihr Expert Advisor ein paar Stunden oder sogar Tage lang nicht funktioniert.   Das ist uns schon oft passiert.   Und wenn es etwas gibt, das wahrscheinlich ist, dann ist es, dass einer dieser Stromausfälle zum ungünstigsten Zeitpunkt und auf die ungünstigste Weise passiert.   Es könnte zum Beispiel passieren, während Sie im Urlaub sind. Vor ein paar Jahren ist folgendes passiert.   Der Expert Advisor kannte den letzten Kaufkurs und den letzten Verkaufskurs, aber dann wurde die Verbindung unterbrochen.   Während des Ausfalls änderte sich der Markt, aber der Expert Advisor bemerkte es nicht.   Später traf der Expert Advisor weiterhin Entscheidungen auf der Grundlage von Bedingungen, die aber nicht mehr zutrafen.   Sie können einen 7-stündigen Internetausfall nicht in einem Strategietest simulieren, also wird das nicht im Strategietester getestet.   Als ich anfing, mit MQL4 zu arbeiten, war man sehr unzufrieden mit mir, weil ich die OnInit-Funktion nicht verwendet habe.   Ja, es erfordert mehr Rechenleistung, jedes Mal, wenn ein neuer Tick hereinkommt, alles herauszufinden.   Aber es ist die CPU-Zeit wert, wenn Sie Werte und Annahmen, die nicht übereinstimmen, vermeiden wollen.   Denken Sie an etwas aus der realen Welt.   Vielleicht haben Sie einmal die falsche Kleidung angezogen, weil sich das Wetter geändert hat, während Sie nicht aufgepasst haben.   Zum Beispiel könnten Sie aus dem Sommerurlaub nach Hause kommen und feststellen, dass ein T-Shirt nicht ausreicht, weil der Flughafen in Ihrem Heimatland mit Schnee bedeckt ist.   Die Funktion OnInit wird nur einmal ausgeführt, nämlich beim Start des Expert Advisors. Es ist also eine gute Idee, jedes Mal, wenn sich der Kurs ändert, zu überprüfen, ob einige wichtige Bedingungen noch zutreffen.   In unserem Platin System tun wir dies mit einer Funktion namens CheckForTick.   Wenn Sie nur eine Datei verwenden und keine Bibliotheken importieren, können Sie Ihren eigenen Expert Advisor direkt die in MQL enthaltene Funktion OnTick verwenden.   Und verlassen Sie sich nicht nur auf die Ergebnisse von Strategietests. Diese sind eine gute Möglichkeit, um festzustellen, ob etwas funktioniert oder nicht.   Aber nichts geht über den Handel in Echtzeit, selbst auf einem Cent-Konto.   Wenn Sie also in Echtzeit handeln, stellen Sie sicher, dass Sie die Bedingungen und Annahmen, die Sie haben, überprüfen, denn wie Mark Twain einmal sagte:   „Es ist nicht das, was wir nicht wissen, das uns in Schwierigkeiten bringt. Es sind die Dinge, derer wir sicher sind, die aber gar nicht wahr sind.“   Nicht sicher was Sie tun sollen? Klicken Sie auf den automatischen Trading Assistenten unten

MQL4 TUTORIAL
MQL4 TUTORIAL – WHY THE ONINIT FUNCTION WON’T SAVE YOU

MQL4 TUTORIAL

Play Episode Listen Later Oct 9, 2022 3:41


  In this video I would like to talk about something that you can call the blinding flash of the obvious. When you test something with the strategy tester, you may overlook things that play an important role in your everyday real time trading. This is one of those examples. Whenever you run a strategy test, you probably forget one or two things that might harm you in real time trading.   The first thing is inconsistency. While you are using the strategy tester, you might not have inconsistent conditions, but in real time trading those are part of the game. You might have an outage of power or a problem with your internet connection and your Expert Advisor might not run for a few hours, or even days. We had that happen often. And if one thing is likely to happen, it is that one of those outages will happen at exactly the worst time and under exactly the worst conditions. For example, it might happen while you are on vacation.   Here is what happened a few years ago. The Expert Advisor had a value for the last buy price and the last sell price, but then it was interrupted. During the outage the market conditions changed, but the Expert Advisor didn't notice that. Later, the Expert Advisor continued to calculate the decisions based on the wrong and outdated conditions. That is unlikely to happen in a strategy test, because you have no option to simulate a 7 hour internet outage.   When I started out with MQL4 I was often heavily criticized by people because I didn't use the OnInit function. Yes, the calculation of everything whenever a new Tick comes in takes more processing power. But it is well spend CPU calculation time when you want to avoid inconsistent values and assumptions. Think of a real world example. You might have found yourself dressed up totally wrong, because the conditions change while you didn't notice it. For example, you might come back from your summer vacation and as soon as you have landed you notice that a Tshirt is not enough when the airport of your home country is drowning in snow.   The OnInit function will only run once, at the start of the Expert Advisor so it is a good idea to check if some critical conditions are still true whenever the price changes. In the Platin System we use a function called CheckForTick to do that. If you use your own Expert Advisor with just a single file and no library imports, you can do that right inside of the OnTick function that comes with MQL. And don't only rely on strategy test results.   Those are a good indicator if something is likely to work. But nothing replaces real time operation, even if it is on a Cent account. So please make sure that you check the conditions and assumptions you have during real time trading, because as Mark Twain once said: “What gets us into trouble is not what we don't know. It's what we know for sure that just ain't so.” Not sure what to do? Click on the automated trading assistant below MQL4 TUTORIAL ENGLISH - 3 FATAL ERRORS THAT CAUSE SLEEPLESS…   In this video we will ...

MQL4 TUTORIAL
MQL4 TUTORIAL – PLATIN SYSTEM – HOW TO CALCULATE CURRENT PROBABILITIES

MQL4 TUTORIAL

Play Episode Listen Later Sep 28, 2022


  An automatic trading system works the same way as an automatic navigation system.   Most people think that an automatic system should work for any currency pair and in any situation.   But it doesn't.   It will do a certain thing when it meets a certain kind of reality.   Think about a car trip or the way you get to work every day.   Most likely, it won't take you the same amount of time every day.   Even though you wake up at the same time as yesterday, it's raining today.   You change how you dress and bring your umbrella with you.   So you get into your car about a minute late.   Because it is raining, it is hard to see, so other drivers may be going slowly.   This causes a traffic jam on the highway, and now you're really late.   So you try to go another way that your navigation system tells you to take.   And that is probably the same alternative route that hundreds of other drivers with the same navigation system have been told to take.   Now the traffic jam you wanted to avoid is right in front of you because everyone else who wanted to avoid it did the same thing.   In this case, what you thought was the best way to avoid a delay was actually what caused the delay.   And I think every car owner knows that you can't always avoid problems.   Some days, you may have to deal with roads that are icy.   Some roads might be closed on other days.   Your navigation system will try to get you to your destination as quickly as possible, but it can't keep you from getting into an accident.   Even your navigation system won't be able to help you park your car at 130 kilometers per hour.   You are still the driver, and you decide how fast to turn the next corner.   You decide whether to follow the directions from your navigation system or to get off the highway at the next exit.   You wouldn't think that your GPS would be able to tell the future.   It works by figuring out the odds, but it can't tell you if a garbage truck is blocking the side street around the next corner.   The same thing is done by a trading system.   It figures out what the probabilities are, but that doesn't mean it can foresee the future.   Not sure what to do? Click on the automated trading assistant below LEARN MQL4 TUTORIAL BASICS - LEVEL 1A BUILD YOUR OWN ALGO…   Welcome to the first part of our new series… MQL4 TUTORIAL BASICS - 95 SIMPLE LOW GANN FAN   In this video, we are going to create this… MQL4 TUTORIAL BASICS - 126 SIMPLE RUNNING TIMER   In this video we are going to create an…

MQL4 TUTORIAL
MQL4 TUTORIAL – PLATIN SYSTEM – WILLAMS PERCENT RANGE ENTRY SIGNAL

MQL4 TUTORIAL

Play Episode Listen Later Sep 25, 2022 4:24


  In this video, we want to create an Expert Advisor entry signal for this little Oscillator here. This is the volumes percent range oscillator. So let's see how we we can create an entry module for our Platin System with MQL4. The Williams Percent Range Indicator is actually an oscillator signal, therefore it will be shown in a separate oscillator window below the candle chart. To create an entry signal for our Platin System we need to create a file called CheckEntry_WPR.mq4 in the same directory as our other files.   Actually you can use this entry signal file also for your own, self coded system or for the RobotTradingSystem. The file has one function called CheckEntry and we use it to calculate the signal for our main module. To do that, we create a string variable called signal but we are not going to assign a value right away, because that will be calculated in the following steps. MQL4 comes with an included function for that calculation and the name of the function is iWPR. It needs a few parameters that we have to pass. The first parameter is for the current symbol on the chart.   The second one is for the currently selected period on that chart. The third parameter is used for the number of candles that we are using to calculate our result. And the last parameter is for a shift value. We don't need that, so we set it to 0. If you open an empty chart in Metatrader and click on Insert, Indicators, Oscillators and pick the Williams Percent Range oscillator, you will see that the default value for the period is also 14. Please confirm that setting with Okay, right click into the chart and save the template as tester.tpl. Tester.tpl is the template that is used in the strategy tester to actually see the entry signal. But back to the entry signal module.   Now that we have calculated the WPR value, we can check if the value is below -80. If this is the case, we consider that to be a buy signal, so we assign the word buy to our signal. In the other case, if the signal is below -20, that would mean we have a sell signal and then we assign the word sell to our signal. Finally we use the return statement to return the signal to our main module. Please save the file for the entry signal, but you don't need to compile it. It will be compiled with the main module when you have changed the entry signal there. To do that, please open the main module, and modify the include statement for your entry signal below the import section.   You can outcomment your current module with two slashes. It will then become gray. Please enable the toolbar and click on the compile button to compile the main module and your entry signal at once. You shouldn't get any errors. If you have errors, please go to our website and check the shop for precompiled source codes. Okay. By now, you should have a working Williams Percent Range indicator entry file that you can use in the Platinum system.   Or you can use it in your own system. If you have any problems, please check out our website. Maybe even the premium course might be interesting for you. For now, I say thank you for listening, and I will see you in the next video. Not sure what to do? Click on the automated trading assistant below

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE SMA STANDALONE EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Sep 18, 2022 5:59


In this video we are going to talk about a standalone Expert Advisor that is going to actually trade. Whenever the price is below this yellow line here – this is a Moving Average – we have already made a sell trade and in this video we are going to find out how to do a standalone Expert Advisor that actually trades in MQL4. To do that please click on the little button here or press F4 on your keyboard, now you should see the Metaeditor window and here you want to click on: “File/ New/ Expert Advisor (template)” from template, “Continue” (Next), I will call this version: “SimpleStandaloneSMA”, click on “Continue” (Next), “Continue” (Next) and “Finish”. Now you can remove everything above the “OnTick” function and let's also delete the two comment lines here. Okay. Let's start by creating a string variable for the signal, that variable will be also called: “signal” and we don't assign a value here because we are going to calculate it later on. To calculate it we use the built-in “iMA” function that comes with MQL 4 and it will calculate the Moving Average for the current symbol on the chart and the currently selected period on that chart – for example I'm on the 1-minute chart right now – we want to calculate the Moving Average for 20 candles, I don't want to use a shift value, I could move the Moving Average drawing to the right or to the left but we are going to use a zero (0) shift value here. “MODE_SMA” will calculate the Simple Moving Average, “PRICE_CLOSE” we'll use the close price for the calculation and the last value here is candle 0 (zero) – that's the current candle – I could also calculate the Moving Average based on one of the other candles here but in this simple version we are going to use the current candle. And if the Moving Average is below the current price – so if my Moving Average (MyMovingAverage) is below the close price for candle 0 (zero)… …and please notice that close for candle 0 (zero) actually doesn't exist because candle 0 (zero) is always the candle that is just in development and close price for candle 0 (zero) gives you the current price here and when that price is bigger than the Moving Average value we want to set the signal variable to buy so we assign the word: “buy” to our signal. And guess what? If the Moving Average is above the current price, so if my Moving Average (MyMovingAverage) is bigger than the current price we want to set the signal variable to sell so we assign the word: ”sell” to our signal. Now let's actually buy something! When the signal equals buy and “OrdersTotal” equals 0 (zero) – and that is true when we have no open orders – we use the “OrderSend” command to buy 10 micro lot and the take profit value is 150 points above the Ask price. If you are interested in the “OrderSend” command just mark it here and press F1 and you will see how it works, but let's continue with the selling part! To sell 10 micro lot we check if the signal equals “sell” and if we have no open orders and in that case we use the “OrderSend” statement to sell 10 micro lot and this time the take profit value will be 150 points below the Bid price. Please notice that we use “OP_BUY” to buy something and “OP_SELL” to sell something. That's almost it. In the last step we use the “Comment” function to output the words: “The current signal is:” and the calculated signal on our chart. Okay, so far so good, please click on the “Compile” button or press F7 on your keyboard, you should see no errors and we have 2 warnings because we could use the return value for “OrderSend” but for this simple example everything is okay, we don't use that so now please click here or press F4 ...

MQL4 TUTORIAL
MQL4 TUTORIAL ENGLISH – HOW TO PROFIT FROM A TREND CHANGE

MQL4 TUTORIAL

Play Episode Listen Later Sep 16, 2022 3:13


  In this video, I would like to briefly discuss one particular situation and that is a trend reversal here. We see two moving averages here. One calculates the value for 1000 candles and the other this red moving average is for 1100 candles. And when that's up, we have a downtrend. As you can see, it was like that for a long time and predominantly the price moved below these moving averages until that suddenly changed here on September 13. If we zoom into the chart at plus, we see this pretty big candle here and that caused the price to move from one side to the other side of the moving averages. That means because the green moving average is currently above, in theory we have an incipient uptrend. However, because the price is below both moving averages, there is no trading until we have a crossover here or the price moves back to the other side. This has the advantage that we are not trading against the long-term trend.   Even if our own entry signal provides us with buy and sell signals here, we will only trade again when the current signal direction matches the long-term trend. This has worked quite well over the last few weeks. We are now at an account balance of 10,105 5 €. Currently we are in profit here. Who would like, can look at that on the web page PlatinSystem.Org also times more exactly. There you can find the statistics. And we see here just no trading trend, because I have changed the system yesterday again. Because I have taken the situation as an opportunity to set up here above and below the moving average still a transition zone, in which is not traded. This means that if the price moves here in the area of the moving averages, then no trade was opened, because the direction can change again at any time. But if you zoom into the chart and look at this over the last time, you can see that we are already in a pretty stable downtrend. And now it's just a matter of waiting to see if the trend finally turns.   That would mean the price stays permanently above these two moving averages and the green average stays above. Only then would that be a permanent trend reversal from the descent of the Euro US Dollar. Or we will see another crossover here shortly. At the moment, it looks more like that. That would be a signal that the downtrend continues. And then we would like to continue to act so. Of course, now in the short term, to make things more interesting, we could change the values here for the moving averages. But that's not the point. Because although the entry signal does not determine whether a system is profitable or not, it is part of a fixed set of rules that should be followed. Just like in a soccer game. There are lines and goals and referees. And no one would show up to a soccer game with flippers and a golf club. That's why I'm just going to enjoy the quiet time here until trading turns itself back on. I can just drag the system here onto the chart and have it trade with the default values.   And you learned in this simple video how to use two simple moving averages to determine the long term trend direction for your own system so that it will only trade automatically when the long term trend and your own entry signal match. Thanks for watching and see you in the next video.   Not sure what to do? Click on the automated trading assistant below

MQL4 TUTORIAL
MQL4 TUTORIAL ENGLISH – 3 FATAL ERRORS THAT CAUSE SLEEPLESS NIGHTS

MQL4 TUTORIAL

Play Episode Listen Later Sep 11, 2022 3:48


  In this video we will take a look at how to tackle one of the biggest problems in trading. And that is the dilemma of how to act when the signal reverses. After all, many traders believe that the moment a signal reverses is the right time to close all open positions and open a new position in the opposite direction. In fact, there are strategies based on this idea, but you don't necessarily have to do it this way. This is the new Platinum System.   The current version here in the video is a reverse engineered version from MQL5 to MQL4. And it's based on the opposite principle, which is the idea that a position that's opened has only one purpose, and that's to make a profit. And that's why in this case we don't close the position when the signal reverses. In fact, the entry is not the most important thing in a trading system. Of course, you need a defined entry and without an entry we would not be able to define clear rules. But the entry point does not necessarily always have to lead in the right direction in order to create a profitable system. The problem with this is that in phases like now, when you see a whole lot of open positions, you always get the question: should I close my position now?   Is the loss too big or should I continue? Here in the example we are just with a 10,000 € account and the value for the equity has fallen below 9900 €. This maybe goes much deeper in a longer drawdown. And the longer such a situation lasts, the more uncertain we become as traders and ask ourselves the question: How should I react now? Should I realize the loss or should I hope that everything will turn around? In the last week alone I have been asked this question twice and therefore I would like to present my idea. And that is simply to test until you are sure how you want to behave in a specific case. In a soccer game there are lines, there are referees and there are goals. A soccer game usually lasts 90 minutes.   And the team that has scored the most valid goals at the end of the period is the winner. Such rules are simply necessary so that you can even determine whether a result looks good or bad and whether you want to continue or not. After all, you will rarely see in a soccer match that the players leave the field after conceding three goals because, after all, the whole thing is no longer worthwhile. So if you feel in trading that your results just don't match what you thought they would, it's usually due to a few simple things.   Problem number 1: You haven't defined any rules. That means you show up to a soccer game in field hockey gear and with a tennis racket.   Problem number 2: Your account is too big. The moment you start to question whether your account will survive the next night and you can't sleep because of it, it's pretty certain that your account size is too high to let you continue to sleep well in the future.   Problem number 3: You depend on making profits. If you already have a clear idea in your head of what should happen next now, the opposite will almost certainly happen.   But for all of these problems, there is also a corresponding solution. And this solution can sometimes look like simply waiting long enough. In the meantime, our system has already reached February and little has changed in the situation. This can look much worse in real time and be much more emotionally stressful than you have here in such a strategy test. And that's exactly why it's important to use such strategy tests extensively beforehand, in order to know how to behave afterwards in the real situation.

MQL4 TUTORIAL
MQL4 TUTORIAL – HOW TO GET THE LAST ERROR

MQL4 TUTORIAL

Play Episode Listen Later Sep 4, 2022 5:29


  In this video we are going to talk about common backtesting errors and how to find them. This is an Expert Advisor, but it doesn't show anything and it doesn't trade. So the first thing you need to check is the journal tab here. And here you might see an error message like this one: order send error 131. Now, what does that actually mean? Let's pause the strategy tester here.   Right click on one of the error messages and select Copy. Now go to Google and paste the text here. I will remove the currency pair and the time and date stamps here. So now it says MQL4 order send error 131. Now you can press Enter. And you should see this one: error codes appendixes MQL4 tutorial.   And when you click on the link, you will see what each and every code of these errors mean. In our case it was 131. That's an indicator for an invalid trade volume. Another very common error is error 138 for broker requotes. Let's change the slippage for our trade from three to zero.   Recompile the code for a simple buy trade. I have called this Expert Advisor MQL4 errors because I wanted to show you how to create errors. Because that might help you to find them. Right now we don't get any errors here. So let's set this one to minus one. Now click on compile. And you can compile it without any errors and any warnings because syntactically everything is correct.   Now let's start a new test here. And this time it says order sent error 4051. Let's see if we can find this one: 4051 means invalid function parameter value. So let's get back to three pips for the slippage. Let's try a value of Ask plus 100 points for the stop loss, compile the code.   And once again you don't see any errors here. But when you restart your Expert Advisor test, you see order send error 130. And 130 stands for invalid stops. Let's fix this error and set the take profit value to Ask minus ten times point. Once again you can compile everything, but when you start a new test you will see other send error 130.   Well, we intentionally created all the errors here, but you might even experience order errors just because you change a setting. Everything is all right here. Let's compile it, restart a test and you should see that it works. But when you stop the test and change the spread value here to 100, you will see, after you have clicked on start, that the order send error 130 remains. From time to time you may ask yourself: what is going wrong here?   So there is a way to output the last error directly here on the chart. Let's stop the test here and change our little test expert advisor here. We are going to use the comment function to output the text “the last error was” and we use the function get last error, because that will return the contents of the system variable last error. And in this last error, you will find all the error codes here. So let's check it out.   Just recompile the code, click the little button here, or press F4 on your keyboard. And when I start the expert advisor, it says the last error was 130. If I readjust the spread here and start another test, the output is the last error was zero. Okay, now, you know how to find errors in MQL4, and you know how to create an output directly on your chart. And I would suggest to use this simple expert advisor here and change a few things.   And when you restart your expert advisor, you should get the output of the error code directly on the chart.   Not sure what to do? Click on the automated trading assistant below...

MQL4 TUTORIAL
MQL4 Tutorial – How to get more advanced live trading statistics

MQL4 TUTORIAL

Play Episode Listen Later Aug 27, 2022 3:20


  TO THE STATISTICS   You can now evaluate and dissect every component of the new $1,000 Platin Group System because I published the statistics on the Platinsystem.org website. Our initial Platin System trading account has been active for a few weeks at this point. We have already surpassed the 3% profit mark and are getting close to the $350 profit threshold. I currently have three streaming servers running that automatically live-trade the $1,000 Platin Group System on Youtube for three distinct accounts thanks to a suggestion from a member called Rafael from Brazil. You may find them on my MQL4 Tutorial, MQL5 Tutorial, and Algorithmic Trading System.com YouTube channels. Recently, I discovered a flaw in the system that resulted in a problem when I changed anything in the source code.   The system was unable to handle positions that had been opened before it was resumed during live operation, which was the cause. That only shows up when you are trading live because it is not taking place when you are testing your strategies. And for this reason, it's crucial to not just rely on the outcomes of strategy tests. So until a system is ready to enter beta stage, I typically do strategy tests on demo accounts.   The system then is used on a real money account in normal operation using so-called Cent accounts, which I like. And once everything is operating as it should, scaling up an account is never an issue, as I frequently tell my clients. But I go about it differently this time. And the reason is because one of the premium course participants came up with a system that he wanted me to look into since he believed the positive outcomes were due to a special entry. I didn't think that, so I modified the entrance signal to test if the outcomes would still be favorable. And what happened? That being the case,   I disassembled the entire system and began to develop my own adaptation of the strategy. The Platin System's initial Alpha version was completed about 3 months later, and as of this writing, three systems are now in the beta stage. Since you can review the data on Platinsystem.org, you can decide if this is something you might want to trade after looking at the specifics. You can view specifics about each trade by clicking on the statistics sheet. Additionally, the system typically experiences very few drawdowns, and the typical trade lasts only a few hours. If you are already a member of the Premium Course, please let me know what you think of the current setup. I intend to give those members who have what it takes to succeed an upgrade.   On the website, you may still sign up to join a premium course if you want to. Although I have to admit that it is an expensive solution because it includes consulting and a few things that I have never offered before, I have taken the sales page for the RobotTradingSystem offline to devote that time to the new Platinum group, which might be interesting for some existing members. Collaboration is important, so Rafael, if you watch this video and are interested in joining the Platin Group, I have a discount code for you. I'm still looking for the initial email and attachment that started it all in the spring so I can thank the premium member who helped me to get the idea. However, I wanted you to be able to look at the embedded statistics on PlatinSystem.org since I believe you will get some useful new information. I look forward to your response, see you in the upcoming video.

MQL5 Tutorial - Automatisch traden mit Metatrader5
MQL5 TUTORIAL DEUTSCH – SO BEKOMMEN SIE ERWEITERTE STATISTIKEN ZU 3 LIVE SYSTEMEN

MQL5 Tutorial - Automatisch traden mit Metatrader5

Play Episode Listen Later Aug 27, 2022 4:38


  ZU DEN STATISTIKEN   Ich habe die Statistiken für das neue $1000 Platin Group System auf der Webseite Platinsystem.org hinzugefügt, so dass Sie jetzt jedes Detail analysieren und auseinandernehmen können. Inzwischen ist unser erstes Platin-System-Handelskonto seit ein paar Wochen online. Wir haben zu Beginn der Woche die 3-Prozent-Gewinnmarke überschritten und nähern uns der Gewinnlinie von 350 $. Das ist meiner Meinung nach ein gutes Ergebnis und spiegelt die Erwartung aus den früheren Strategietests wider. Dank eines Tipps eines Mitglieds namens Rafael aus Brasilien habe ich jetzt 3 Streaming-Server online, die automatisch das $1000 Platin Group System auf Youtube handeln. 24/7 für MQL4 und MQL5 auf drei verschiedenen Konten. Sie finden sie auf meinen YouTube-Kanälen für MQL4 Tutorial, MQL5 Tutorial und Algorithmic Trading System.com. Meiner Meinung nach unterscheidet sich der reale Handel aus mehreren Gründen deutlich vom Testen. Der erste Grund ist, dass Dinge schief gehen. Mir ist ein Fehler im System aufgefallen, der eine Inkonsistenz verursacht hat, als ich etwas im Quellcode aktualisiert habe. Der Grund dafür war, dass das System nicht in der Lage war, mit Positionen umzugehen, die zuvor eröffnet worden waren, nachdem es während des Live-Betriebs neu gestartet worden war. Deshalb ist es so wichtig, sich nicht nur auf die Ergebnisse von Strategietests zu verlassen. Daher führe ich normalerweise Strategietests auf Demokonten durch, bis ein System bereit ist, in die Betaphase zu gehen. Dann verwende ich sogenannte Cent-Konten, um zu sehen, wie sich das System im täglichen Betrieb auf einem Echtgeldkonto verhält. Und wie ich meinen Kunden oft sage, ist es nie ein Problem, ein Konto aufzustocken, wenn alles so funktioniert, wie es sollte. Aber dieses Mal mache ich es auf eine andere Weise. Der Grund dafür ist, dass eines der Mitglieder des Premium-Kurses ein System vorstellte, das ich untersuchen sollte, weil er glaubte, dass die guten Ergebnisse auf einen speziellen Einstieg zurückzuführen waren. Ich glaubte das nicht und tauschte daher das Einstiegssignal aus, um zu sehen, ob die Ergebnisse immer noch gut sein würden. Das war tatsächlich der Fall, also nahm ich die ganze Sache auseinander und begann, meine eigene Version des Ansatzes zu entwickeln. Etwa 3 Monate später war die erste Alpha-Version des Platin-Systems fertig und hier sind wir nun mit 3 Systemen in der Beta-Phase. Daher habe ich die Statistiken auf Platinsystem.org hinzugefügt, damit Sie sich die Details ansehen und herausfinden können, ob dies etwas ist, das Sie vielleicht handeln möchten. Klicken Sie einfach auf das Statistik-Chart und Sie können Details zu jedem einzelnen Trade sehen. Mir persönlich gefällt der Ansatz, weil das System in der Regel nur sehr geringe Drawdowns aufweist und die durchschnittliche Handelsdauer nur wenige Stunden beträgt. Wenn Sie bereits Premium-Kursmitglied sind, bin ich neugierig, was Sie über das aktuelle System denken, denn ich plane, bestehenden Premium-Kursmitgliedern, die das Zeug dazu haben, gute Ergebnisse zu erzielen, ein Upgrade anzubieten. Wenn Sie darüber nachdenken, ein Premium-Kursmitglied zu werden, ist das auf der Website immer noch möglich. Ich habe die Verkaufsseite für das RobotTradingSystem offline genommen, um die Zeit in die neue Platin-Gruppe zu investieren, die für einige bestehende Mitglieder interessant sein könnte, aber ich muss zugeben, dass es sich um eine teure Lösung handelt, da sie Beratung und ein paar Dinge beinhaltet, die ich noch nie angeboten habe. Eine große Sache ist die Zusammenarbeit,

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE MODULAR EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Aug 20, 2022 6:31


In this video we are going to create a simple modular system that can output the entry signal for different indicators. Right now we are treading the MACD entry signal, right now it says buy and when the line is crossed and the bars are drawn on the other side of the horizontal line it will say sell; now the signal has turned again and it wants to buy. Let's stop this test and find out how we can create an Expert Advisor that can handle different entries without changing the source code of the main module. To do that please click on the little button here or press F4 in your Metatrader and now you should see the Metaeditor window and here we want to click on “File/ New/ Expert Advisor (template)” from template, “Continue”, this one will be called: “SimpleModule”, let's click on “Continue”, “Continue” and “Finish” and now you can remove everything that is located above the “OnTick” function here and let's also delete the two comment lines. The first thing we want to do is to include files. We are going to include external files that contain the function to find out if we have a buy or a sell signal. That can be done by using the include statement that is going to import the function within the “CheckEntry_IAC.mq4” file. Let's open that file. This is it. It contains a function called: “CheckEntry” that will use the “iAC” function to create a sell signal or a buy signal and it returns the signal to our main module. In the “OnTick” function – remember this is the function that will be called whenever the price changes – we get a string signal from our external file so let's create a string variable called: “signal” and the value will be calculated in a check entry function (CheckEntry). That function is located in our external file: “CheckEntry_IAC” and for this simple example we just want to create an output for the signal, so let's use the “Comment” function to output the word: “signal:” followed by the calculated signal on our chart. Remember you will need to have the imported file “CheckEntry_IAC.mq4” in the same directory. All you need to tell MQL4 for is the correct path to that file. We have explained the IAC entry in another video. In our case we want to find out how to import an entry as an external module, so let's click on the compile button here or press F7 and that worked without any errors and any warnings here so now I can click on a little button here or press F4 to go back to Metatrader. In Metatrader I want to use a little trick; let's click on “Insert/ Indicators/ Bill Williams” and select the Accelerator Oscillator, go with the default values here, click on “OK” and here is the Accelerator template, so let's right-click into the chart, select “Template/ Save Template” and save it as: “tester.tpl” because this is the template that Metatrader is going to use for the next back test. After you have done that please click on “View/ Strategy Tester” or press CTRL + R, now please select the “SimpleModule.ex4” file we have compiled, mark the option for the visual mode here and click on start. Now our Expert Advisor is producing buy or sell signals based on the Accelerator Oscillator, let's stop the test here and now I go back into Metaeditor and I will exchange the entry file here and now I include the “CheckEntry_MACD.mq4” file. It basically does the same as the other entry but this time it uses the “iMACD” function to create a sell or a buy signal and return it to our main module. This entry is also explained in another video and now I need to compile the main module so let's click on compile or press F7, that also work without any errors or warnings so I can click here or press F4 to go back to Metatrader.

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE CUSTOM TIME FUNCTION

MQL4 TUTORIAL

Play Episode Listen Later Aug 2, 2022 4:25


In this video we are going to create a little custom function to calculate the local time. You see that we have an output for the current date that is traded here in the Strategy Tester and this is the current time and now we are going to create a custom function in MQL4 to calculate and output the time in this way. To do that please click the little button here or press F4 on your keyboard, now you should see the Metaeditor window and here you want to click on: “File/ New/ Expert Advisor (template)” from template, “Continue”, I will call this file: “SimpleCustomTimeFunction”, click on “Continue”, “Continue” and “Finish” and now you can delete everything above the “OnTick” function and let's also delete the two comment lines here. We start with a string that will be called: “myTime” it's a string variable for the custom time that we are going to calculate and we are going to create a custom function that will be called: “GetTime” and to calculate “myTime” I just try to call the function: “GetTime” here. If I click on the “Compile” button now you will see that “GetTime” function is not defined so this is definitely nothing that comes with MQL 4 and now we are going to create it. It should return a string value, the name is: “GetTime” and as soon as I add two curly brackets and recompile the code the error is gone. Now let's add some logic to the “GetTime” function that we have created right now. I would like to output the time with seconds like we see it here: 17:55 means 5 minutes to 6:00 p.m. and to calculate the time we use a function that is called: “TimeLocal” and we want the output for the date; this is the first part here with the date (TIME_DATE), this is the pipe symbol and here is the second parameter for the time with seconds (TIME_SECONDS) – that's the second part here – and we use time to string (TimeToStr) to convert the time from a datetime variable to a string. Let's mark “TimeToStr” press F1 and we see; okay, it converts the value of the time and seconds that have passed since January the 1st in 1970 into a string that has this format here and now that the calculation is done we want to return the calculated time to the main function that is done by using “return” for our string variable that we have calculated here, so everything within the “GetTime” function will be calculated here and the result is assigned to the variable: “myTime” so if we add the “Comment” function here for “myTime” it should create the desired chart output for the time we have calculated. Now please click on the “Compile” button or press F7 that should work without any errors and if that is the case please click here or press F4 to go back to Metatrader and in Metatrader we click on: “View/ Strategy Tester” or press CTRL + R that will bring up the Strategy Tester panel here and here you want to select the new file: “SimpleCustomTimeFunction”, please enable the visual mode here and start your test. …and here we are. Our Expert Advisor is working and now you know how to create a custom time function for Metatrader 4 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

MQL4 TUTORIAL
MQL4 TUTORIAL ENGLISH – SETUP YOUR OWN ADVANCED STATISTICS

MQL4 TUTORIAL

Play Episode Listen Later Jul 24, 2022 2:28


  The topic of this video is putting statistics on the Internet. I said a while ago that in a short time I would be offering a four-digit platinum group membership with a brand new trading system. Now, this is one of the early versions, and this is the account number for a Robo Forex Pro account. And FXBlue.Com is now one of my new habits. Because I couldn't publish the account statistics reliably with MyFxBook on a Linux machine. Because this MetaTrader runs on a device that runs Linux, and I've now made my own trading distribution based on Debian. In fact, I was also able to install FX Blue's Expert Advisor in MetaTrader on the Linux machine.   Everything works here with Play on Linux, and the Expert Advisor is red right now because it is the weekend and there are no new trading signals. But as you can see, the last change was made at 10:26. You can also see the account information. Here, Fx Blue can do different things. One can monitor specific basic values. A chart can be used to show the whole thing. On the Euro-Dollar chart, we have made 279 trades so far. With a profit of 204.11 dollars in total. The total net comes to $89.16. It's interesting that we have 230 buy trades and 49 sell trades, even though the Euro/Dollar reached its lowest level since the turn of the century just this week.   Here, you can look at all of these details in more depth if you want to. I think the way it's set up is good. The whole thing is repeated here as a print statement, or you can download it in Excel format. I can't install Excel on my Linux computer here because it's a so-called Stick PC. It uses only two gigabytes of memory and runs in the background. It is more than powerful enough to run our Expert Advisor, and we don't have to worry about Windows updates being installed in the middle of the night, which could cause the computer to restart. So, if you've had trouble setting up the advanced statistics of MyFxBook on a Linux PC in the past, you can do it through this live tab map on the FXBlue.Com website.   This is easy to do with MetaTrader 4 and MetaTrader 5, and in the future you will be able to collect such advanced statistics for your own account here. This will help you get better results over time. So far, that's all for today. Thank you for watching! See you in the next video. Not sure what to do? Click on the automated trading assistant below MQL4 TUTORIAL 98 - HOW TO CLONE YOUR MQL4 SYSTEM   In this video, I would like to talk about… MQL4 TUTORIAL BASICS - 130 WHY MASSTESTING IS A GAME CHANGER   In this video, I would like to show you… MQL4 TUTORIAL BASICS - 42 SIM...

MQL4 TUTORIAL
MQL4 TUTORIAL ENGLISH – POSSIBLE OR PROBABLE?

MQL4 TUTORIAL

Play Episode Listen Later Jul 16, 2022 3:27


    Today's topic is possibilities and probabilities. Because I've received another request from a course member. And the question was whether a specific profit expectation could be implemented in practice. My response was that it depends on a variety of factors, one of which is probability. Roy Sullivan is my favorite example on this subject. Roy Sullivan was a park ranger in the United States who was struck by lightning seven times. The chances of something like that happening are minuscule. Nonetheless, for Roy Sullivan, it has become a complete reality. That means that even if the likelihood is extremely low, the consequences could be disastrous. For example, one could consider the statistics for plane crashes and argue that flying is the safest mode of transportation. However, there are always reports of plane crashes, and for those affected by the situation on the plane, it is a nightmare. So the goal of trading is to find something that brings both of those things together in the best way possible.   That means we need to find something that is feasible and has a reasonable chance of producing positive results. Fortunately, in automated trading, this can be determined through a rigorous series of tests. What's going on in the video's background is what I spend the majority of my time doing. In reality, programming an automated trading system does not take long. The majority of the time is spent on extensive testing. And the goal is always the same: to increase the likelihood of a good outcome as much as possible while keeping the system as stable as possible. Of course, with the results of this video, many people will argue that the profit expectation is too low and that such a system could yield much more. However, I can argue that I have only been intensively testing this system for three months. That means I've already completed numerous 100-test series like this one. I'm doing it right now on three different computers using three different account types. And it's always about making the system a little bit more stable, rather than extracting a few more dollars in profit expectations.   In fact, with what you see on the screen here, I can trade in different currency pairs from the turn of the millennium to the present day without the system failing. And the goal here is to create a system that is stable enough to ensure stable operations over long periods of time. Beginners are frequently looking for a quick buck. However, professionals such as Ray Dalio understand that the key is to find something that works in the long run and is based on fundamental laws. If you have the time and inclination, you should look into Ray Dalio's book Principles. It taught me a lot of things. When this system is ready, an exclusive offer will be made to some existing customers who meet the necessary criteria to trade such a system profitably. However, because consulting is included, the cost will be in the four-digit range. However, it will undoubtedly take several months before all of this is ready to go. If this sounds interesting to you, you can pre-register.   I simply wanted to demonstrate what is not only possible, but also likely in this video. Because once you've ensured the most stable operation possible, it's easy to keep optimizing a working system in the long run. That's all for now. Thank you for watching, and I hope to see you in the next video.   Not sure what to do?

MQL4 TUTORIAL
MQL4 TUTORIAL BASICS – 132 STANDALONE BOLLINGER BANDS RSI EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Jul 9, 2022 8:03


  In this video we are going to create an expert advisor that uses the bollinger bands to create a signal. And we also want to use the RSI filter to confirm the signal.   So let's find out how to do that with MQL4.   To get started, please click on a little button here or press F4 on your keyboard.   Now you should see the Metaeditor.   And here we have a precoded version for this expert advisor. We start by using the Include function.   It will include two modules for the bollinger bands and the RSI that are coded here.   Inside of the ontick function we open a function that is called Check Entry Bollinger to create a trading signal.   And for the filter we open a function that is called Check Entry RSI.   This one is coded in the second module and only if the trading signal equals buy and if the filter also equals buy, we want to check if we have no open positions.   That would be the case when orders total delivers a return value of zero. And if all conditions are true, we use order send for the current symbol on the chart to open a buy trade for ten microlot.   In the other case, if the trading signal equals sell and if the filter also equals sell and we have no open positions, that's when we want to use order send for the current symbol on the chart to create a sell trade for ten microlot.   At the end of the main module we use the comment statement to output the trading signal for the bollinger bands and the filter signal for the RSI filter.   And that's it for the main module.   But these two functions here need to be created. So let's continue with the bollinger bands entry. Our function is called Check Entry Bollinger.   And it will return a string value.   Therefore we create a string variable for the signal.   We don't assign a value here because we are going to calculate that now. And to do that we need to use the ibands function that comes with MQL4 for the current symbol on the chart and the currently selected period on that chart.   We do it for 20 candles.   The standard deviation is two.   We don't need a shift value here.   We calculate the results based on the close price. We use mode lower for the lower bollinger band or mode upper for the upper bollinger band. And here we have the candle number one. Now let's repeat that for the last bollinger bands value.   And here we want to do the whole thing again.   This time we do it for candle two. And when the close price for candle two is below the last lower bollinger band and the close price for candle one is now above the lower bollinger band, that would mean we have a re-entry from outside the bollinger bands from below and that is considered to be a buy signal.   So we assign the word Buy to our signal.   In the other case, if the close price for candle two was above the last upper bollinger band, and if the close price for candle one is now below the upper bollinger band, that would be a sell signal.   And that's when we assign the word sell to our signal.   Finally, we return our signal to the main module by using the return statement here.   That's it for the signal.   Now let's continue with the filter. To get the filter value we use the function checkentry RSI. That is coded in this module. It also returns a string value.   Once again we create a signal variable of the type string.   Now we use Irsi for the current symbol on the chart and the currently selected period on that chart. We calculate the value for 14 candles for the close price and we do it for the current candle.   That's candle zero.   And if the RSI value is below 30,

MQL4 TUTORIAL
MQL4 TUTORIAL – 131 STANDALONE EMA MACD EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Jun 29, 2022 6:53


  In this video we are going to create an expert advisor that is able to use two exponential moving averages to create a Buy or a Sell signal. And we are going to use the MACD as a filter. 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 we have the precoded solution. In my case, I'm doing an include function for the Exponential Moving Average Crossover module and for the MACD module.   Both are separate files and the include function can import the content of those files. And they will be compiled when you compile the main module, which is the one with the Ontick function. And here we create a string variable for the trading signal and another string variable for the filter. And to get the trading signal we are opening a function that is called CheckEntry EMA. And to create a filter signal we open a function that is called Check Entry MACD. And when we have a Buy signal and the filter for the MACD also says that we should buy and if the return value for Orders total equals zero, that would mean all conditions are good for a Buy signal.   And that's when we use Order Send to open a Buy Trade for ten microlot. Otherwise, when the trading signal equals Sell and when the filter also equals Sell and we have no open positions, that's when we use Order Send to open a Sell Trade for ten microlot. Finally, we use the comment statement to output the trading signal and the filter signal on our chart. That's it for the main module. Now let's continue with the trading signal. Here we have a separate module. It's an MQ4 file in the same directory and the function we use is called Check Entry EMA. Inside of the function, we first need to create a string variable for the signal, but we don't assign a value here. Now we need to create four exponential moving averages. The first one is for 20 candles for the current candle.   The second one is for 50 candles also for the current candle, we also want to calculate the values for the old moving average for 20 candles. That's for candle one, and we want to calculate the value for 50 candles for the last candle. That's what we do here. The number of candles is defined here. If you don't know what all that here means, you maybe want to watch one of the other videos in our basic video series, or maybe even the premium course might be interesting for you. You can find that one on our website. And if the moving average for 20 candles for the current candle is above the moving average for 50 candles, and if it was below for the candle before, that's when we have a Buy signal and that's when we assign the word buy to our signal. Otherwise, if the moving average for 20 candles is below the moving average value for 50 candles and if it was above for the candle before, that's when we have a sell signal. And now we assign the word sell to our signal. Finally, we use the return statement to return the signal to our main module. That's it for the signal. Now let's do the same for the filter.   We want to open a function that is called checkentry MACD. This is the function and inside of the function we create a signal, also a string variable. And the MACD actually has two signals. One is the main signal and the other one is called signal. You can see that when you open the MACD window. We have a red line in this grey area here. To output the values we use the print statement for the main value and for the signal value for the MACD. And if the MACD main is above the MACD signal value, that would be a buy signal for us.

MQL4 TUTORIAL
MQL4 TUTORIAL BASICS – 130 WHY MASSTESTING IS A GAME CHANGER

MQL4 TUTORIAL

Play Episode Listen Later Jun 23, 2022 6:23


  In this video, I would like to show you something that I think is very helpful. And right now you see that I'm doing backtests in MetaTrader 5. Because MetaTrader 5 is able to to do that. And it's very fast because MetaTrader 5 does support multicore processing. Each of my CPU cores can now do 25 tasks, as I am right now doing 101 complete backtests. And when you watch the results here, you will see that we have profits, and each of those tests has a different amount of total trades and a different expected payoff and a different result.   And that's because I'm doing it with random entries. Now you might ask yourself, why should anybody use a random entry to do tests? Well, actually, this is a good way to find out if your system works, because not the entry is the most important component. It's rather how you react. And it doesn't make sense to make decisions based on a handful of open positions.   So you can see in each of these 101 test series, I have about 3000 total trades. I'm running the test for a whole year. I do it often and this one gave us good results. This is the one that I did before. Those results are also okay as we have no losses.   But there are times when you will see spikes like this one. This is a drawdown in the middle of the year. And as I said, in the beginning, you have to define the time span. In my case, it starts on the 1st of January and it ends at the last day of the year. And this drawdown is right in the middle of the year.   So the system has time to recover. But what do you think would happen if I said that the backtest should end on September 16th? Well, I think you would be less satisfied with the results because that would have been a loss. And this is where people actually give up. Because when you see something like this happen on a real account, you will be convinced that all that trading stuff doesn't work, and you will be sure that the system will never recover again.   And those back tests here, actually, yes, they take time, but they don't take much work. The only thing I do is to pick the next currency pair here. Click on Start. Now I see that the four cores are going to work. Here is the status, and now we see the first results.   Each green point here represents a profit, but it doesn't mean that it needs to always be a profit, just with a few changes in the system. For example, here in the risk percentage value, I could easily modify the system in a way that it only produces losses. And that's why I think that the best idea to invest time is to do mass testing like I do with this system. Metatrader 5 is able to automatically import all the historical data that is needed for a test. And by now we have made 86 out of 101 tests so far. It looks good for this currency pair.   Now this test series is finished. This time we have about two and a half thousand trades for each test. The drawdown looks very good. That isn't always the case. And if you think that 24% is too high, you might want to adjust the settings for your own needs. It really depends on your risk tolerance and your account type.   My account type is good for up to 70% drawdowns as my broker has low margin requirements. Let's do another one. I have not modified any settings but you really need to find out if the currency pairs you trade will work and I go with the ones that produce good results and I leave out the ones that produce bad results. I always do backtests for at least one year. And when I'm done with all the currency pairs that I trade I will start right over with the year 2020, do 101 tests for each of these currency pairs.

MQL4 TUTORIAL
MQL4 TUTORIAL BASICS – 129 SIMPLE BOLLINGER BANDS EXPERT ADVISOR

MQL4 TUTORIAL

Play Episode Listen Later Jun 16, 2022 5:38


  In this video we want to create an automated Expert Advisor that is actually able to trade this Indicator; it's the Bollinger Bands Indicator for 20 candles, actually it's producing buy or sell signals directly on the chart. Whenever the candle close below the lower Bollinger Band that would be a buy signal and when we have a breakout on the other side that would be a sell signal. Now let's find out how to create an Expert Advisor in MQL4 that is actually going to trade. To do that please click on a little button here or press F4 on your keyboard, now you should see the Metaeditor window and here you want to click on: “File/ New/ Expert Advisor (Template)” from template, “Continue”, I will call this file: “SimpleBollingerBandsStandAloneEA”, click on: “Continue”, “Continue” and “Finish”. Now you can remove everything that is above the “OnTick” function and the two comment lines here. First we need to create an empty string for the signal, it will be called: “signal” and we don't assign a value because we are going to calculate that now. The Bollinger Bands Indicator has 3 different bands, we are interested in the upper band and the lower band, so we use the included “iBands” function for the current symbol and the currently on the chart selected period for 20 candles. If you look at the Bollinger Bands properties you will see that we use 20 candles, a shift value of 0, and the deviation's value is 2. These are the default values that we are going to use here, the result will be calculated based on the close price. We use “MODE_LOWER” for the lower Bollinger Band (LowerBB) and “MODE_UPPER” for the upper Bollinger Band (UpperBB). The first one will be calculated based on candle 1 and now we do it again for the previous lower Bollinger Band (PrevLowerBB) and the previous upper Bollinger Band (PrevUpperBB) and this time we are going to use the values for candle 2. If the close price of candle 2 was below the lower Bollinger Band, so if close for candle 2 is less than the value for previous lower BB (PrevLowerBB) and if the close price for candle 1 is above the Bollinger Band – that would be the case when close 1 is bigger than lower BB (LowerBB) – that would be a buy signal and we would assign the word: “buy” to our signal. In the other case if the close price for candle 2 was above the upper Bollinger Band, so if close 2 is bigger than previous upper BB (PrevUpperBB) and if the close price for candle 1 is now below the upper Bollinger Band, so if close 1 is less than upper BB (UpperBB) that would be a sell signal and now we would assign the word: “sell” to our signal. And whenever the signal equals buy and ”OrdersTotal” equals 0 (zero) – that would be the case when we have no open trades – we want to send a buy order so we use the “OrderSend” statement and “OP_BUY” to buy 10 micro lot. In the other case if the signal equal sell and we have no open orders we use “OrderSend” to open a sell trade for 10 micro lot and last but not least we create a chart output that is done by using the “Comment” statement, it will output the word: “Signal:” followed by our calculated signal value. Okay. That's it. Now you can click on the “Compile” button or press F7 on your keyboard, we don't have any errors here, two minor warnings and if that is the case you can click on the button here or press F4 to go back to Metatrader. In Metatrader we use a little trick, we click on: “Insert/ Indicators/ Trend/ Bollinger Bands” here are our default values, we click on “OK” and now we save the template by right-clicking into the chart and selecting “Template/ Save Template” and ple...

MQL4 TUTORIAL
MQL4 TUTORIALBASICS – 128 SIMPLE LONG TERM TREND

MQL4 TUTORIAL

Play Episode Listen Later Jun 5, 2022 5:33


In this video we are going to create an Expert Advisor that is able to calculate buy and sell trades based on the long term trend.   So let's find out how to do that with MQL4. To get started please click on on a little icon here or press F4 on your keyboard. Now you should see the Meta Editor window. And here you want to click on File, new File, Expert Advisor from Template, Continue. I will call this file Simple Long Term Trend.   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. We want to define two moving averages.   The first one is for 950 candles, the second one is for 1000 candles. Inside of the on tick function we want to create a string variable called signal. But we don't assign a value here.   Because we are going to calculate that now. And to find the long term trend we want to create a moving average. That can be done by using the integrated IMA function for the current symbol on the chart and the currently selected period on the chart. We want to calculate our small SMA for 950 candles. The zero here means we have no shift value. We want to use mode underscore SMA. That stands for Simple Moving Average. And the result should be calculated based on the close price. We want to do that for candle one. Let's repeat that. Everything is similar, but this time we are doing it for the big moving average.   The only difference is the name of this variable and this parameter here is calculated based on 1000 candles. And now we are able to define the long term trend.   We simply want to check if the big moving average is bigger than the small moving average. And if that is true that would mean that we have a sell signal. So we assign the word sell to our signal. And of course if the big moving average is smaller than the small moving average, that would mean we have a buy signal and in that case we assign the word buy to our signal. And if we have a buy signal and the return value for orders total is zero, that would mean we have no open orders but a buy signal. And that's when we use Order Send for the current symbol to open ten microlot buy trade. This part here is the value for the stop loss and for the take profit. If you modify these numbers and do a lot of testing, you will find out what really can improve your results. But back to topic. And if our signal equals sell and we also have no open orders, that's when we use Order Send to send a sell trade for the current symbol. This one is also a ten microlot position and we use 50 points for the Take profit and the Stop loss value and that's about it.   Well, 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 or maybe even the premium course on our website might be interesting for you. That's also where you can find a shop link, if you don't want to type everything yourself. For now, let's remove these empty lines here and 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 button here or Press F4 to go back to Meta Trader. And in MetaTrader you want to click on View, Strategy Tester or press Control and R. Please pick the new file simple long term trend ex four.   Mark the option for the visible mode here and start your test. If you don't see the moving average line appear on your chart, just click on stop, right click into the chart. You should now see it and select template, save template and save the template as tester.tpl, because this is what we see when we start a strategy te...

MQL4 TUTORIAL
MQL4 TUTORIAL – FIND REMOVE AND FIX CORRUPTED BACKTESTING DATA

MQL4 TUTORIAL

Play Episode Listen Later May 20, 2022 4:46


In this video, I wanted to talk about back-testing. This is an automated trading system. Its trading the year 2016 right now, lets speed it up a little bit and you can see that we are making progress here. We also would like to back-test the whole year 2017, so you see that the Expert Advisor is running, lets stop the test here and we change the year to 2017 and start another test. It does work somehow and now it's finished but the first trade started in November 2017! In this case we made a loss of nearly 300 Dollars; here is the complete report; just a single trade and a big loss, something is wrong here, but what? Let's slow down the speed here and stat a new test, and now you see that we have a strange change from December to November here. Now what is the cause? Actually Metatrader 4 is going to use historical data. When you click on “Tools/ History Center” or press the F2 key you will see that we have data for each and every minute here, now let's get down here and here is the problem! This is November 2017 and right below we have December 2016! So, obviously we have corrupted historical data here and now we want to fix that. The best way is to mark the first position in the “History Center”, please make sure that you have selected the 1 minute bars, now scroll down all the way, hit the shift key and mark the last entry. Now we have selected all the records and we click on the delete button. This takes a few seconds, we have still two entries here; but these are current entries from today. Let's change to the 5 minutes data, do the same again, delete this data for 5 minutes and now I am going to do it for each time frame in the “History Center” because I want to avoid gaps that might occur just from corrupted data that might be in any of the other time frames. Sometimes you have to wait a little while or you need to start over. Mark it again, but the higher the time frame the less data you have to mark and delete. Eventually we have reached the monthly data and now we are done. There are a few websites where you can download historical data; I like the histdata.com website because it's easy and free. Here you will find a “zip” file with the complete year 2017, these are 1 minute bar quotes, so let's download that file, it's about 3 Mega Bites and when you open it you will find the “csv” file that contains all the necessary data for the whole year, let's copy that. This is my folder for history data and in the “History Center” I select 1 minute, click on “import” and now I select the file we have downloaded, click on “open” and here is all the data we need, but please make sure that you don't mark “Use selected only” because that would prevent you from importing all the data. So, let's click on “OK”, now we see the complete year 2017 in the “History Center”, so we can close it. When we stop and restart our back-test it now starts in January. We have already several results here, so now you know how to find corrupted history data, where you can download new data, you know how to import it into the “History Center”. Not sure what to do? Click on the automated trading assistant below

MQL4 TUTORIAL
MQL4 TUTORIAL – SIMPLE AVERAGE TRUE RANGE EA

MQL4 TUTORIAL

Play Episode Listen Later May 8, 2022 5:05


In this video, you will see an Expert Advisor that is calculating the Average True Range value. When the value is high it will say; “it's a strong Average True Range value”, and when the value is weak it will also say that here directly on the chart. We can also make it visible by clicking on: “Insert/ Indicators/ Oscillators/ Average True Range”. This Oscillator is calculated, based on 14 candles, and it looks like this: When it's weak that would be the case when its below 0.00014, it will show the text: “Weak Average True Range Value” and when the value is rising above 0.00024 we have a strong Average True Range value. Now we want to find out how we can create an Expert Advisor that is able to calculate the indicator. To do that please click on the little button here or press F4 in your Metatrader. Now you should see the Metaeditor and here you want to click on “File/ New/ Expert Advisor (template)” from template. Continue. I will call this one: Simple True Range EA. Continue. Continue and finish. Now you want to delete everything above the OnTick function and the two comment lines here. We start with the Average True Range calculation so we create a variable called: AverageTrueRangeValue, it's a double variable and we create it by using the built-in function: iATR. This function takes four parameters. The first one is: _Symbol, that variable contains the symbol name of the current chart, the second parameter is: _Period, this variable contains the value of the time frame of the current chart, the third parameter is for the number of candles and we can see that the indicator uses 14 candles. Select ATR properties and here you will see the 14 candles. The last parameter would be for the shift to the right or to the left, we don't need that, so we use 0 here. If the Average True Range Value is above 0.00024 we create a chart output by using the “Comment” function. It will output the text: “STRONG Average True Range Value” followed by the calculated value here. In the other case if the Average True Range Value is below 0.00014 we use the “Comment” function to output the text: “WEAK Average True Range Value” followed by the value and if the value is greater than 0.00014 and below 0.00024 we would just output the text: “Average True Range Value” and the calculated value because now its neither strong nor weak. Please don't forget the closing bracket here and if you are done you can click on the “Compile” button here or press F7 on your keyboard. You should have no errors and if that is the case please click here or press F4 to go back to Metatrader. In Metatrader you want to click on: “View/ Strategy Tester” or press CTRL and R and in the Strategy Tester please select the SimpleTrueRangeEA.ex4 file and start your test. This is how it works. Let's switch to the candle view here, click on: “Insert/ Indicators/ Oscillators/ Average True Range” and now you can compare the value here with the calculated value above. Okay. Now you know how to calculate the Average True Range Oscillator value for Metatrader 4 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

MQL4 TUTORIAL
MQL4 TUTORIAL BASICS 127 – SIMPLE ELLIPSE OBJECT

MQL4 TUTORIAL

Play Episode Listen Later May 1, 2022 5:55


In this video we are going to create such a Ellipse object like this one. It is drawn from the highest to the lowest of the last 30 candles. So let's find out how to do that with MQL Four. To get started please click on a little icon here or Press F four on your keyboard. Now you should see the Meta-Editor window. And here you want to click on File, New file, Expert Advisor from Template, continue. I will call this file Simple Ellipse Object.   Click on continue, continue and finish. Now you can remove everything above the on tick function and the two comment lines here. We start with this command. It is called Ihigest and it will find the highest candle for the current symbol on the chart and the currently selected period on that chart. We use Mode High to get the high prices for 30 candles starting from the current candle. That is candle zero and we can do the same thing using Ilowest to find the lowest candle.   This is also for the current symbol on the chart and for the currently selected period. This time we use Mode underscore Low also for 30 candles starting from candle zero. And we store the value in the variable called lowest candle. And before we create a new object, we want to use Object delete to delete all objects that are called Ellipse. The very first time we will not have such an object, but every time afterwards we will delete the old one before we create a new one. And to actually draw the object we use object create. The first parameter here is for the chart.   We want to use the current chart with the candles that is index zero. The second parameter is the name of the object. We will call it Ellipse. Parameter three is the object type, we use OBG_Ellipse here.   The next parameter here is the main chart or the sub chart. The one with the candles is Chart zero, but if you use something like an Oscillator, this would be the sub window one for the Oscillator. We don't have that, so we use chart zero. Now we have to define four points. The first point is the point in time when the lowest of the last 30 candles has been drawn. The second point is the actual lowest price of the lowest candle.   Point three is the time when the highest of the last 30 candles has been drawn. And point four is the highest price of the highest candle. Now let's set a few object parameters. That can be done by using Object Set integer. If you mark that and Press F one, you will see that there are some options. The first parameter is for the Chart ID. Once again we use Chart ID zero.   The second one is the name of the object, that is called Ellipse. The next parameter is what we actually want to change. In our case, we want to change the property color. If you Mark that one and press F1,  you will see that we have different properties for different objects. So depending on the object that you want to draw, you might have or have not an option available.   In our case we want to change the color. That should be available for all object types. And we want to set it to blue. And now let's change another property. This time it's the property object property fill. That's the background color, we want to set it to blue and that's about it. If this was too fast for you or if you have no idea what all the code here means, you maybe want to watch one of the other videos or maybe even the premium course on our website might be interesting for you. That's why you also can find a link to the shop where you can download source codes like this one in case you don't want to type everything. But for now please click on the compile button or Press F7 on your keyboard.   You shouldn't get any errors here and if that is th...

MQL4 TUTORIAL
MQL4 TUTORIAL BASICS – 126 SIMPLE RUNNING TIMER

MQL4 TUTORIAL

Play Episode Listen Later Apr 15, 2022 5:02


  In this video we are going to create an Expert Advisor that is able to calculate the time in hours, minutes and seconds that has passed since we started the Expert Advisor. 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 Meta Editor window and here you want to click on file, new file,  Expert Advisor from template, continue. I will call this file Simple Running Timer.   Click on Continue, continue and finish. Now you can delete everything above the on tick function and let's also remove the two comment lines here. We start by creating a few variables. The first three are date time variables. The type date time will store the time that has passed since the 1 January 1970 and it is stored as number of seconds.   This is not very good to read for humans, so we are going to convert it. In the On Tick function. We first want to check if the start time equals zero. That would mean that the start time has no value and that is the case when we start the Expert Advisor for the very first time. And when it has no value, we will assign the return value for time local. That is the local time of the computer where the client terminal is running, to our start time. This will also work in the strategy tester where you can pick other time spans and to create a readable format we will use Time to string.   That function will get the start time as the first parameter and the second parameter is for the format. And we are going to use the time underscore date and the time underscore seconds value here. Let's continue to calculate the current time. We will also use time local. This will be calculated each time the Ontick function is called. And please remember that will not be every second, because the On Tick function will only run when there is a price change. So please keep that in mind.   Now let's calculate the past time in seconds. That is the current time and we subtract the start time here. And to convert that into a readable format we once again use Time to string for the current time. And we pass time underscore date and time underscore seconds as the second parameter. Now let's create a chart output by using the comment statement to see what's going on. And this output will contain the start time, the current time, the same values in seconds since the 1 January 1970 and the past time in seconds, in minutes and in hours. If this was too fast for you, or if you have no idea what all the code here does, you maybe 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.   That's also where you can find a link to the store where you can download source codes like this one, in case you don't want to type everything. For now please click on the compile button or Press F seven on your keyboard. You shouldn't get any errors here and if that is the case you can click on a little button here or Press F four to go back to Meta-Trader. And in MetaTrader you want to click on View, Strategy tester or press Control and R. Please pick the new file simplerunningtimer Exfour Mark the option for the visual mode here and start your test. Here we are, the Expert advisor is running. It's calculating the time that has passed. The current time is 19 minutes past zero and you can see that we have started at midnight and it says that 19 minutes are over. So our Expert advisor works as designed. And in this little video you have learned how to calculate the past time since you started an Expert Advisor, in case you want to do anything time related.

MQL4 TUTORIAL
LEARN MQL4 TUTORIAL BASICS – LEVEL 1C BUILD YOUR OWN ALGO TRADING SYSTEM FARM

MQL4 TUTORIAL

Play Episode Listen Later Apr 2, 2022 4:10


Our new documentation series on setting up your own Algo Trading System Farm is now available for viewing. We use automated voices and technology to assist you in improving your outcomes more quickly and with less work than ever before. MX Linux is covered in detail in this section, which will cover the basics of the installation. First and foremost, you must learn how to modify the starting settings on your computer in order for the installation to be successful later in the process. This varies based on the kind of computer, but in most cases, hitting a certain key, such as Escape or F1, will allow you to access the setup menu. There is an option to start the computer from a USB stick that may be configured. But first and foremost, we must make this USB stick.   There are a variety of applications available for this, and the functionality varies based on the operating system. The vast majority of people who watch these videos will most likely be using the Windows operating system, and there is a very simple and straightforward method of creating a USB stick from our obtained ISO file. We said in the last section that we wanted to obtain the 64-bit version of Fluxbox. However, a 32-bit version of MX Linux is available for download on the company's website. As a result, even computers that are 15 years old may be utilized with the newest software. We will take a device from the year 2010 as an example. As a matter of fact, I have a few netbooks that are only compatible with 32-bit operating systems. They are able to run MX Linux smoothly even when just one GB of RAM is available. These devices, on the other hand, are not particularly well suited for use in the construction of an algo trading server farm.   Instead, we make use of a Tecra A11 laptop that was manufactured in 2010. However, while this device is no longer a high-performance computer, the RAM may be increased to 8GB. Previously, this would have been prohibitively costly, but in the meanwhile, technology has advanced to the point that RAM for such old systems is now quite affordable. Now, in order to build our bootable USB stick, we'll need to download and run the proper application. Consequently, we begin by downloading the portable version of the program Rufus for our Windows-based computer. Rufus is a piece of software that may be used to generate a bootable memory stick in a matter of minutes, even if it has not been installed on your Windows computer. The portable version may be launched with a single mouse click when the download has been completed, and from here we will be able to obtain the appropriate ISO image of the version we downloaded for MX Linux. We'll also need a USB stick that's capable of serving as a bootable storage media for our software.   The majority of modern USB sticks should be able to do this without any issues. We have a 32 gigabyte USB stick here, but if you have an old USB stick laying around with 8 GB or more, that would do. Be cautious to double-check that you have chosen the right configuration for the destination disk before attempting to copy the ISO file to the USB stick. Should there be any uncertainty, please unplug any external USB devices, such as hard drives or SD cards in the case of laptop computers. This will assist in avoiding any misunderstandings. After you have completed all of the necessary adjustments, click on the relevant button to begin the process of creating the USB stick. This should take no more than five to ten minutes to complete. Following the successful completion of this step, we will enter our freshly manufactured USB stick into our target machin...