AnyPair SMI

 

Hi guys, maybe someone here can help me.

This indicator is giving no output, I'm trying to adapt a Stochastic Momentum Index to use a different pair than the one on the chart.  The first file is the original I'm using (SMI_Correct_1), the second one (B45a_SMI_AnyPair) is my adaptation.  Any  help would be greatly appreciated.

 I'm also planning to use this for an EA, which is why I inserted the mode2 and 3 buffers there, but not sure I did it right, I'm new to programming these...  :-)

 This one works fine, the problem is in the AnyPair file that follows in the next post. 

Files:
 
My File
Files:
 

Both IndsBoth indicators

 
High[]/Low[] are the current chart TF/pair
SM_Buffer[i]=iClose(Symbol_name,0,i)
            -((High[iHighest(Symbol_name,0,MODE_HIGH,Period_Q,i)]
              +Low[iLowest(Symbol_name,0,MODE_LOW,Period_Q,i)]
             )/2);

HQ_Buffer[i]=High[iHighest(Symbol_name,0,MODE_HIGH,Period_Q,i)]
            -Low[iLowest(Symbol_name,0,MODE_LOW,Period_Q,i)];
 

Thanks WHRoeder.  I see.

 How would I get that data for the external symbols then?  I thought that by specifying it in the symbol name it would do that.

 

//---- buffers
double SMI_Buffer[];
double Signal_Buffer[];
double SM_Buffer[];
double EMA_SM[];
double EMA2_SM[];
double EMA_HQ[];
double EMA2_HQ[];
double HQ_Buffer[];
//---
double SymbolBuffer[];
double MABuffer[];

Here is your init()

int init()
  {
//---- indicators
   IndicatorBuffers(8);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,Signal_Buffer);
   SetIndexLabel(0,"Signal SMI");
   //
   SetIndexEmptyValue(1,0.0);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,SMI_Buffer);
   SetIndexLabel(1,"SMI");
   //
   SetIndexBuffer(2,SymbolBuffer);
   SetIndexStyle(2,DRAW_LINE);
   //
   SetIndexBuffer(3,MABuffer);
   SetIndexStyle(3,DRAW_LINE);

//----
   return(0);
  }
 
Bill45a:  How would I get that data for the external symbols then?  I thought that by specifying it in the symbol name it would do that.
  1. High[index] is an array (of current chart) How you you specify the external symbol there?
  2. iHigh - MQL4 Documentation



 
WHRoeder:
  1. High[index] is an array (of current chart) How you you specify the external symbol there?
  2. iHigh - MQL4 Documentation



Thanks WHRoeder.  Please forgive my ignorance and the time it took for the reply, but here it goes:

High is a predefined variable and iHigh is a function, just changing the High variables for iHigh functions obviously yields an error of undeclared identifier so I don't see what to use in place of the High variable to get that value for a different pair as specified in the iHighest function and/or implement the iHigh for this purpose.

 SM_Buffer[i]=iClose(Symbol_name,0,i)

                  -((High[iHighest(Symbol_name,0,MODE_HIGH,Period_Q,i)]

                     +Low[iLowest(Symbol_name,0,MODE_LOW,Period_Q,i)]

                     )/2); 

 

Thank you for your patience and help.

 

High is a predefined variable and iHigh is a function, just changing the High variables for iHigh functions obviously yields an error of undeclared identifier so I don't see what to use in place of the Highvariable to get that value for a different pair as specified in the iHighest function and/or implement the iHigh for this purpose.

Learn how to search in google. You could have solved this doubt in 20 seconds instead of waiting the answer here.

Anyway, I give you the answer: http://lmgtfy.com/?q=mql4+ihigh&l=1

Regards. 

 

Wow, now I feel REALLY stupid....  I had been through most of those links and read most of them, not all, but most and I still can't figure this out guys.  I'm NOT a programmer; my coding experience its for some SQL and back from the GW-BASIC times (dinosaurs still roamed the earth), so I'm pulling teeth here, I guess the logic is the same, but the brain is like a muscle and I haven't coded in ages. Searching Google is something I'm really good at...  Understanding what I find.... well that's another matter...   ;-)

Any help you would offer a six year old is probably what I need here.  Again, sorry guys, but I admit my ignorance in this subject and appreciate enormously any help given. All I need is how to get the line above to work getting info from a symbol other than the one in the chart, the rest I can do.

 
Bill45a: just changing the High variables for iHigh functions obviously yields an error of undeclared identifier so I feel REALLY stupid.... 
I gave you the link to the function, It is you that must read and understand the documentation.
Take your (unreadable) code
 SM_Buffer[i]=iClose(Symbol_name,0,i)

                  -((High[iHighest(Symbol_name,0,MODE_HIGH,Period_Q,i)]

                     +Low[iLowest(Symbol_name,0,MODE_LOW,Period_Q,i)]

                     )/2); 
Split it up
double  C = iClose(Symbol_name,0,i);
int    iH = iHighest(Symbol_name,0,MODE_HIGH,Period_Q,i);
double  H = High[iH];
int    iL = iLowest(Symbol_name,0,MODE_LOW,Period_Q,i);
double  L = Low[iL];
 SM_Buffer[i]=C -((H +L)/2); 
Now fix your array references with the appropriate function call.
Reason: