MQL4TUTORIAL.COM

MQL4 Tutorial Bootcamp 14 – How to use the If-Statement


Listen Later

Next Video An automated trading system should be able to make intelligent decisions when conditions change. This is where we us the IF statement. We hit F4 to create a new Expert Advisor. Call it IFtest. And, in the OnTick function, we will say, if Close 1 is higher than Close 2, Comment (it is going up). We’ll copy this text and change this part to if Close 2 is greater than Close 1, Comment (it is going down). Compile your EA and drag it on the chart. And as you can see, it is saying it is going down. This is because the close price of this candle is lower than this candle. It counts backwards. This is candle zero because it’s not finished. And now, it’s candle 1 because it has finished a few seconds ago. And as you can see now, it is going up because the close price of this candle was higher than the close price of this candle. Drag another currency on the chart and this one should say, it’s going down.
...more
View all episodesView all episodes
Download on the App Store

MQL4TUTORIAL.COMBy MQL4TUTORIAL.COM