Hi,
I want to broadcast a message to all the open charts. The code is already written and there was no issue, but then I noticed that sometimes one chart's OnChartEvent is not getting triggered. It's always the same. Because I am still developping, only two charts have the OnChartEvent function so far.
I have no idea why one function is seemingly invisible on a whim. id is the same and the functions are located at the same place in each file.
I loop through all the open charts from 0 to CHARTS_MAX, so the troubled chart is not missed. Yet, the Alert() is not triggered.
Why are you using CHARTS_MAX that is a constant?
Which chart is missed, the last one?
Show your code that loops the charts..
Hi,
I want to broadcast a message to all the open charts. The code is already written and there was no issue, but then I noticed that sometimes one chart's OnChartEvent is not getting triggered. It's always the same. Because I am still developping, only two charts have the OnChartEvent function so far.
I have no idea why one function is seemingly invisible on a whim. id is the same and the functions are located at the same place in each file.
I loop through all the open charts from 0 to CHARTS_MAX, so the troubled chart is not missed. Yet, the Alert() is not triggered.
Why are you using CHARTS_MAX that is a constant?
Which chart is missed, the last one?
Show your code that loops the charts..
CHARTS_MAX = The maximum possible number of simultaneously open charts in the terminal |
bad chart id=133315345830123751
good chart id=133315345830123736
int eventID=broadcastEventID-CHARTEVENT_CUSTOM; long currChart=ChartFirst(); int i=0; while(i<CHARTS_MAX) { EventChartCustom(currChart,eventID,lparam,dparam,sparam); currChart=ChartNext(currChart); if(currChart==-1) break; i++; }
I had two functions with the same name but different parameters sending the broadcast. I just deleted the old version I was not calling. Still, I suspect it might be the cause. I'll see.
CHARTS_MAX = The maximum possible number of simultaneously open charts in the terminal |
bad chart id=133315345830123751
good chart id=133315345830123736
I had two functions with the same name but different parameters sending the broadcast. I just deleted the old version I was not calling. Still, I suspect it might be the cause. I'll see.
All charts are correctly sent the message by
EventChartCustom
... but the problem is still happening :-/
Ok I can see that but you still don’t need the charts_max. Use a while loop with the chartnext instead. Simpler easier to understand
I deleted the duplicate function. It didn't change anything.
I am now testing with the same
OnChartEvent
function as the working chart.
I don't know why the body would prevent the function from being executed but I am trying anyway.- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I want to broadcast a message to all the open charts. The code is already written and there was no issue, but then I noticed that sometimes one chart's OnChartEvent is not getting triggered. It's always the same. Because I am still developping, only two charts have the OnChartEvent function so far.
I have no idea why one function is seemingly invisible on a whim. id is the same and the functions are located at the same place in each file.
I loop through all the open charts from 0 to CHARTS_MAX, so the troubled chart is not missed. Yet, the Alert() is not triggered.