Artwork

MQL5 Tutorial에서 제공하는 콘텐츠입니다. 에피소드, 그래픽, 팟캐스트 설명을 포함한 모든 팟캐스트 콘텐츠는 MQL5 Tutorial 또는 해당 팟캐스트 플랫폼 파트너가 직접 업로드하고 제공합니다. 누군가가 귀하의 허락 없이 귀하의 저작물을 사용하고 있다고 생각되는 경우 여기에 설명된 절차를 따르실 수 있습니다 https://ko.player.fm/legal.
Player FM -팟 캐스트 앱
Player FM 앱으로 오프라인으로 전환하세요!

MQL5 TUTORIAL – SIMPLE AWESOME STANDALONE EXPERT ADVISOR

6:28
 
공유
 

Manage episode 408595723 series 1376757
MQL5 Tutorial에서 제공하는 콘텐츠입니다. 에피소드, 그래픽, 팟캐스트 설명을 포함한 모든 팟캐스트 콘텐츠는 MQL5 Tutorial 또는 해당 팟캐스트 플랫폼 파트너가 직접 업로드하고 제공합니다. 누군가가 귀하의 허락 없이 귀하의 저작물을 사용하고 있다고 생각되는 경우 여기에 설명된 절차를 따르실 수 있습니다 https://ko.player.fm/legal.
MQL5 TUTORIAL – SIMPLE AWESOME STANDALONE EXPERT ADVISOR

This time we are going to create a standalone Expert Advisor to trade the Awesome Oscillator, it will output buy and sell signals directly on the chart and whenever the line is crossed here we either get a sell signal when it’s below the dotted line or we would get a buy signal as soon as it crosses the line like right now the bars are above and now we consider that to be a buy signal.
Now how can we create an Expert Advisor in MQL5 that is able to not only output the signals on the chart but to automatically trade them?
To do that please click on the little icon here or press F4 on your keyboard now you should see the Metaeditor window and here you want to click on: ”File/ New/ Expert Advisor (template)” from template, “ Continue”, I will call this file: “SimpleAwesomeStandaloneEA”, click on “Continue”, “Continue” and “Finish”.
Now you can delete everything above the “OnTick” function and the two comment lines here.
We start by including the file “Trade.mqh”, this one comes with MQL5 and it makes it possible to create an instance from the class “CTrade” that will be called: “trade” and we are going to use it to open positions later on. Before we do that we calculate the Ask price and the Bid price that is done by using “SymbolInfoDouble” for the current symbol on the chart, “SYMBOL_ASK” will give us the Ask price and “SYMBOL_BID” will give us the Bid price.
With “NormalizeDouble” and “_Digits” we automatically calculate the right number of digits because the current currency pair has 5 digits behind the dot but there are also other currency pairs with 3 digits behind the dot.
Now we need a signal variable that will be a string variable so it can contain text later on right now we don’t assign any values because we need to calculate them later on.
With “MqlRates” we create a price information array (PriceInformation), that function here stores the information about the prices, the volumes and the spread.
Now we sort the array from the current candle downwards by using “ArraySetAsSeries” and with “CopyRates” we fill it for the current symbol and the currently selected period on the chart from candle 0 (zero) for 3 candles and we store the data in our price information array (PriceInformation).
Let’s create another array called: “PriceArray” that one will hold the data for our Oscillator, so let’s use the integrated “iAO” function of MQL5 to define the Awesome Oscillator Indicator for the current symbol and the current period on the chart. This array (PriceArray) also needs to be sorted from the current candle downwards so we use “ArraySetAsSeries” for this one and now we use “CopyBuffer” to fill our price array (PriceArray) for the first buffer – that’s the line here – from the current candle 0 (zero) for 3 candles and store the information for the Expert Advisor in our price array (PriceArray).
And to calculate the Expert Advisor for the current candle we simply look at the value of candle 0 (zero) in our price array (PriceArray), we also use “NormalizeDouble” and a 6 to get six digits behind the dot like here and the result will be stored in the Awesome Oscillator value (AwesomeOscillatorValue) and if that value is above 0 (zero) we consider that to be a buy signal and now we assign the word: “buy” to our signal.
Otherwise if the value (AwesomeOscillatorValue) is below 0 (zero), so if the Awesome Oscillator value (AwesomeOscillatorValue) is less than 0 (zero) we assign the word: “sell” to our signal and if the signal equals sell and “PositionsTotal” is below 1 – in other words we don’t have any open position – we use “trade.Sell” to sell 10 micro lot.
Otherwise if the signal equals buy and we have no open positions we use “trade.Buy” to buy 10 micro lot.
The last thing is to create a chart output by using the “Comment” function to output the text: “The current signal is:” and the calculated “signal” directly on our chart.
Okay, if you’re done you can click on the “Compile” button here or press F7, that should work without any errors and in that case you can click on the little button here or press F4 to go back to Metatrader and in Metatrader we click on: “View/ Strategy Tester” or press CTRL and R, please select the new file: “SimpleAwesomeStandaloneEA”, let’s also mark the visualization option here and start a test.
…and here we are, our Expert Advisor is working, actually we have opened the first automated trade and now you know how to code the Awesome Oscillator Standalone Expert Advisor and you have coded it yourself with a few lines of MQL5 code.

