Is It Possible To Temporarily Stop Printing an Indicator Line?

To add comments, please log in or register
koranged
450
koranged  

I want to design a custom indicator which prints two lines, one which trails below price in an uptrend and another which trails above price in an downtrend. The closest thing I have seen to this is like an ATR Stop indicator as pictured below. Is it possible to instruct one of the two lines to stop printing temporarily whilst the trend is in the opposite direction?


Marco vd Heijden
Moderator
8642
Marco vd Heijden  
Yes.
koranged
450
koranged  
Marco vd Heijden:
Yes.

Could you possibly elaborate on how this is possible or point towards a resource which I can use to gain more information on this subject?

Marco vd Heijden
Moderator
8642
Marco vd Heijden  
koranged:

Could you possibly elaborate on how this is possible or point towards a resource which I can use to gain more information on this subject?

Skip writing to the buffer whenever short, or long.

You can search CodeBase for example codes, or use the provided examples in Metatrader, or go to Freelance and talk to a coder there.

Or use the search function on the upper right corner of this website.

koranged
450
koranged  
Marco vd Heijden:

Skip writing to the buffer whenever short, or long.

You can search CodeBase for example codes, or use the provided examples in Metatrader, or go to Freelance and talk to a coder there.

Or use the search function on the upper right corner of this website.

Searching code base will show me examples of code but if I don't know how to perform this function then reading through the code will be almost pointless in this example because I'm not sure what it is I'm supposed to be looking for... (hence the question).

I have used the search function and have come across things such as 'EMPTY_VALUE' and 'SetIndexEmptyValue', unfortunately the MQ description in the reference is extremely limited and is therefore quite difficult for me to understand as a relative beginner... (again, hence the question).

To be honest I have no idea what you mean by "skip writing to the buffer". Terms such as this are difficult to understand for the beginner if no explanation is given and after a quick Google search I cannot see any relevant information on the phrase you have just used.

Marco vd Heijden
Moderator
8642
Marco vd Heijden  

If you write a price to the indicator buffer at every cycle it will produce the line you see on the chart.

If you skip writing a price to the buffer, there will be no line on the chart at that cycle (or cycles) until you start writing to the buffer again.

So you add something like, only write to this buffer when long and only write to that buffer when short.

However it appears to me that you are not familiar with coding so your best try Freelance.

I can not provide the code, because you will not understand it and most likely demand more until your requirements are met #FOR_FREE.

koranged
450
koranged  
Marco vd Heijden:

If you write a price to the indicator buffer at every cycle it will produce the line you see on the chart.

If you skip writing a price to the buffer, there will be no line on the chart at that cycle (or cycles) until you start writing to the buffer again.

So you add something like, only write to this buffer when long and only write to that buffer when short.

However it appears to me that you are not familiar with coding so your best try Freelance.

I can not provide the code, because you will not understand it and most likely demand more until your requirements are met #FOR_FREE.

Thank you for the information in the first three lines of your reply.

In regards to my familiarity with coding, I am a beginner who is in the process of working through the manual step by step, but I am trying to develop basic exercises for myself to complete after each section (I have just finished the custom indicator section) and am trying to practically implement the techniques I have learnt before moving on to the next section of the manual.

I am not somebody who wishes for you to provide with me code or spoon-feed me with the knowledge you have acquired for free, I am somebody who wants to learn how to do this myself (which I'm sure you yourself will appreciate is a long process, one which cannot be completed overnight and one which ultimately requires that a question be asked here or there to fill the gaps left in the MQ reference, of which in my opinion, there are many).

Nonetheless, thank you for the information you have provided. 

Marco vd Heijden
Moderator
8642
Marco vd Heijden  

You can post a job on Freelance and talk to a coder there, they will be happy to provide you a simple example which you can build on.

Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • www.mql5.com
EA Summary; My EA opens trades on multiple currencies based on where they in contrast with the MA. It uses multi-time frame for trade entries. I'd like to make 3 key enhancements. Enhancement 1: Update EA Close function; The Exit 1 close function manages when a trade will close based on the candle’s position corresponding to the MA;  Example...
koranged
450
koranged  
Marco vd Heijden:

You can post a job on Freelance and talk to a coder there, they will be happy to provide you a simple example which you can build on.

Thanks, but I have now managed to implement the desired situation based upon the information you provided in regards to skipping a cycle to avoid printing the line (for that cycle) under certain conditions.

I will keep that in mind for future reference though.

Dank je.

whroeder1
17928
whroeder1  
Same as any colored line. Look in the codebase. For MT4 I use:

One buffer has the value, color set to CLR_NONE so not shown on chart, (but in data window and pop up.)

Two buffers, one color each, with SetIndexLabel(i, NULL) so they don't show in data window.

if down: downBuffer[i]=value[i]; if(downBuffer[i+1]==EMPTY_VALUE) downBuffer[i+1]=value[i].

See also HOW CAN I hide CONNECTION lines of plots? (ttt) - MQL4 and MetaTrader 4 - MQL4 programming forum
koranged
450
koranged  
whroeder1:
Same as any colored line. Look in the codebase. For MT4 I use:

One buffer has the value, color set to CLR_NONE so not shown on chart, (but in data window and pop up.)

Two buffers, one color each, with SetIndexLabel(i, NULL) so they don't show in data window.

if down: downBuffer[i]=value[i]; if(downBuffer[i+1]==EMPTY_VALUE) downBuffer[i+1]=value[i].

See also HOW CAN I hide CONNECTION lines of plots? (ttt) - MQL4 and MetaTrader 4 - MQL4 programming forum

This is more the kind of situation I was hoping for in the first place to be honest. Thanks for that information, I will look into this now. 

To add comments, please log in or register