Hi seems to be easy task but, i cant figure it out so easily, and can't find simple info for it. I just need that my EA would add hline every day at given time for ex 12.00. I have tryed that but it does not draw anything, also i need that it would be able to see in strategy tester.
ObjectCreate("name", OBJ_HLINE, 0, Time[12:00], Close[0]); <------ Time[12:00] is incorrect. Time[] array takes in of int type, the shift in no. of bars.
ObjectSet("name", OBJPROP_COLOR, Red);
ObjectSet("name", OBJPROP_WIDTH, 1);
}
Is it so dificuilt to specify the simple time cordinates to EA ???
You need a conditional like this:
if(TimeHour(Time[0])==12 && TimeMinute(Time[0])==0) { then create the object..use a different "name" for different object
THANK YOU! it worked :) finaly, but one more thing, i need that it draw the line every day at 12, with this code it draws one time and stays forever.It should draw one and wait for the next one and delete old one. Is it hard to do?
datetime now = Time[0], bod = now - now % 86400, // 00:00 H1200 = bod + 12 * 3600; if (H12 > now) H1200 = bod - 12 * 3600; int iH12 = iBarShift(NULL,0, H12); // Handle weekends and holidays. HLine("name", Close[iH12], Red); : void HLine(string name, double P0, color clr){ #define WINDOW_MAIN 0 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()); }
- You want the noon close, not close[0]
- You have to delete the old and recreate or move it.
- There is no noon on Saturday or Sunday.
- You might like a horizontal trendline starting at noon instead of a Hline.
: TLine("name", Time[iH12], Close[iH12], Time[0], Close[iH2], Red, true); : void TLine( string name, datetime T0, double P0, datetime T1, double P1 , color clr, bool ray=false ){ #define WINDOW_MAIN 0 if (ObjectMove( name, 0, T0, P0 )) ObjectMove(name, 1, T1, P1); else if (!ObjectCreate( name, OBJ_TREND, WINDOW_MAIN, T0, P0, T1, P1 )) Alert("ObjectCreate(",name,",TREND) failed: ", GetLastError() ); else if (!ObjectSet( name, OBJPROP_RAY, ray )) Alert("ObjectSet(", name, ",Ray) failed: ", GetLastError()); if (!ObjectSet(name, OBJPROP_COLOR, clr )) // Allow color change Alert("ObjectSet(", name, ",Color) [2] failed: ", GetLastError()); string P0t = PriceToStr(P0); if (MathAbs(P0 - P1) >= Point) P0t = StringConcatenate(P0t, " to ", PriceToStr(P1)); if (!ObjectSetText(name, P0t, 10)) Alert("ObjectSetText(",name,") [2] failed: ", GetLastError()); }
THANK YOU! it worked :) finaly, but one more thing, i need that it draw the line every day at 12, with this code it draws one time and stays forever.It should draw one and wait for the next one and delete old one. Is it hard to do?
Доброго времени суток уважаемые форумчане!
Меня зовут Герман, мне 23 года, я являюсь трейдером компании "Инстафорекс"
Помогите в поиске нужного скрипта! Скрипт нужен для сетки отложенных ордеров.
Thanks for help, but some of your sugestions is too dificult, so i did lines to apear every day like that, but now i have other the most important problem. How to make space betwen those two lines,exactly for ex 20p ? i tryed ydistance but it is not working. I need that ea would add twoo lines at given time with the 20p space. Is it posible?
if(TimeHour(Time[0])==10 && TimeMinute(Time[0])==0) ObjectDelete("virsus"); ObjectDelete("apacia"); if(TimeHour(Time[0])==11 && TimeMinute(Time[0])==0) ObjectCreate("virsus", OBJ_HLINE, 0, Time[0], High[0]); ObjectSet("virsus", OBJPROP_COLOR, Red); ObjectSet("virsus", OBJPROP_WIDTH, 1); if(TimeHour(Time[0])==11 && TimeMinute(Time[0])==0) ObjectCreate("apacia", OBJ_HLINE, 0, Time[0], Low[0]); ObjectSet("apacia", OBJPROP_COLOR, Blue); ObjectSet("apacia", OBJPROP_WIDTH, 1); double virsus = ObjectGet("virsus", OBJPROP_PRICE1); double apacia = ObjectGet("apacia", OBJPROP_PRICE1);
Thanks for help, but some of your sugestions is too dificult, so i did lines to apear every day like that, but now i have other the most important problem. How to make space betwen those two lines,exactly for ex 20p ? i tryed ydistance but it is not working. I need that ea would add twoo lines at given time with the 20p space. Is it posible?
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- 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 seems to be easy task but, i cant figure it out so easily, and can't find simple info for it. I just need that my EA would add hline every day at given time for ex 12.00. I have tryed that but it does not draw anything, also i need that it would be able to see in strategy tester.
ObjectCreate("name", OBJ_HLINE, 0, Time[12:00], Close[0]);
ObjectSet("name", OBJPROP_COLOR, Red);
ObjectSet("name", OBJPROP_WIDTH, 1);
}
Is it so dificuilt to specify the simple time cordinates to EA ???