Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 188

 
Sepulca:


Right, don't divide by zero))))
You should provide a condition prohibiting division by zero, that's all. Although I'm not a high-level programmer, I don't forget about such things, despite the fact that exel has only 7 possible conditional jumps.
 
ikatsko:
Why does the Print(TimeToStr(Time[0],TIME_MINUTES)); command give a result like 12:00[sl]? The issue here is the bracketed prefix. And how can I get a result without brackets? (Thanks in advance.)

Greetings, I remember that somewhere we have collaborated and touched and you have fulfilled my request. Thank you.
 
artmedia70:

Are you sure? This is usually added to the order comment when closing at stop. [tp] is added when closing at take.

I pasted your line into an empty EA template and ran it in the tester at M15 on open prices:


No your [sl]


Yes, you are right. Indeed the command was put after SL. I see. Thank you.

 

Hi all!!! I have an EA opening orders against the movement, how to change or advise where to change???

void modify_orders( int type )
{
int i;
datetime time_last = 0, time_first = TimeCurrent();
double SPREAD = MarketInfo(Symbol(),MODE_SPREAD)*MarketInfo(Symbol(),MODE_POINT), op_pr_last, op_pr_first, level;

for( i = OrdersTotal() - 1; i >= 0; i-- )
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if( OrderMagicNumber() == ID && OrderType() == type )
{
if ( OrderOpenTime() > time_last )
{
op_pr_last = OrderOpenPrice();
time_last = OrderOpenTime();
}
if ( OrderOpenTime() < time_first )
{
op_pr_first = OrderOpenPrice();
time_first = OrderOpenTime();
}
}
}


if ( type == 0 )level = op_pr_last + MathAbs(op_pr_last-op_pr_first) * (SL/100);
if ( type == 1 )level = op_pr_last - MathAbs(op_pr_last-op_pr_first) * (SL/100);

for( i = OrdersTotal() - 1; i >= 0; i -- )
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if( OrderMagicNumber() == ID && OrderType() == type && NormalizeDouble(OrderTakeProfit(),Digits) != NormalizeDouble(level,Digits) )OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),level,0);
}
}

double last_trade( int t )
{

 
KeinRich:

Hi all!!! My EA is opening orders against the movement, how can I change or advise where to change???


What does this have to do with the modification function, which is also not very well written?
 
Is there a hotkey combination to bring up the Alert window when it is closed?
 
Please tell me how to draw an arrow with a LABEL object using a Wingdings font.
 
Neo333:
Is there a hotkey combination to bring up the Alert window when it is closed?
You can look in the logbook.
 
zfs:
Tell me how to draw an arrow using the LABEL object, using the Wingdings font.
//+----------------------------------------------------------------------------+
void SetArrow(int cd, color cl, string nm="", datetime t1=0, double p1=0, int sz=0) {
   if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_ARROW, 0, 0, 0);
   ObjectSet(nm, OBJPROP_TIME1    , t1);
   ObjectSet(nm, OBJPROP_PRICE1   , p1);
   ObjectSet(nm, OBJPROP_ARROWCODE, cd);
   ObjectSet(nm, OBJPROP_COLOR    , cl);
   ObjectSet(nm, OBJPROP_WIDTH    , sz);
}
//+----------------------------------------------------------------------------+

Called to draw a red skull on the current candle at Bid price, size 1 using Arrow:

SetArrow(78, Red, "Scull", Time[0], Bid, 1);

This is the function to display the text. They are similar. Try to make one yourself to output the marker.

//+----------------------------------------------------------------------------+
void SetArrowText(string text, color cl, string font="Arial", string nm="", datetime t1=0, double p1=0, int sz=0) {
   if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_TEXT, 0, 0, 0);
   ObjectSet(nm, OBJPROP_TIME1    , t1);
   ObjectSet(nm, OBJPROP_PRICE1   , p1);
   ObjectSetText(nm, text,sz, font, cl);
}
//+----------------------------------------------------------------------------+
 
artmedia70:

Called to draw a red skull on the current candle at Bid price, size 1 using Arrow:

This is the function to display the text. They are similar. Try to make one yourself to output the marker.



Thank you. But you need it for a LABEL object, pixel by pixel.
Reason: