Can draw object with EA (when its run) on chart in mq4 ~ mq5 code expert? - page 2 123 New comment Mehrdad Shiri 2016.01.14 06:54 #11 Roberto Jacobs: See the code on my MT4 indicator SBVolumeAvgand for deleted the VLine use code:the used code do the same . all have some part of name for object. any way with your code also not wokthank you for reply, still have problem Trinh Dat 2016.01.14 07:04 #12 ObjectDelete(0,"Line_bulls"); ObjectCreate(0,"Line_bulls",OBJ_VLINE,0,Time[0],0); Mehrdad Shiri 2016.01.14 07:17 #13 Trinh Dat:ObjectDelete(0,"Line_bulls"); ObjectCreate(0,"Line_bulls",OBJ_VLINE,0,Time[0],0); thank you for reply, but if you run again the ea ( for any resion ) it must recognized the time of the order . i have stored the time and price for order in " open_buy_time , open_buy_price ". and can get them from orderisnt ? Trinh Dat 2016.01.14 07:45 #14 Mehrdad Shiri: thank you for reply, but if you run again the ea ( for any resion ) it must recognized the time of the order . i have stored the time and price for order in " open_buy_time , open_buy_price ". and can get them from orderisnt ?do not need price when draw VLINE.if you draw object when open order, then open time = Time[0] Mehrdad Shiri 2016.01.14 10:00 #15 Trinh Dat: do not need price when draw VLINE.if you draw object when open order, then open time = Time[0]thank you. yes , i am interesting why it does not work on my store data, with your hint i saw there is problem about my time format , i will check it.thx. Mehrdad Shiri 2016.01.14 21:33 #16 what is wrong about:highlighted line for date time ,. . . //---------------------- string buy_position_exist= "no"; string buy_position_modified= "yes"; . . double open_buy_price; int Magic_buy = 1; //------ . //------ datetime open_buy_time; datetime zero; int BAR_open_buy; double BAR_open_buy_heigh; double BAR_open_buy_low; . . . . //------ for (int ii0 = OrdersTotal() - 1; ii0 >= 0; ii0--) { if(OrderSelect(ii0, SELECT_BY_POS, MODE_TRADES)==true) { if (OrderSymbol() != Symbol() || OrderMagicNumber() != Magic_buy) continue; if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic_buy) { if (OrderType() == OP_BUY) open_buy_price=OrderOpenPrice(); if(OrderSelect(ii0, SELECT_BY_POS)==true) open_buy_time=(OrderOpenTime()); } } } BAR_open_buy=Bars(Symbol(),0, open_buy_time, TimeCurrent()); BAR_open_buy_heigh=High[BAR_open_buy]; BAR_open_buy_low=Low[BAR_open_buy]; . //------ . . . int ORDER_BUY=OrderSend(Symbol(), OP_BUY, LOT, ask_price, Slippage,SL,TP,Comment_mark+ "-" + level_count(),Magic_buy,0,HotPink); if (ORDER_BUY < 0) { Print(" ERROR in send BUY: ", GetLastError());} //continue; else {Print("BUY Ordered successfully");buy_position_modified="no";buy_position_exist="yes";} //--- delete all objects for(int j=ObjectsTotal()-1;j>=0;j--) { if(StringFind(ObjectName(0,j),"Line_bulls")!=-1) if(!ObjectDelete(0,ObjectName(0,j))) Print("*****---> Error in deleting object (",GetLastError(),")"); } /* int obj_total=ObjectsTotal(); PrintFormat("Total %d objects",obj_total); for(i=obj_total-1;i>=0;i--) { string name="Line_bulls";// ObjectName(i); PrintFormat("object %d: %s",i,name); ObjectDelete(0,name); } */ //ObjectCreate(0,"Line_bulls",OBJ_VLINE,0,Time[open_buy_time],open_buy_price); if(!ObjectCreate(0,"Line_bulls",OBJ_VLINE,0,open_buy_time,open_buy_price)) { Print(" can not draw VLINE: ", GetLastError());}; } //------------------- III . and the result have been commented on chart is :? Alain Verleyen 2016.01.14 21:49 #17 Mehrdad Shiri:and the result have been commented on chart is :?Where is the code that produced this output ? Mehrdad Shiri 2016.01.14 21:53 #18 Alain Verleyen: Where is the code that produced this output ?hi, thx to reply :do you mean :. . //+------------------------------------------------------------------+ Comment( "\n ask_price=",ask_price, "\n bid_price=",bid_price, "\n spread=",spread, "\n open_buy_price=", NormalizeDouble(open_buy_price,7),// open_buy_price, "\n LOSS_price=",NormalizeDouble(LOSS_price,7),// LOSS_price, "\n BAR_open_buy=",BAR_open_buy, "\n BAR_open_buy_heigh=",BAR_open_buy_heigh, "\n BAR_open_buy_low=",BAR_open_buy_low, "\n open_buy_time=",open_buy_time, "\n zero=",zero, "\n", "\n BAR_open_BUY_terminate_buy=",BAR_open_BUY_terminate_buy, "\n BAR_open_BUY_terminate_buy_heigh=",BAR_open_BUY_terminate_buy_heigh, "\n BAR_open_BUY_terminate_buy_low=",BAR_open_BUY_terminate_buy_low, "\n", "\n distance=",distance, "\n SLOPE_LINE=",NormalizeDouble(SLOPE_LINE,17), "\n VALUE_body_line=",VALUE_body_line, . . Alain Verleyen 2016.01.14 22:04 #19 Mehrdad Shiri: hi, thx to reply :do you mean :"\n open_buy_time=",TimeToString(open_buy_time), Mehrdad Shiri 2016.01.14 22:25 #20 its corrected on commented;but what about for draw line by this line: if(!ObjectCreate(0,"Line_bulls",OBJ_VLINE,0,open_buy_time,open_buy_price)) { Print(" can not draw VLINE: ", GetLastError());};this have problem to draw vline but if i used and change as below , so there is no problem and work good : if(!ObjectCreate(0,"Line_bulls",OBJ_VLINE,0,Time[0],0)) { Print(" can not draw VLINE: ", GetLastError());};? 123 New comment
See the code on my MT4 indicator SBVolumeAvg
and for deleted the VLine use code:
the used code do the same . all have some part of name for object.
any way with your code also not wok
thank you for reply, still have problem
Trinh Dat:
thank you for reply, but if you run again the ea ( for any resion ) it must recognized the time of the order .
i have stored the time and price for order in " open_buy_time , open_buy_price ". and can get them from order
isnt ?thank you for reply, but if you run again the ea ( for any resion ) it must recognized the time of the order .
i have stored the time and price for order in " open_buy_time , open_buy_price ". and can get them from order
isnt ?do not need price when draw VLINE.
if you draw object when open order, then open time = Time[0]
do not need price when draw VLINE.
if you draw object when open order, then open time = Time[0]
thank you. yes , i am interesting why it does not work on my store data, with your hint i saw there is problem about my time format , i will check it.
thx.
what is wrong about:
highlighted line for date time ,
and the result have been commented on chart is :
?
and the result have been commented on chart is :
?
Where is the code that produced this output ?
hi, thx to reply :
do you mean :
hi, thx to reply :
do you mean :
its corrected on commented;
but what about for draw line by this line:
this have problem to draw vline
but if i used and change as below , so there is no problem and work good :
?