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

 

Guys, it's been a while since I recorded a strategy tester video. I forgot. Can you tell me if there's a new one available... Thank you. I'll look for myself on the site via google, I think in the "Navigator" was.

Or give me a link to read about it...

 

Good afternoon. Dear teachers, Here I am writing a function, its task is to go through all orders by magic and return the ticket order with the lowest profit.

Look if I have written it correctly:

int TicketMinProfitPos(string sy="", int op=-1, int mn=-1) {
double mi, p;
int    i, k=OrdersTotal(), pp=0, ti=0;
double arr_Orders[10][10];
int Qnt=0; // объявление и обнуление счётчика ордеров
ArrayInitialize (arr_Orders,0); // обнуление массива

  if (sy=="0") sy=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      if ((OrderSymbol()==sy || sy=="") && (op<0 || OrderType()==op)) {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if (mn<0 || OrderMagicNumber()==mn) {
             Qnt++;
             arr_Orders[Qnt][8]=OrderProfit();
       } arr_Orders[0][0]=Qnt;
     }
   }
 }
}

int index1=0;
double min= 10000000;
  for (int i=0;i<10;i++) {
      if (arr_Orders[i][8]< min){
      index1=i; min=arr_Orders[i][8]
      }
  }
return(min);

}
 
Please tell me how to implement a function to sort the string array alphabetically. e.g. string mass[]={"USDJPY", "EURUSD",..., "AUDUSD"} to type {"AUDUSD", "EURUSD",..., "USDJPY"}
 

I've run into this interesting problem:

I'm writing a trivial condition:

if( А < Б )
 {
  // Выполнить действия
 }

It would seem to be the easiest thing in the world... But! The following happens: A == B and yet the condition is considered correct and the actions are performed.

In particular, we modify the order by setting an SL. But the SL is already equal - there is no need to modify it, but still the program gives an order to modify the order (at the same price) every time.

Of course, I've reprinted everything. I tried to rewrite it both ways and add additional conditions (if they are not equal to "!=") but we still get the condition.

What is this phenomenon and what can it be connected with?

 
Chiripaha:

I've run into this interesting problem:

I'm writing a trivial condition:

It would seem to be the easiest thing in the world... But! The following happens: A == B and yet the condition is considered correct and the actions are performed.

In particular, we modify the order by putting an SL. But the SL is already equal - there is no need to modify it, but still the program gives an order to modify the order (at the same price) every time.

Of course, I've reprinted everything. I tried to rewrite it both ways and add additional conditions (if they are not equal to "!=") but we still get the condition.

What is this phenomenon and what can it be connected with?

Fractional numbers must be normalised before they can be compared.
 
SergMich:
Please tell me how to implement a function to sort the string array in alphabetical order. e.g. string mass[]={"USDJPY", "EURUSD",..., "AUDUSD"} to type {"AUDUSD", "EURUSD",..., "USDJPY"}.

Use the StringGetChar function to fetch the number of the first character, then sort by the second.
 

Thanks, of course, for the links, but this is a bit different. I already know the price of the fractal. How can I find the bar number to which this price corresponds on another timeframe?

 
by bar time
 
FAQ:
by bar time

Can I have a little code example?