hi
thx to reply:
my ea work well for mt4 in mq4 file ,
i add heighlighted line to draw vline.
when i send order i want to have a vertical line , as below i have it :
. . . int ORDER_BUY=OrderSend(Symbol(), OP_BUY, LOT, ask_price, Slippage,SL,TP,Comment_mark+ "-" + level_count(),Magic_buy,0,HotPink); ObjectCreate(0,"Line_buy",OBJ_VLINE,0,Time[open_buy_time],open_buy_price); if (ORDER_BUY < 0) { Print(" ERROR in send BUY: ", GetLastError());} //continue; else {Print("BUY Ordered successfully");buy_position_modified="no";buy_position_exist="yes";} , , ,
there is no error or warning with compiling
, and also no problem when run ea
but no effect to draw vlline.!what is wrong ?
Always check the return value when you are using an mql function.
Return Value
Returns true or false depending on whether the object is created or not. To read more about the error call GetLastError(). If the object has been created already, the function tries to change its coordinates.
THANK you ,
i forget it.
there is : error 4200
i will check it . please see the result if i asked for help. thank you again , Alain .
hi,
its draw the line for first time but it must create new line in future by another order and delete that created before.
my code is below.
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,Time[open_buy_time],open_buy_price)) { Print(" can not draw VLINE: ", GetLastError());}; } //------------------- III
its delete the old vline but did not create a new vline at new candle sor new order .
where is the problem?
add: and no error printed.
hi,
its draw the line for first time but it must create new line in future by another order and delete that created before.
my code is below.
its delete the old vline but did not create a new vline at new candle sor new order .
where is the problem?
To resolve your problem, your code should be changed as follows:
if(!ObjectCreate(0,"Line_bulls"+string(TimeToString(Time[open_buy_time],TIME_DATE|TIME_MINUTES)),OBJ_VLINE,0,Time[open_buy_time],open_buy_price)) {Print(" can not draw VLINE: ", GetLastError());} // With this code, so any object "Vline" has a different name.
if(!ObjectCreate(0,"Line_bulls",OBJ_VLINE,0,Time[0],ask_price)) { Print(" can not draw VLINE: ", GetLastError());};
The problem is: the object name remains the same "Vline_bulls", although the "VLine" different Time [] of coordinates.
To resolve your problem, your code should be changed as follows:
i have function to delete even with same name befor create it again. is what you say necessary ?
add: and no error printed.
The problem is: the object name remains the same "Vline_bulls", although the "VLine" different Time [] of coordinates.
To resolve your problem, your code should be changed as follows:
TRY that, still have problem.
See the code on my MT4 indicator SBVolumeAvg
and for deleted the VLine use code:
int obj_total=ObjectsTotal(); PrintFormat("Total %d objects",obj_total); for(i=obj_total-1;i>=0;i--) { string name="Line_bulls"+string(TimeToString(Times[i],TIME_DATE|TIME_MINUTES)));// ObjectName(i); PrintFormat("object %d: %s",i,name); //ObjectDelete(0,name); ObjectDelete("Line_bulls"+string(TimeToString(Times[i],TIME_DATE|TIME_MINUTES))); } //-- Thus, all objects VLine "Line_bulls"+ will be deleted

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi;
Can draw object with EA (when its run) on chart in mq4 code expert ?
what about mq5 ?