how create MA with Levels

 

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. 

 
You can use Envelopes indicator instead make a new one.
 
Envelopes is found under the trend indicators.
 
Jim Colton:
Envelopes is found under the trend indicators.

Jim, thank you for your tip... one simple solution was using envelopes 

Reason: