EDIT: Well, I guess you already got a response from Codersguru, but I'll leave this in place as it may help somebody else.
EDIT 2: I think you'll need reference JMASlope as I show below, due to the way it uses 2 buffers to give you the slope. Codersguru, please let me know if this is correct as you're The Man and I'm just a humble noob trying to learn to program.

BTW, thank you so much for your MT4 programming tutorials. I knew a little, but now I know a lot more.
Quote:
|
Originally Posted by zuhainis
Hi Codersguru,
I'm trying to get current JMASlope value using iCustom but not sure how to do it, can you please help me?
Is this correct?
double Slope = iCustom(NULL,0,"JMASlope",14,0,0);
Thank you.
|
double Slope = iCustom(NULL,0,"JMASlope",14,
0,0);
The 0 in the above line of code sets which
indicator buffer you want information from. In the code, you'll usually see them as
IndexBuffers. There can be 8 buffers, from 0-7.
In the JMASlope indicator, if you look at the code, you'll notice that there are 2 indicator buffers, 0 and 1. 0 = UpBuffer and 1 = DnBuffer.
In most indicators you can choose whichever buffer holds the information that you want and just call that buffer. JMASlope is a little different, though. It uses 2 buffers to give you 1 piece of information, i.e. the slope. Buffer 0 keeps track of positive slopes, and buffer 1 keeps track of negative slopes. To get all the information into your EA you would need to reference both buffers, similar to the following:
Code:
double Slope
double SlopeUP = iCustom(NULL,0,"JMASlope",14,0,0)
double SlopeDN = iCustom(NULL,0,"JMASlope",14,1,0)
if(SlopeUP > 0) Slope = SlopeUP;
else
Slope = SlopeDN;
Another thing, in iCustom, the values after the indicator name, i.e. "JMASlope", and before the mode (where you choose the buffer as we did above), match the external Inputs that a user may enter on the Input tab when attaching the indicator. For JMASlope, there are two inputs, Length and Phase. So, in the above code, we've specified 14 for the length, and we left out an entry for phase, so it would use the default of 0. If you had wanted to specify a phase you would have done something like 14,2.
Well, that may be a little overkill for an answer, but I wanted you to understand how it worked. I hope all of that was understandable. Let me know if I need to clarify anything.
Keris