how create MA with Levels New comment zemo 2016.12.27 02:22 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 parametersinput ENUM_TIMEFRAMES timeframe=PERIOD_CURRENT; // timeframeinput int ma_period=10; // MA Periodinput int ma_shift=0; // MA Shiftinput ENUM_MA_METHOD ma_method=MODE_SMA; // MA Methodinput ENUM_APPLIED_PRICE applied_price=PRICE_CLOSE; // MA Priceinput int level1=500; // level1input int level2=-500; // level2//--- global variablesint 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. Coding help Urgent! Metatrader5 Alert problem! convert iMA function from MT4 to MT5 Biantoro Kunarto 2016.12.27 05:53 #1 You can use Envelopes indicator instead make a new one. Jim Colton 2017.01.08 22:10 #2 Envelopes is found under the trend indicators. zemo 2018.01.20 22:26 #3 Jim Colton: Envelopes is found under the trend indicators.Jim, thank you for your tip... one simple solution was using envelopes New comment
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.