Wednesday, July 4, 2018

Simple EMA Signal

Step 1.
create SimpleEMAsignal file in expert folder and

Step 2. copy paste code given below on your SimpleEMAsignal file :
//code start

void OnTick()
// String variable for the signal
string signal="";
//We calculate the moving average for last 20 candles
double MyMovingAverage = iMA(_Symbol,_Period ,20,0,MODE_EMA, PRICE_CLOSE,0);
// if the EMA is below the Bid price
if (MyMovingAverage<Bid)
{//create a buy signal
// if the EMA is above the Ask price
if (MyMovingAverage>Ask)
{//create asell signal
//Output the signal on the chart
Comment("Current Signaal is :",signal);
//code end
Step 3.
Now open MT4 and go to :
Insert >> Indicator >> Moving Average 
Set parameter : Period : 20 , shift : 0 , MA Method : Exponential , Apply to : close , style : Yellow then OK

Step 4.
Now open MT4 and go to :
Charts >> Template >> save template >> save file as tester.tpl.

Now open MT4 and go to :
View >> strategy test : 
set your symbol
Use date
Visual Mode

View signal on left side on top in your chart.

No comments:

Post a Comment