it's no the same number because dlow is the previous imomentum value and dhigh is the present(today) value of imomentum. previous\present is my purpose but it 's impossible to calculate.
//--------------------------------+
//| My_First_Indicator.mq4 |
//| Codersguru |
//|
http://www.forex-tsd.com |
//+------------------------------------------------------------------+
#property copyright "Codersguru"
#property link "http://www.forex-tsd.com"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,ExtMapBuffer1);
string short_name = "Your first indicator is running!";
IndicatorShortName(short_name);
//----
return(1);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//---- check for possible errors
if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
if (counted_bars>0) counted_bars--;
int pos=Bars-counted_bars;
double dHigh , dLow , dResult,dresult2;
Comment("Hi! I'm here on the main chart windows!");
//---- main calculation loop
while(pos>=0)
{
dHigh = iMomentum(NULL,0,5,PRICE_CLOSE,pos);
dLow = iMomentum(NULL,0,5,PRICE_CLOSE,pos+1);
dResult = (dLow/(dHigh));\\\ previous/today value
ExtMapBuffer1[pos]= dResult ;
pos--;
}
//----
return(0);
}