- No such settings.
- Have the EA create (for live) or modify the objects.
whroeder1:
- No such settings.
- Have the EA create (for live) or modify the objects.
thanks
MT4 code
//+------------------------------------------------------------------+ //| Initialization | //+------------------------------------------------------------------+ int digitsLots; bool firstTimer; int OnInit(){ firstTimer = true; double lotStep = MarketInfo(_Symbol, MODE_LOTSTEP); digitsLots = digits_in(lotStep); if(!EventSetTimer(1) ) Alert(StringFormat("EST:%i", _LastError) ); return INIT_SUCCEEDED; } //+------------------------------------------------------------------+ //| Custom indicator timer function | //+------------------------------------------------------------------+ void OnTimer(void){ if(ShowTrades){ for(int iPos = OrdersHistoryTotal(); iPos > 0;){ --iPos; if(select_order(iPos, SELECT_BY_POS, MODE_HISTORY) ) create_trades(!firstTimer); } } // ShowTrades firstTimer = false; } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason){ EventKillTimer(); if(ShowTrades) delete_trades(); } //+------------------------------------------------------------------+ //| Create Order result | //+------------------------------------------------------------------+ void create_trades(bool doAlert){ // Order is selected. int ot = OrderType(); color clr = ot == OP_BUY ? Blue : Red; string op = as_string( (Trade_Operation)ot); datetime from = OrderOpenTime(), to = OrderCloseTime(); double oop = OrderOpenPrice(), ocp = OrderClosePrice(); string open = price_as_string(oop); string close = price_as_string(ocp); string lots = lots_as_string(OrderLots() ); int ticket = OrderTicket(); string tLine = StringFormat("#%i %s -> %s", ticket, open, close); if(doAlert && ObjectFind(tLine) < 0) Alert(StringFormat("closed %i on %s",ticket,_Symbol)); // expert.wav; /*void*/ create_tLine(tLine, from, oop, to, ocp, clr); /*void*/ create_arrow(StringFormat("#%i %s %s %s at %s", ticket, op, lots, _Symbol, open), from, oop, 1, clr); /*void*/ create_arrow(StringFormat("#%i %s %s %s at %s close at %s", ticket, op, lots, _Symbol, open, close), to, ocp, 3, Goldenrod); } void delete_trades(void){ ObjectsDeleteAll(0, "#"); } //+------------------------------------------------------------------+ //| Create Trend line | //+------------------------------------------------------------------+ #define WINDOW_MAIN 0 void create_tLine(string name, datetime time1, double price1, datetime time2, double price2, color clr, ENUM_LINE_STYLE style=STYLE_DOT){ ObjectCreate(name, OBJ_TREND, WINDOW_MAIN, time1, price1, time2, price2); ObjectSetInteger(0, name, OBJPROP_COLOR, clr); ObjectSetInteger(0, name, OBJPROP_STYLE, style); ObjectSetInteger(0, name, OBJPROP_RAY, false); } //+------------------------------------------------------------------+ //| Create Arrow | //+------------------------------------------------------------------+ void create_arrow(string name, datetime time, double price, int code, color clr){ ObjectCreate(name, OBJ_ARROW, WINDOW_MAIN, time, price); ObjectSetInteger(0, name, OBJPROP_COLOR, clr); ObjectSetInteger(0, name, OBJPROP_ARROWCODE, code); } //+------------------------------------------------------------------+ //| Miscellaneous | //+------------------------------------------------------------------+ string price_as_string(double price){return DoubleToStr(price, _Digits); } string lots_as_string( double lots){ return DoubleToStr(lots, digitsLots); } bool select_order(int iWhat, int eSelect, int ePool=MODE_TRADES){ if(!OrderSelect(iWhat, eSelect, ePool) ) return false; if(OrderMagicNumber() != MagicNumber ) return false; // \ Extern if(OrderSymbol() != _Symbol ) return false; // / variables. if(ePool != MODE_HISTORY ) return true; return OrderType() <= OP_SELL; // Avoid cr/bal forum.mql4.com/32363#325360 // Never select canceled orders. } int digits_in(double d){ int digits = 0; while(d - int(d) > 1.E-8){ d *= 10.0; ++digits; } return digits; }MT4 code
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi,
Does anyone know how to increase the size of buy/sell arrow and the associated trendline that is drawn by strategy tester in visual mode on the chart?
Mine is too small to see and i cant change this in the "Tester.tpl" template.
thanks