Download MetaTrader 5

There is a code that I cannot remember

To add comments, please log in or register
charly king her
974
charly king her  

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
974
charly king her  

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
33295
Alain Verleyen  
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
974
charly king her  
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
2025
graziani  
ChartIndicatorAdd(), ChartIndicatorDelete()
charly king her
974
charly king her  
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
974
charly king her  

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
33295
Alain Verleyen  

Please use the SRC button when you post code.

Thank you for sharing.

To add comments, please log in or register