Download MetaTrader 5
To add comments, please log in or register
Do you want to learn MQL5? 300 articles will help you!
Peter Williams
342
Peter Williams 2015.11.19 15:47 

I am using a custom indicator (supplied by third party) and the indicator sets dynamic levels for the 'indicator levels'. 

Instead of - say - levels of 20, 0 & 80 the upper & lower levels would be continually changing

I'd like to access these levels from an EA so that I could establish whether the 'signal' is above the higher signal or below lower signal.

Can I do this ?

whroeder1
13644
whroeder1 2015.11.19 16:10  
There is no such thing as changing levels; they must be additional lines. Look at the other buffers. Detailed explanation of iCustom - MQL4 forum
Peter Williams
342
Peter Williams 2015.11.19 16:52  

Thanks for your response.


Apologies if I have have incorrectly described the situation.

The following shots show the 'value' circled changing on tick

The value is the same as would be shown if I looked at the properties of the indicator and select the 'Levels' tab.  Normally these would be set at a fixed level (like 20, 0 , 80)

I'd like to refer to this # (8.1962 or 8.3625 or 8.576) and establish whether the indicator (yellow line) lies between the lower and upper limit.

I have looked at the explanation you refer to but don't think or understand whether this would solve my problem

Carl Schreiber
5962
Carl Schreiber 2015.11.19 19:35  

1) May be there is a way using Windows function to access the indicator's separate window - I don't know,

2) The normal way would be that the indicator itself put the levels into an indicator buffer to be accessible via iCustom(..),

3) Ask the author to change his indicator acc. to 2)

4) (indecent proposal) decompile it do it yourself.

Peter Williams
342
Peter Williams 2015.11.20 10:56  

Hi thanks for reply,

Response to 1 ~ No idea either - but suspect not.

Response to 2 ~ I have looked at 6 buffers using iCustom - doesn't appear to provide this information and definietly apperas to be set in the levels - as per screenshot


Response to 3 ~ No response at this point in time

Response to 4 ~ No idea how to do this.  It is 'free' indicator!

gooly:

1) May be there is a way using Windows function to access the indicator's separate window - I don't know,

2) The normal way would be that the indicator itself put the levels into an indicator buffer to be accessible via iCustom(..),

3) Ask the author to change his indicator acc. to 2)

4) (indecent proposal) decompile it do it yourself.

Carl Schreiber
5962
Carl Schreiber 2015.11.20 12:06  
if it's free - do you have the source code?
ThreadHandle
105
ThreadHandle 2015.11.20 14:05  

Add a new buffer "#property indicator_buffers    2"  <-- add one to this value, change the colour to whatever you want, if the new val is 3 then "#property indicator_color3 Red"

Then initialize the buffer  "double ExtNewBuffer[];" inside onInit() set the buffer and type "SetIndexStyle(2,DRAW_LINE);  SetIndexBuffer(2,ExtNewBuffer); the index for buffer starts at 0 so 2 == buffer 3.

Then make a loop for bars and set the the buffers val to your required value. such that; onCalculate(){ in here }  "int i,pos;  pos=prev_calculated-1;  for(i=pos; i<rates_total && !IsStopped(); i++) { ExtNewBuffer[i] =Bid; }"

That will draw you a new line from 0 to Bars at your specified value, if you want this value to follow the current tick then set it at Bid;  You can then do any calculation you want on the value stored in the buffer which will be a constant. 

 

Not sure if this exactly what you seek but its a work around, as far as im aware the #level property is just a line? as the data can go beyond it.  

Peter Williams
342
Peter Williams 2015.11.20 16:28  
gooly:
if it's free - do you have the source code?
Afraid not
Peter Williams
342
Peter Williams 2015.11.20 16:36  
Keelan:

Add a new buffer "#property indicator_buffers    2"  <-- add one to this value, change the colour to whatever you want, if the new val is 3 then "#property indicator_color3 Red"

Then initialize the buffer  "double ExtNewBuffer[];" inside onInit() set the buffer and type "SetIndexStyle(2,DRAW_LINE);  SetIndexBuffer(2,ExtNewBuffer); the index for buffer starts at 0 so 2 == buffer 3.

Then make a loop for bars and set the the buffers val to your required value. such that; onCalculate(){ in here }  "int i,pos;  pos=prev_calculated-1;  for(i=pos; i<rates_total && !IsStopped(); i++) { ExtNewBuffer[i] =Bid; }"

That will draw you a new line from 0 to Bars at your specified value, if you want this value to follow the current tick then set it at Bid;  You can then do any calculation you want on the value stored in the buffer which will be a constant. 

 

Not sure if this exactly what you seek but its a work around, as far as im aware the #level property is just a line? as the data can go beyond it.  

Thanks but don't think this is a solution as I understand.

I don't have the source code so can not add to the indicator. 

The lines on the chart are represented by the "Levels" parameter for the Index and are dynamic.

I want to retrieve the value of that line in my own EA


Normally you may check that a value exceeds a fixed upper limit (of say 70) or below a fixed lower limit (of say 30).

These values (30 & 70) are based as percentages and would be the same for all charts.  This indicator has 'changing levels'

Carl Schreiber
5962
Carl Schreiber 2015.11.20 19:31  
Peter, I have send you a private message - if you were 'the same'.
/
To add comments, please log in or register