string objectName = ObjectName(i);
Perhaps you should read the manual. ObjectName - Object Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
Perhaps you should read the manual. ObjectName - Object Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
Congrats on the moderator status, you worked hard for it, ;-)
I always wondered why William wasn't a moderator before, he was the quintessential moderator to begin with, haha
highlight name
And press F1 key, easiest approach for accessing the API
should be:
ObjectsTotal(0); ObjectDelete(0, objectName); ObjectName(0, i);
I don't know either, there's no errors in this:
//+------------------------------------------------------------------+ //| Fibonacci | //| Copyright 2024, oxygen //| //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ #property copyright "Copyright 2023, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" #property indicator_chart_window #property indicator_plots 0 // Input parameters input int fiboLevels = 5; // Number of Fibonacci levels to plot // Variables double fiboLevelsArray[5] = {0.0, 23.6, 38.2, 50.0, 61.8}; // Fibonacci levels in percentage double fiboLevelsValues[5]; // Array to store Fibonacci levels values string fiboObjectsPrefix = "FiboLevel_"; // Prefix for Fibonacci objects string objectName; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { // Initialization code here, if needed return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { // Calculate highest high and lowest low within the available data double highestHigh = high[ArrayMaximum(high, 0, rates_total - 1)]; double lowestLow = low[ArrayMinimum(low, 0, rates_total - 1)]; // Calculate Fibonacci levels dynamically double range = highestHigh - lowestLow; for (int i = 0; i < fiboLevels; i++) { fiboLevelsValues[i] = highestHigh - range * fiboLevelsArray[i] / 100.0; } // Plot Fibonacci levels for (int i = 0; i < fiboLevels; i++) { string fiboLevelName = fiboObjectsPrefix + DoubleToString(fiboLevelsArray[i], 1); if (rates_total > 0) { ObjectCreate(0, fiboLevelName, OBJ_HLINE, 0, time[rates_total - 1], fiboLevelsValues[i]); ObjectSetInteger(0, fiboLevelName, OBJPROP_COLOR, clrGray); ObjectSetInteger(0, fiboLevelName, OBJPROP_WIDTH, 1); } else { Print("Error: Not enough bars in history for object creation"); } } return(rates_total); } //+------------------------------------------------------------------+ void OnDeinit(const int reason){ ObjectsDeleteAll(0, objectName); }
and it's working
This is for MT5. Can you specify if you're using MT4 or MT5?
I am using mt5 but it does not work for me as for the error its gone now but it wont work nothing comes up on my chart maybe i just have to delete this and start over again

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
good day am trying to complete a simple fib but keep getting error messages wrong parameter count
'ObjectName' - wrong parameters count harmonic finder asap.mq5 55 27
'ObjectDelete' - wrong parameters count harmonic finder asap.mq5 58 10
'ObjectsTotal' - wrong parameters count harmonic finder asap.mq5 52 23
here is my code