In this movie I try to execute bits of specific trading egy from here http://forextradingegies4u.com/20-sm...x-trading-egy/.
The egy is related to Simple Moving Average and Candle price.
In this movie I also show you how to make an if else condition announcement in order to define a downtrend or a uptrend according the egy over.
Inserted Code // ------------------------------------------------------------------ //| Tutorial2.mq4 | //| Copyright 2017, MetaQuotes Software Corp.. | //| https://www.mql5.com | // ------------------------------------------------------------------ #property copyright Copyright 2017, MetaQuotes Software Corp. #property Hyperlink https://www.mql5.com #property variant 1.00 #property strict #property indior_chart_window // ------------------------------------------------------------------ //| Custom indior initialization function | // ------------------------------------------------------------------ int OnInit() //-- indior buffers mapping Print(Tutorial 2 initialized); //-- return(INIT_SUCCEEDED); // ------------------------------------------------------------------ //| Custom indior iteration serve | // ------------------------------------------------------------------ int OnCalculate(const int rates_total, const int prev_calculated, const datetime time#91;#93;, const double open#91;#93;, const double top#91;#93;, const double non#91;#93;, const double close#91;#93;, const long tick_volume#91;#93;, const long volume#91;#93;, const int spread#91;#93;-RRB- //-- //The price data type is DOUBLE double candleClose=iClose(Symbol(),PERIOD_CURRENT,0); dual sma=iMA(Symbol(),PERIOD_CURRENT,20,0,MODE_SMA,PRIC E_CLOSE,0); Print(sma = ,sma); Print(candleClose = ,candleClose); should(candleCloselt;sma)//Downtrend condition Print(downtrend); else if(candleClosegt;sma)//Uptrend condition Print(uptrend); //-- return value of prev_calculated for next call yield(rates_total); // ------------------------------------------------------------------