Download MetaTrader 5

drawLine docs?

To add comments, please log in or register
Terrence Brannon
209
Terrence Brannon  

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
2727
Drazen Penic  

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
3245
qjol  
You did not searched hard enough http://bit.ly/1iasqE1
whroeder1
17047
whroeder1  
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