Download MetaTrader 5
To add comments, please log in or register
Do you have idle PCs? Connect them to MQL5 Cloud Network and earn money!
Terrence Brannon
204
Terrence Brannon 2014.06.18 13:26 

Could someone link me to the docs for drawLine()? I have searched both this site and google and can find no docs.

Thank you.

Drazen Penic
2405
Drazen Penic 2014.06.18 15:33  

There is no drawLine in MQL4 . Maybe you saw that in some code, but that was custom code.

For drawing lines (and other objects) use Object functions

qjol
3243
qjol 2014.06.18 16:46  
You did not searched hard enough http://bit.ly/1iasqE1
whroeder1
13610
whroeder1 2014.06.18 17:22  
qjol: You did not searched hard enough http://bit.ly/1iasqE1
Unfortunately, all those results are 404
from Free download of the 'Daily Open-SR (Dosr)' indicator for MetaTrader 4 in the MQL5 Code BaseFrom my code
int DrawLine(double price, string Obj, color clr)
  {
   int objs=ObjectsTotal();
   string name;
   for(int cnt=ObjectsTotal()-1;cnt>=0;cnt--)
     {
      name=ObjectName(cnt);
      if (StringFind(name,Obj,0)>-1)
        {
         ObjectMove(Obj,0,Time[0],price);
         ObjectsRedraw();
         return(1);
        }
     }
   ObjectCreate(Obj,OBJ_HLINE,0,0,price);
   ObjectSet(Obj,OBJPROP_COLOR,clr);
   WindowRedraw();
   return(0);
  }
void HLine(string name, double P0, color clr){ #define WINDOW_MAIN 0
   if(!Show_Objects) return;
   if      ( ObjectMove(name, 0, Time[iCB], P0) ){}
   else  if( !ObjectCreate( name, OBJ_HLINE, WINDOW_MAIN, Time[iCB], P0) )
      AlertMe( "ObjectCreate(",name,",HLINE) failed: ", GetLastError() );
   if( !ObjectSet(name, OBJPROP_COLOR, clr) )         // Allow color change
      AlertMe( "ObjectSet(", name, ",color) [3] failed: ", GetLastError() );
   if( !ObjectSetText(name, PriceToStr(P0), 10) )
      AlertMe( "ObjectSetText(",name,") [6] failed: ", GetLastError() );
}
/
To add comments, please log in or register