Download MetaTrader 5
To add comments, please log in or register
Do you know that MQL5 has structures?
avdarie
35
avdarie 2014.10.09 16:23 

Hi,

I have a interresant EA but I will debbug trade entries using ObjectCreate instead Ctrade. I will draw in graph all entries with ObjectCreate(chart_ID,name,OBJ_ARROW_SELL,sub_window,time,price)) Itried to do "OBJ_ARROW_SELL" or

"OBJ_ARROW_BUY" but only draw one time.If I try to copy paste differents times code that creates  Object only do one time.

Exempel:

int chart_ID=0;
  string name="Test Arrow 1 ";
  int sub_window=0;
  int time=TimeCurrent();
  double price=SymbolInfoDouble(Symbol(),SYMBOL_BID);
  Print(" time--> ",time," price -->",price);
     if(!ObjectCreate(chart_ID,name,OBJ_ARROW_BUY,sub_window,time,price))
     {
      Print(__FUNCTION__,
            ": failed to create \"Buy\" sign! Error code = ",GetLastError());
      return(false);

     }

    // For see if create second Arrow

     price = price - 500;

    Print(" time--> ",time," price -->",price);

     if(!ObjectCreate(chart_ID,name,OBJ_ARROW_SELL,sub_window,time,price))

     {
      Print(__FUNCTION__,
            ": failed to create \"Buy\" sign! Error code = ",GetLastError());
      return(false);

     }

Anybody know because do that ?

Thanks every body,

Andrei Darie

MrGrey
8055
MrGrey 2014.10.09 22:52  
One name for both objects? Try different names.
avdarie
35
avdarie 2014.10.10 11:01  

Hi,

Was problem with subtract I need to do  "price = price - 0.00300" because price is float :). I can see bought objects.  I do -500 is out of graph ...

Thanks.

/
To add comments, please log in or register