You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
How Can I create a Move Average with levels ?
I need to add two level to MA...
like this sample.
//| MA.mq5 |
//| Copyright 2016, |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016"
#property link "http://www.mql5.com"
#property version "1.0"
//--- input parameters
input ENUM_TIMEFRAMES timeframe=PERIOD_CURRENT; // timeframe
input int ma_period=10; // MA Period
input int ma_shift=0; // MA Shift
input ENUM_MA_METHOD ma_method=MODE_SMA; // MA Method
input ENUM_APPLIED_PRICE applied_price=PRICE_CLOSE; // MA Price
input int level1=500; // level1
input int level2=-500; // level2
//--- global variables
int MAHandle; // MA handle
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
MAHandle=iMA(_Symbol,timeframe,ma_period,ma_shift,ma_method,applied_price);
return(0);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- release indicator handles
IndicatorRelease(MAHandle);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
}
thank for your help.