why isn't it plotting the formula? - page 2

 
...what should i do then. times Volume by some arbitrary large number?
 

If you change

double Momentum = iMomentum(NULL,0,9,PRICE_CLOSE,pos);

to

double Momentum = iMomentum(NULL,0,9,PRICE_CLOSE,0);

it will draw the horizontal line. It appears that iMomentum indicator has a problem with a number of bars interger assigned to a name (pos).

This is a good one for Slawa or Rosh to resolve

Wackena

 

okay im trying to normalize, the Volume.

   double Volu += Volume[pos];
   double AvgVolu = Volu/pos;
   doube preFormula = MathPow((MACD)/Momentum,AvgVolu)

is this correct? however, i am getting unexpected semicolon error when i compile.

 
yari:
   doube preFormula = MathPow((MACD)/Momentum,AvgVolu)
is this correct?

preFormula tends either to zero or to infinity anyway depending on whether or not the first argument of MathPow() is less then 1,
unless AvgVolu is reasonably close to 1.

Have you ever heard of the properties of exponential function?

The problem in you calculations is fundamental I'm afraid.
 
yari:
   doube preFormula = MathPow((MACD)/Momentum,AvgVolu)

i am getting unexpected semicolon error when i compile.

You forgot to add semicolon after the statement above.
 

thanks its working now. after the volume was normalized with the help of others, its able to graph.

heres the thread where u can see the screenshot. if u want, i can anyone who wants to work on it hte code.

https://www.forex-tsd.com/145114-post5.html

 

its working. However, it is not updating on each tick received. thereforei have to load it every time....very annoying. can u see why the indicator is not drawing for each tick? i'm stumped.

 
#property copyright "Metatrader4 Code by jjk2. Based on MBA Thesis from Simon Fraser University written by C.E. ALDEA."
#property link      ""
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Green
 
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double AvgVol[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicator drawing
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,3);
   SetIndexBuffer(0,ExtMapBuffer1);
  
   SetIndexStyle(1,DRAW_NONE);//DRAW_NONE,EMPTY,EMPTY);
   SetIndexBuffer(1,ExtMapBuffer2);
  
    
///-----Name of Indicator  
   string short_name = "MBA Thesis Thing using Average Volume   Current value calculated by indicator:";
   IndicatorShortName(short_name);
   
   ArrayResize(AvgVol,Bars - 1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars = IndicatorCounted();
   int pos = Bars - counted_bars - 9;
   int temp = pos;
 //----
  
  
   if (counted_bars<0) return(-1);
    
    
   if (counted_bars>0) counted_bars--;
  
   while(pos>0)
    {
          
         //string xxx = "pos";  
                
         double MACD = iMACD(NULL,0,12,26,9,PRICE_CLOSE,0,pos);
         double Stoch = iStochastic(NULL,0,9,6,2,MODE_SMA,1,0,pos);
         double RSI = iRSI(NULL,0,9,PRICE_CLOSE,pos);
         double moment = iMomentum(NULL,0,9,PRICE_CLOSE,pos);
         //double Volu = iMA(NULL,0,9,0,MODE_SMA,MODE_VOLUME,pos); //iVolume(NULL,0,pos);
         //AvgVol[pos] = Volu;
         //double VolMax = AvgVol[ArrayMaximum(AvgVol,9,pos)];
         //double VolMin = AvgVol[ArrayMinimum(AvgVol,9,pos)];
         //double NormVol = (VolMax - Volu) / (VolMax - VolMin);
         
         double Vol = iMA(NULL,0,9,0,MODE_SMA,MODE_VOLUME,pos);
         double AvgVol = Volume[pos]/Vol;
         //Main Forumla
         //double preFormula = (/Momentum);
         if (moment != 0)
          ExtMapBuffer2[pos] = MathPow(Stoch*(RSI+MACD)/moment,AvgVol);        
         pos--;
     }
         
         while (temp > 0) {
          double Formula = iMAOnArray(ExtMapBuffer2,0,3,0,MODE_SMA,temp);
          ExtMapBuffer1[temp] = Formula;
          temp--; }
//----
   return(0);
  }
//+------------------------------------------------------------------+