How a expert put vertical line in chart, every time to open order.
I tried this code, but it works only for the first order, not work in the next orders.
Please help me!!
Thanks, you help me.
But I have one more problem, if open limit orders and modify limit order, the line mοdify with order.
I want the arrows not modify.
Thanks, you help me.
But I have one more problem, if open limit orders and modify limit order, the line mοdify with order.
I want the arrows not modify.
How a expert put vertical line in chart, every time to open order.
I tried this code, but it works only for the first order, not work in the next orders.
ObjectCreate("Buy_Signal",OBJ_HLINE,0,TimeCurrent(),Ask);
Of course it doesn't.
- You're creating a HORIZONTAL line not a vertical one.
- Once it is created, the subsequent ObjectCreate calls fail
- Always test return codes so you find out WHY
if (!ObjectCreate(..) Alert("ObjectCreate failed: ", GetLastError());
Either you must use unique names or move the line
int ticket = OrderSend(..) if (ticket < 0) Alert("OrderSend failed: ", GetLastError()); else Vline("Buy_Signal"+ticket, TimeCurrent(), MediumSpringGreen);
void HLine(string name, double P0, color clr){ // #define WINDOW_MAIN 0 if (!Show.Objects) return; /**/ if (ObjectMove( name, 0, Time[0], P0 )){} else if(!ObjectCreate( name, OBJ_HLINE, WINDOW_MAIN, Time[0], P0 )) Alert("ObjectCreate(",name,",HLINE) failed: ", GetLastError() ); if (!ObjectSet(name, OBJPROP_COLOR, clr )) // Allow color change Alert("ObjectSet(", name, ",Color) [1] failed: ", GetLastError() ); if (!ObjectSetText(name, PriceToStr(P0), 10)) Alert("ObjectSetText(",name,") [1] failed: ", GetLastError()); } void VLine(string name, datetime T0, color clr){ // #define WINDOW_MAIN 0 if (!Show.Objects) return; if (ObjectMove( name, 0, T0, 0 )){} else if (!ObjectCreate( name, OBJ_VLINE, WINDOW_MAIN, T0, 0 )) Alert("ObjectCreate(",name,",VLINE) failed: ", GetLastError() ); if (!ObjectSet(name, OBJPROP_COLOR, clr )) // Allow color change Alert("ObjectSet(", name, ",Color) [1] failed: ", GetLastError() ); if (!ObjectSetText(name, TimeToStr(T0, TIME_MINUTES), 10)) Alert("ObjectSetText(",name,") [4] failed: ", GetLastError()); }See my code.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How a expert put vertical line in chart, every time to open order.
I tried this code, but it works only for the first order, not work in the next orders.
Please help me!!