[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 127

 
borilunad:
... I've put it in for you. You can do the same in your post.
Cool.
 
borilunad:
Sorry, it won't work! Not the first one, not the last one!

Why? Because the last order is OrdersTotal()- 1, and the first order has an index of 0 . Why then it won't work?
 
borilunad:

I have a function for all modifications such as setting SL and TP, transferring to B/S, trawling positions and orders with attempts and error checks.

I only need to prescribe position selection, conditions and warnings in the start. Here is the function:

Small but clever!


By the way, your function only modifies orders. And the conditions are already all in the start. And I have all the conditions in the function. It turns out that there will be a lot of conditions placed in the start and it would be very unreasonable to overload it, wouldn't it? After all, the essence of function is mostly in conditions, not only in bare modification function, of course with displaying errors. But somehow you have a strange approach. I have not yet encountered it. I look and I am surprised.
 
hoz:

By the way, your function only modifies orders. And the conditions are already all in the start. And I have all conditions in the function. It turns out that there will be a lot of conditions placed in the start and it would be very unreasonable to overload it, wouldn't it? After all, the essence of function is mostly in conditions, not only in bare modification function, of course with displaying errors. But it is a strange approach. I have never seen such an approach. I look at it and wonder.
Everyone chooses what is convenient to him! I have the advantage that one function precisely fulfills all possible modifications of a pending and open position. I specify all necessary conditions in the start line that may change frequently depending on the market whims. This gives me great flexibility in my work. In contrast, you need to have a lot of functions and still have to prescribe all of the conditions in the Start and in the Functions. You will gradually come to your own comfortable manner. But the main thing is to achieve a clear logic and error-free operation of the program. I wish you success!
 
hoz:

Why? Because the last order is OrdersTotal() - 1, and the first order has index 0 . Why then it won't be?

For the last order there is a function at Kim's where he compares by time to avoid errors, and for the first order.

You think of everything at once, but the computer thinks one at a time, say 0 or 1, then again, 0 or 1, and again 0 or 1, etc.

So you have to do by the logic of the machine, not ours. And the reward will be an error-free program! Good luck!

 
borilunad:
Use theSRC button at the top to insert code! No one will poke around like that. I've pasted it for you. You can do the same in your post.
Thanks for the help. I corrected my post, and I hope it was right.
 
borilunad:

I have a function for all modifications such as setting SL and TP, transferring to B/S, trawling positions and orders with attempts and error checks.

I only need to prescribe position selection, conditions and warnings in the start. Here is the function:

void ModifyOrder(int ticket,double price,double stoploss,double takeprofit,datetime e,color arrow_color)
{
  int ModifyCnt = 0, err;
  while(ModifyCnt < 3)
  {
    if(OrderModify(ticket,NormalizeDouble(price,Digits),NormalizeDouble(stoploss,Digits),
    NormalizeDouble(takeprofit,Digits),0,arrow_color))
    ModifyCnt = 3;
    else err = GetLastError();
    if(err > 0)
    { 
      Print(ModifyCnt," #",ticket," Error modifing order: (", err , ") " , ErrorDescription(err));
      Sleep(5000); RefreshRates(); ModifyCnt++;
} } }

The little one!


Boris. Why do you have the variable e here ?
 
hoz:

Boris. Why do you have variable e here ?
Variable e is the variable (for order, see OrderModify() doc), which I must specify, if I want to use arrow_color, one for bai and another for sell, and I can vary colour for orderModify()). After all, the program doesn't go into such details at once, as we do, but one by one, defining parameters by their place of presentation in the standard OrderModify() function.
 
borilunad:
Variable e is an expiration (for orders, see Doc OrderModify()), which I must specify if I want to use arrow_color, for bai one, and for sell another, and for orders I can diversify the colour). After all, the program doesn't go into such details at once, as we do, but one by one, defining parameters by their place of presentation in the standard OrderModify() function.

You can set it to 0(zero), since usually the expiration is not required. But you probably have it in case of emergency, so that you don't have to return to this point.
 
Can you advise: is there a freely available custom function already written that takes an array as input and exports it to excel?
Reason: