Errors, bugs, questions - page 1010

 
tol64:

I thought the answer to this question was yes. You select the ticket from the trade history, and you try to get the property from the order history. They are different lists.

P.S. And there is an article with examples: MQL5 Recipes - Trade History and Library of Functions for Getting Position Properties

I thought orders were divided into 2 parts and there are 3. Thank you, you are explaining it better)
 

Good day!

Please tell me the way to get the bar number on the chart with datetime.

Thank you!

I don't want to search for bars and compare times :)

 
ns_k:

Good day!

Please tell me the way to get the bar number on the chart with datetime.

Thank you!

I don't want to search for bars and compare times :)

//iBarShift
int iBarShiftMQL4(string _symbol,int tf,datetime time,bool exact=false){
   if(time<0) return(-1);
   ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
   datetime Arr[],time1;
   CopyTime(Symbol(),timeframe,0,1,Arr);
   time1=Arr[0];
   if(CopyTime(_symbol,timeframe,time,time1,Arr)>0)
     {
      if(ArraySize(Arr)>2) return(ArraySize(Arr)-1);
      if(time<time1) return(1);
      else return(0);
     }
   else return(-1);
  } 
//тф
ENUM_TIMEFRAMES TFMigrate(int tf){
   switch(tf)
     {
      case 0: return(PERIOD_CURRENT);
      case 1: return(PERIOD_M1);
      case 5: return(PERIOD_M5);
      case 15: return(PERIOD_M15);
      case 30: return(PERIOD_M30);
      case 60: return(PERIOD_H1);
      case 240: return(PERIOD_H4);
      case 1440: return(PERIOD_D1);
      case 10080: return(PERIOD_W1);
      case 43200: return(PERIOD_MN1);
      
      case 2: return(PERIOD_M2);
      case 3: return(PERIOD_M3);
      case 4: return(PERIOD_M4);      
      case 6: return(PERIOD_M6);
      case 10: return(PERIOD_M10);
      case 12: return(PERIOD_M12);
      case 20: return(PERIOD_M20);
      case 16385: return(PERIOD_H1);
      case 16386: return(PERIOD_H2);
      case 16387: return(PERIOD_H3);
      case 16388: return(PERIOD_H4);
      case 16390: return(PERIOD_H6);
      case 16392: return(PERIOD_H8);
      case 16396: return(PERIOD_H12);
      case 16408: return(PERIOD_D1);
      case 32769: return(PERIOD_W1);
      case 49153: return(PERIOD_MN1);      
      default: return(PERIOD_CURRENT);
     }} 
 
ns_k:

Good day!

Please tell me the way to get the bar number on the chart with datetime.

Thank you!

I don't want to search for bars and compare times :)

Using the Bars() function.
 
ns_k:

Good day!

Please tell me the way to get the bar number on the chart with datetime.

Thank you!

I don't want to search for bars and compare times :)

You can use Bars(), second type of call.
Документация по MQL5: Доступ к таймсериям и индикаторам / Bars
Документация по MQL5: Доступ к таймсериям и индикаторам / Bars
  • www.mql5.com
Доступ к таймсериям и индикаторам / Bars - Документация по MQL5
 
Lizar:
You can use Bars(), the second type of call.
Thank you all very much!!!
 
ns_k:

Good day!

Can you please tell me the way to get the bar number on the chart with datetime.

Thank you!

I don't want to search for bars and compare times :)

ArraySetAsSeries

Invert the array, you will get the bar number.

 
Silent:

flip the array over, there will be a bar number.

I don't get it. The method suggested above helped me out. I don't understand this one. What is the point?
 
ns_k:
I don't understand something. The method suggested above helped me out. But I can't get into this one. What is the point?
The last element will be number 0.
 
ns_k:
I don't understand it. The above method helped me out. I still don't "get" this one. What is the point?

datetime is already there

ArraySize - number of bars, ArraySize-1 - last bar, ArraySetAsSeries sets direction of indexing, and cell number = bar, left or right.

There verification script molded.