# MQL4 TUTORIAL BASICS – 47 SIMPLE STOCHASTIC EA

Published on April 2, 2021

## Trending complete video top searched Large Cap Stocks, Forex Swing Traders, Online Forex Training, and Stochastic Crossover Indicator Mt4, MQL4 TUTORIAL BASICS – 47 SIMPLE STOCHASTIC EA.

https://mql4tutorial.com

With MQL4 and Metatrader4 we create an Expert Advisor for the Stochastic Oscillator. This Stochastic EA will create buy and sell signals and actually open buy and sell positions on the chart.

In this video we are going to create an expert advisor for this oscillator here, this is the stochastic oscillator and we are using it to create buy and sell signals so let’s find out how to do that with mql4.
To get started please click on the little icon here or press F4 on your keyboard. Now you should see the Metaeditor window and here you want to click on file, new file, expert advisor from template, continue, I will call this file simple stochastic ea, click on continue, continue and finish.
Now you can delete everything above the on tick function and the two comment lines here.
First, we want to create a string variable called signal but we don’t assign a value here because this what we are going to calculate later on.
The next step is to define the expert advisor properties. We will use the built-in function istochastic, we have two lines here, one is the k line the other one is the d line. And we start with the current value for the k line.
We need to pass a few parameters.
The first parameter is for the current currency pair on the chart, the second one for the currently selected time period on that chart and the next three values here is what you see if you click on insert, indicators, oscillators, stochastic oscillator.
We see we have a k period with a value of five, a d period with a value of three and the slowing value is also three and that’s exactly what we are using here.
The next parameter mode underscore sma stands for the moving average method, this one is simple for simple moving average.
Here we have another parameter, the zero value is used to define that we are using low high for the price field calculation. There is also something called close close but we will go with the default values here. So please click on okay, right-click into the chart, select template, save template and save it as tester dot tpl because this is the template that we are going to see in the next strategy test, you can overwrite the old one.
So far so good!
Let’s calculate the d value, this is pretty similar but we are using mode underscore signal in this case, that’s for the second line. We also want to calculate the same values for candle one, so now we create a variable called k one and d one.
You can copy everything from the first two lines but you need to use another name for the variables and the last parameter is different because we use a one for candle one.
If the current k and the current d value are above eighty – that is the case when both lines are above the dotted line here – and if that is the case we want to check if we had a crossover, so if the current d value is bigger than the current k value but the last d value was below the last k value that would be a sell signal so we assign sell to our signal.
So let’s actually use sell signal here!
For a buy signal, we would check if the current k value and the current d value are below twenty – and that is true if both lines are below this dotted lower line here – and this time we would check if the current d value is below the current k value and if the former d value was above the former k value.
If this expression is true we would have a crossover and now we assign the word buy to our signal.
And if our signal equals buy and the return value for orders total is zero, that would mean that we have no open orders and a buy signal and that’s when we use order send to open a buy trade for ten micro lot.
In the other case if the signal equals sell and we have no open orders we would use order send to sell ten micro lot.
Finally, we use the comment function to output the text, the current signal is, followed by the calculated signal directly on our chart.
So far so good!
Well, if you don’t understand what all the code here does or if this was a little bit too fast for you, maybe you want to watch one of the other videos in this basic video series first or maybe even the premium course might be interesting for you. You can find that one on our website.
For now, please click on the compile button or press F7. In my case, I don’t have any errors and if this is also true for you, you can click on a little button here or press F4 to go back to Metatrader.
And in Metatrader we click on view, strategy tester or press control and r, please pick the new file simple stochastic ea dot ex4, mark the option for the visual mode here and start your test.
Here we are! This is the first crossover, the expert advisor has already opened a buy position so it works as expected and in this little video you have learned how to create an automated version of the stochastic expert advisor for Metatrader 4 and you have coded it yourself with a few lines of mql4 code.

Stochastic Crossover Indicator Mt4, MQL4 TUTORIAL BASICS – 47 SIMPLE STOCHASTIC EA.

These are the long term financial investments that you do not rush into. The upper and lower limit should be clear in the trade. Trading is always short term while investing is long term.

MQL4 TUTORIAL BASICS – 47 SIMPLE STOCHASTIC EA, Find interesting explained videos relevant with Stochastic Crossover Indicator Mt4.

### Essentials Of Technical Analysis In Stock Trading

##### As a market moves up toward a resistance, stochastic lines need to normally punctuate. She or he has a long term time horizon like a few months to even a few years. Nobody can forecast where the market will go.

Here I am going to share with you a basic proven approach which is a tested way to make money in forex trading and will continue to work. Let’s look at the method and how it works.

Trade the odds and this suggests rate momentum need to support your view and verify the trade prior to you enter. 2 terrific momentum indications are – the Stochastic Trading and the Relative Strength Index – look them up and utilize them.

Lots of people do not recognize that the forex trading robotic software application will assist handle charting. It is of the up the majority of importance that you get a forex robotic that has basic trading tools such as Fibonacci levels, RSI, stochastic, as well as moving average. This is simply a minimum list of tools that you will require to be successful.

These are the long term financial investments that you do not rush into. This is where you take your time analyzing Stochastic Trading an excellent area with resistance and assistance to make a big slide in profit.

The secret to using this basic system is not simply to look for overbought markets however markets are very Stochastic Trading overbought – the more a market is overbought, the bigger the move down will be, so be selective in your trades.

The simpler your system is, the more revenues it will produce on a long run. It is shown that traders run in an optimum state when their trading system is easy to follow and understand.

In this post is a trading method shown that is based upon the Bolling Bands and the stochastic indications. The method is simple to use and could be utilized by day traders that want to trade brief trades like 10 or 30 minute trades.

It is one of the most traded market on the planet with about \$3 trillion being traded every day. You can set your target just above the mid band and take profit. The traders most preferred currency pairs are the EURUSD, USDJYP and GPBUSD.

If you are searching instant entertaining comparisons related to Stochastic Crossover Indicator Mt4, and Free Forex Trading Systems, Forex Trend Following, Automatic Forex, Forex Software you are requested to list your email address our email list now.

Enjoyed this video?
"No Thanks. Please Close This Box!"