Download MetaTrader 5

There is a code that I cannot remember

To add comments, please log in or register
Use MQL5 Cloud Network. It is secure!
charly king her
945
charly king her 2013.03.20 01:20 

Okay, I have a question for the pros around here.


For indicators, I know the method function IndicatorRelease(indicator_handle) can release handle and thus free memory efficiently.

NEED:

1) Still want to use indicator.

2) Just don't want indicator cluttering my screen because I need to see my price chart.


Thus, I need something like indicator_handle.visiblity = FALSE.  In MT4, I think it is HideTestIndicators(true).

What is the correct code to hide visibility with indicator still running in memory?

charly king her
945
charly king her 2013.03.20 04:34  

How do you do visibility for indicators, come on?

Where are all the pros at?

I am sure answering this question will not only help me out

but also help millions afterward that comes reading my question or searching for the answer.

Alain Verleyen
Moderator
30722
Alain Verleyen 2013.03.20 08:29  
ckingher:

How do you do visibility for indicators, come on?

Where are all the pros at?

I am sure answering this question will not only help me out

but also help millions afterward that comes reading my question or searching for the answer.

In which conditions do you hide the indicators, when backtesting in Visual Mode ? or ?
charly king her
945
charly king her 2013.03.20 09:51  
angevoyageur:
In which conditions do you hide the indicators, when backtesting in Visual Mode ? or ?


Since you ask, I might turn off indicator under the condition of EA user external parameter such as

VISUAL_INDICATORVISUAL = 0, when 0 is set by user the indicator visibility should be off.

If set to 1, turn indicator visbility is back on. 


As for backtesting, demo mode, or live mode, user should have external control over visibilty.

graziani
1954
graziani 2013.03.20 16:54  
ChartIndicatorAdd(), ChartIndicatorDelete()
charly king her
945
charly king her 2013.03.20 20:19  
graziani:
ChartIndicatorAdd(), ChartIndicatorDelete()

Sounds almost right, but I don't want to delete one indicator after another like that.

Where is the ChartIndicatorDeleteALL() command??

Thanks for the info though.

charly king her
945
charly king her 2013.03.20 21:05  

ChartIndicatorAdd() - Adds visibility.

ChartIndicatorDelete() - Removes visibility.

ChartIndicatorDeleteALL() - This function does not exist.


And therefore, I made a function.  Below is the code for all to use.  I have tested the code, it works.


void ChartIndicatorDeleteALL()
  {
    for (int sub_idx= 0; sub_idx < ChartGetInteger(0, CHART_WINDOWS_TOTAL, 0); sub_idx++)
    {
      for (int idx = 0; idx < ChartIndicatorsTotal(0, sub_idx); idx++)
      {
        string short_name = ChartIndicatorName(0, sub_idx, idx);
        if (StringLen(short_name) > 0) { ChartIndicatorDelete(0, sub_idx, short_name); }
      }
    } 
  }
Alain Verleyen
Moderator
30722
Alain Verleyen 2013.03.20 21:17  

Please use the SRC button when you post code.

Thank you for sharing.

To add comments, please log in or register