why icustom not run my personal indicator

 

Hi guys i have a function in expert for load a indicator , over chart

my code

void _OpenChart(string CroSS)
{
    // Apri una nuova chart per il simbolo specificato con il timeframe desiderato
    long chartID = ChartOpen(CroSS, PERIOD_H1);
    if (chartID > 0) // Controlla se il grafico è stato aperto correttamente
    {
        // Attacca l'indicatore personalizzato al grafico
        int handle = iCustom(CroSS, PERIOD_H1, "PERSONAL\\MV\\OverlayChart"); // Usa il nome dell'indicatore come stringa
        if (handle < 0)
        {
            Print("Errore nell'attaccare l'indicatore: ", GetLastError());
        }
    }
    else
    {
        Print("Errore nell'aprire il grafico per il simbolo: ", CroSS);
    }
}

but not return error and not load indicator , the path is correct  , the indicator work well (separatly)but  when i call not load o_O

 
faustf:

Hi guys i have a function in expert for load a indicator , over chart

my code

but not return error and not load indicator , the path is correct  , the indicator work well (separatly)but  when i call not load o_O

and what error messages do you get in the Journal and Expert logs...

 
Paul Anscombe #:

and what error messages do you get in the Journal and Expert logs...

not return nothing error
 
faustf #:
not return nothing error

iCustom does not display the indicator on the chart, it only provides access to it for data.

you can use ChartIndicatorAdd

https://www.mql5.com/en/docs/chart_operations/chartindicatoradd

Documentation on MQL5: Chart Operations / ChartIndicatorAdd
Documentation on MQL5: Chart Operations / ChartIndicatorAdd
  • www.mql5.com
Adds an indicator with the specified handle into a specified chart window. Indicator and chart should be generated on the same symbol and time...
 
Paul Anscombe #:

does the chart open ?   

is the indicator in the correct place ?

be more open....

yea all is correct , i nsert some print for debugging  and  also Print("sono qui ",handle); , return me 10 , i have  my folder C:\Users\pct\AppData\Roaming\MetaQuotes\Terminal\1D66438650AC158D2CF94C521FB08859\MQL5\Indicators\PERSONAL\MV

the OverlayChart.ex5,  i try also move in Indicators folder , but return the same effect

 
faustf #:

yea all is correct , i nsert some print for debugging  and  also Print("sono qui ",handle); , return me 10 , i have  my folder C:\Users\pct\AppData\Roaming\MetaQuotes\Terminal\1D66438650AC158D2CF94C521FB08859\MQL5\Indicators\PERSONAL\MV

the OverlayChart.ex5,  i try also move in Indicators folder , but return the same effect

see my last post

 
Paul Anscombe #:

see my last post

i saw  , but  not go again but probably because i not understund  how to use it  ?? , but  i think is correct

void _OpenChart(string CroSS)
{

    // Apri una nuova chart per il simbolo specificato con il timeframe desiderato
    long chartID = ChartOpen(CroSS, PERIOD_H1);
    if (chartID > 0) // Controlla se il grafico è stato aperto correttamente
    {
        // Attacca l'indicatore personalizzato al grafico
       int handle = iCustom(CroSS, PERIOD_H1, "PERSONAL\\MV\\OverlayChart"); // Usa il nome dell'indicatore come stringa
     
        // Print("sono qui ",handle);
       if(!ChartIndicatorAdd(0,0, handle)) 
        {
            Print("Errore nell'attaccare l'indicatore: ", GetLastError());
        }
    }
    else
    {
        Print("Errore nell'aprire il grafico per il simbolo: ", CroSS);
    }
}

return me error when i try to attach indicator 2024.10.17 10:42:45.153    ScannerSpread (EURUSD,H1)    Errore nell'attaccare l'indicatore: 4114

 
faustf #:

i saw  , but  not go again but probably because i not understund  how to use it  ?? , but  i think is correct

return me error when i try to attach indicator 2024.10.17 10:42:45.153    ScannerSpread (EURUSD,H1)    Errore nell'attaccare l'indicatore: 4114

finally now is work  i  write a correct function for futer memory thanks again at all,  special thanks at @Paul Anscombe

void _OpenChart(string CroSS)
{

    // Apri una nuova chart per il simbolo specificato con il timeframe desiderato
    long chartID = ChartOpen(CroSS, PERIOD_H1);
    if (chartID > 0) // Controlla se il grafico è stato aperto correttamente
    {
        // Attacca l'indicatore personalizzato al grafico
      int handle = iCustom(CroSS, PERIOD_H1, "PERSONAL\\MV\\OverlayChart");

     
         Print("sono qui handel ",handle);
       if(!ChartIndicatorAdd(chartID,0, handle)) 
        {
            Print("Errore nell'attaccare l'indicatore: ", GetLastError());
        }
    }
    else
    {
        Print("Errore nell'aprire il grafico per il simbolo: ", CroSS);
    }
}

        
void _Scanner()
{