indicator not seeing custom chart event?

 

Hi

I have a script that will send a custom chart event every half a second, on the other side, I want my indicator to receive this chart event and see it.

The script code :

void OnStart()
{
    while(true)
    {
        EventChartCustom(0,CHARTEVENT_CUSTOM + 22255, 0, 0, "");
        Sleep(500);
    }
}

and now the on chart event of the indicator :

void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
{
    if(id == CHARTEVENT_CUSTOM + 22255)
        Print("Cycle");
}

As much as I read forums and the documentation, this should work, but when I put the indicator and the script both on the same chart, I don't see the "Cycle" being printed on the experts tab of the tool box, in other words, the indicator does not receive the custom chart event or I am not sending the event properly.


Can anyone help please?

 
easyfxbot:

Hi

I have a script that will send a custom chart event every half a second, on the other side, I want my indicator to receive this chart event and see it.

The script code :

and now the on chart event of the indicator :

As much as I read forums and the documentation, this should work, but when I put the indicator and the script both on the same chart, I don't see the "Cycle" being printed on the experts tab of the tool box, in other words, the indicator does not receive the custom chart event or I am not sending the event properly.


Can anyone help please?

never mind the question, found the error, when sending the custom event, it should be like :

EventChartCustom(0, 22255, 0, 0, "");