taking values from Indicators

 

I'm sure someone else probably asked this question already but i cant seem to find an answer..

is there some command i can use (eg. int indicator.CCI.Value1 ) to get output values from a given indicator?

right now I modify the indicator to export the values to a txt and then have my EA read the txt, to use. but that's a really round about method and isn't as fast.

so to put it visually :

EA --> asks for output value of indicator--> Indicator ---> indicator returns the value(NULL if value doesn't exist) --> EA stores the value to an variable for use of calculating whether to buy/sell/don't do anything ect.

any suggestions?

 

To answer My own question (how come I all ways find the answer AFTER i post a question??)

the function I'm looking for is iCustom

(check here for reference on how to use it https://docs.mql4.com/indicators/iCustom )

sorry to waste people's times, but thank you anyways :)

cheers! and have a pleasant day :)

 
nickblack:

To answer My own question (how come I all ways find the answer AFTER i post a question??)

(check here for reference on how to use it https://docs.mql4.com/indicators/iCustom )

Hi,

I have asked the same question and found that if I have a template EA for testing indicators it works.

Using the Comment(); function and the + "\n" + (space) function i am able to see exactly what values are available and what values are causing the trend.

I will even use the DoubleToStr(VALUE!,5); to see the whole number (or atleast 5 digits here).

If the indicator is back-testable I have another line to tell me when the signal is buy or sell.

 

Thank you for your reply though I'm not sure how you extract values from an Indicator with Comment() (and I have no clue what the + "\n" + " " (function?) is.

maybe that will help with my second question (that's similar to my first)

I've used iCustom successfully with the CCI indicator but it doesn't seem to work with the AutoPivot indicator.

monthlyR1 = iCustom(NULL, 0, "AutoPivot",1,1,1,1); < is the setup and I've tried a whole heck of a lot of different parameters

the problem is unlike most Custom indicators I cant open Autopivot in the meta editor to see where he/she/they put the SetIndexBuffer's and such.

(I'm trying to get Montly R1, Monthly R2, ect ect values to return)

but I keep on getting 2147483647 returned (No data apparently)


sorry for the bombardment of questions. but thank you for your patience.

 
nickblack: the problem is unlike most Custom indicators I cant open Autopivot in the meta editor to see where he/she/they put the SetIndexBuffer's and such.

Why not? If you had used this you would have found this and would see that the indicator does not have ANY buffers.

See also Detailed explanation of iCustom - MQL4 forum



 
Subgenius:
Using the Comment(); function and the + "\n" + (space) function i am able to see exactly what values are available and what values are causing the trend.

I will even use the DoubleToStr(VALUE!,5); to see the whole number (or atleast 5 digits here).
  1. You can also open the data window (control-D) and see the indicator values as you mouse over any bar.
  2. string  PriceToStr(double p){   return( DoubleToStr(p, Digits) );              }
    string  DeltaToPips(double d){
        if (d > 0)  string sign = "+";  else    sign = "";
        double pips = d / pips2dbl;
        return( sign + DoubleToStr(pips, Digits.pips) );                           }
    
    From my code
 
WHRoeder:

Why not? If you had used this you would have found this and would see that the indicator does not have ANY buffers.

See also Detailed explanation of iCustom - MQL4 forum




A) that's friggin halarius!

B) Thank you so much! I don't know how I missed that since I was at that forum page before :s.. its a bit out of date that version but it works just fine for my purpose's.

c) can ICustom work without buffers? or should I add buffers to the code myself (which I'm probably going to do anyways, but if you know of a way to do it without buffers could you please let me know?

D) Thank you for that link! that's extremely Useful! perhaps I should write a tutorial on Icustom for other newbies like myself when i get a bit more accustomed to it. (that link does tell you pretty much all you need to know, but it took me an hour or 2 to piece it all together (following links here and there and googleing words i didn't understand and such)

 
ICustom reads buffers. No buffers no ICustom.
 
WHRoeder:
ICustom reads buffers. No buffers no ICustom.

Thank you for clearing that up :) i inserted my own buffers now, a real botch job, but it works. thank you all so much for your time/patience :)
Reason: