Download MetaTrader 5
To add comments, please log in or register
Why to sell products in MetaTrader AppStore? Find that out from the article!
Bill
19
Bill 2015.03.19 19:57 

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:
Bill
19
Bill 2015.03.19 19:58  
My File
Files:
Bill
19
Bill 2015.03.19 19:58  

Both IndsBoth indicators

whroeder1
13593
whroeder1 2015.03.20 12:12  
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)];
Bill
19
Bill 2015.03.23 18:56  

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.

ffoorr
982
ffoorr 2015.03.24 08:59  

//---- 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);
  }
whroeder1
13593
whroeder1 2015.03.24 13:05  
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



Bill
19
Bill 2015.04.17 01:19  
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.

Miguel
29
Miguel 2015.04.17 02:06  

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. 

Bill
19
Bill 2015.04.17 05:19  

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.

whroeder1
13593
whroeder1 2015.04.17 12:59  
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.
/
To add comments, please log in or register