I am having problems getting my horizontal line to appear on mql5. it says there are no errors but no object is ever created in the object list or appears on the chart. What is the basic code to produce a simple horizontal line with an EA at the current price and time on a M1 chart so I can see what I am doing wrong
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
- www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
- Web version features
- MQL5 Wizard: Development of trading robots for MetaTrader 5
- Technical analysis tools in MetaTrader 5
void OnStart() { long cid=ChartID(); double bid=SymbolInfoDouble(Symbol(),SYMBOL_BID); ResetLastError(); if(!ObjectCreate(cid,"test",OBJ_HLINE,0,0,bid) || GetLastError()!=0) Print("Error creating object: ",GetLastError()); else ChartRedraw(cid); }

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