The post MQL5 TUTORIAL – SIMPLE AWESOME STANDALONE EXPERT ADVISOR appeared first on MQL5 Tutorial.

  continue reading

20 에피소드

Artwork
icon공유
 
Manage episode 408595723 series 1376757
MQL5 Tutorial에서 제공하는 콘텐츠입니다. 에피소드, 그래픽, 팟캐스트 설명을 포함한 모든 팟캐스트 콘텐츠는 MQL5 Tutorial 또는 해당 팟캐스트 플랫폼 파트너가 직접 업로드하고 제공합니다. 누군가가 귀하의 허락 없이 귀하의 저작물을 사용하고 있다고 생각되는 경우 여기에 설명된 절차를 따르실 수 있습니다 https://ko.player.fm/legal.
MQL5 TUTORIAL – SIMPLE AWESOME STANDALONE EXPERT ADVISOR

This time we are going to create a standalone Expert Advisor to trade the Awesome Oscillator, it will output buy and sell signals directly on the chart and whenever the line is crossed here we either get a sell signal when it’s below the dotted line or we would get a buy signal as soon as it crosses the line like right now the bars are above and now we consider that to be a buy signal.
Now how can we create an Expert Advisor in MQL5 that is able to not only output the signals on the chart but to automatically trade them?
To do that please click on the little icon here or press F4 on your keyboard now you should see the Metaeditor window and here you want to click on: ”File/ New/ Expert Advisor (template)” from template, “ Continue”, I will call this file: “SimpleAwesomeStandaloneEA”, click on “Continue”, “Continue” and “Finish”.
Now you can delete everything above the “OnTick” function and the two comment lines here.
We start by including the file “Trade.mqh”, this one comes with MQL5 and it makes it possible to create an instance from the class “CTrade” that will be called: “trade” and we are going to use it to open positions later on. Before we do that we calculate the Ask price and the Bid price that is done by using “SymbolInfoDouble” for the current symbol on the chart, “SYMBOL_ASK” will give us the Ask price and “SYMBOL_BID” will give us the Bid price.
With “NormalizeDouble” and “_Digits” we automatically calculate the right number of digits because the current currency pair has 5 digits behind the dot but there are also other currency pairs with 3 digits behind the dot.
Now we need a signal variable that will be a string variable so it can contain text later on right now we don’t assign any values because we need to calculate them later on.
With “MqlRates” we create a price information array (PriceInformation), that function here stores the information about the prices, the volumes and the spread.
Now we sort the array from the current candle downwards by using “ArraySetAsSeries” and with “CopyRates” we fill it for the current symbol and the currently selected period on the chart from candle 0 (zero) for 3 candles and we store the data in our price information array (PriceInformation).
Let’s create another array called: “PriceArray” that one will hold the data for our Oscillator, so let’s use the integrated “iAO” function of MQL5 to define the Awesome Oscillator Indicator for the current symbol and the current period on the chart. This array (PriceArray) also needs to be sorted from the current candle downwards so we use “ArraySetAsSeries” for this one and now we use “CopyBuffer” to fill our price array (PriceArray) for the first buffer – that’s the line here – from the current candle 0 (zero) for 3 candles and store the information for the Expert Advisor in our price array (PriceArray).
And to calculate the Expert Advisor for the current candle we simply look at the value of candle 0 (zero) in our price array (PriceArray), we also use “NormalizeDouble” and a 6 to get six digits behind the dot like here and the result will be stored in the Awesome Oscillator value (AwesomeOscillatorValue) and if that value is above 0 (zero) we consider that to be a buy signal and now we assign the word: “buy” to our signal.
Otherwise if the value (AwesomeOscillatorValue) is below 0 (zero), so if the Awesome Oscillator value (AwesomeOscillatorValue) is less than 0 (zero) we assign the word: “sell” to our signal and if the signal equals sell and “PositionsTotal” is below 1 – in other words we don’t have any open position – we use “trade.Sell” to sell 10 micro lot.
Otherwise if the signal equals buy and we have no open positions we use “trade.Buy” to buy 10 micro lot.
The last thing is to create a chart output by using the “Comment” function to output the text: “The current signal is:” and the calculated “signal” directly on our chart.
Okay, if you’re done you can click on the “Compile” button here or press F7, that should work without any errors and in that case you can click on the little button here or press F4 to go back to Metatrader and in Metatrader we click on: “View/ Strategy Tester” or press CTRL and R, please select the new file: “SimpleAwesomeStandaloneEA”, let’s also mark the visualization option here and start a test.
…and here we are, our Expert Advisor is working, actually we have opened the first automated trade and now you know how to code the Awesome Oscillator Standalone Expert Advisor and you have coded it yourself with a few lines of MQL5 code.

The post MQL5 TUTORIAL – SIMPLE AWESOME STANDALONE EXPERT ADVISOR appeared first on MQL5 Tutorial.

  continue reading

20 에피소드

모든 에피소드

×
 
Loading …

플레이어 FM에 오신것을 환영합니다!

플레이어 FM은 웹에서 고품질 팟캐스트를 검색하여 지금 바로 즐길 수 있도록 합니다. 최고의 팟캐스트 앱이며 Android, iPhone 및 웹에서도 작동합니다. 장치 간 구독 동기화를 위해 가입하세요.

 

빠른 참조 가이드

탐색하는 동안 이 프로그램을 들어보세요.
재생