I am writing an mql4 EA that adds a custom indicator to multiple charts
Since mql4 does not have ChartIndicatorAdd(), I used a .dll work-around for the first chart, then saved template and applied template to other subsequent charts
Now I intend to study the nature of the objects the indicator draws on the charts
ObjectsTotal returns the right amount of objects using the chart ids, however, I am unable to loop through the objects or even get the object's name
I could see the object name in the object list and I use that to try access the object properties, but still nothing
- Object created but unable to Find
- Unable to get chart id of second chart in EA
- i am stuck and need help !
Valentine Chibuike Ozoigboanugo:
I am writing an mql4 EA that adds a custom indicator to multiple charts
Since mql4 does not have ChartIndicatorAdd(), I used a .dll work-around for the first chart, then saved template and applied template to other subsequent charts
Now I intend to study the nature of the objects the indicator draws on the charts
ObjectsTotal returns the right amount of objects using the chart ids, however, I am unable to loop through the objects or even get the object's name
I could see the object name in the object list and I use that to try access the object properties, but still nothing
try the link below your msg "Object created but unable to find".
Original code before my manipulations:
// Function to check for new PSF arrows bool CheckForNewPSFArrows(long chartId, int ¤tCount, bool &buySignal, bool &sellSignal) { // Update the count int prev = currentCount; currentCount = ObjectsTotal(chartId); if(currentCount > prev) { for(int i = currentCount-1; i >= prev; i--) { string objectName = ObjectName(chartId, i); long objectTime = ObjectGetInteger(chartId, objectName, OBJPROP_TIME); int shift = InpExecutionMode == IMMEDIATE ? 0 : 1; if(StringFind(objectName, "PSF arrows:") >= 0 && objectTime == iTime(TradedSymbol, TimeFrame, shift)) { // Check the color of the arrow color arrowColor = (color)ObjectGetInteger(chartId, objectName, OBJPROP_COLOR); if(arrowColor == clrGreen || arrowColor == clrDarkGreen) { buySignal = true; Print("PSF Buy signal detected on ", TradedSymbol, " ", EnumToString(TimeFrame)); } else if(arrowColor == clrRed || arrowColor == clrCrimson) { sellSignal = true; Print("PSF Sell signal detected on ", TradedSymbol, " ", EnumToString(TimeFrame)); } return true; } } } return false; }
Still same result with the right indexing
Problem solved
The problem was actually the indexing then the actual property type I was checking.
Thank you Michael Charles Schefe

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register