Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 533

 

Hi all, is there a ready-made command to display the deal history on the screen?

similar to dragging a deal from the history to the chart



it would be possible to go through the history of trades and assign objects, but i think there is a ready way

 
Mickey Moose:

Hi all, is there a ready-made command to display the deal history on the screen?

similar to dragging a trade from the history to the chart

The same, but with the control key pressed. Ctrl or Shift - I do not remember - I am writing from a mobile phone.
 
Artyom Trishkin:
The same, but with the control key pressed. I can't remember if it's Ctrl or Shift - I'm writing from a mobile phone.



I want to put this piece into my non-trading robot to put it on a chart and see what's going on.

To put it on the chart and see how many craps have been produced per year for this symbol
 
Ihor Herasko:

There is no way to get this information through MQL. You need to access DateTimePricker controls, which is done via WinAPI.

Thanks, got it!

May be useful for someone:

#import "user32.dll"
   int      SendMessageA(int hWnd,int Msg,int wParam,int &lParam[]);
#import

#define  DTM_GETSYSTEMTIME 0x1001

int SystemTime[4];

.....

//+------------------------------------------------------------------+
//|          Функция преобразования в формат datetime                |
//+------------------------------------------------------------------+
datetime FormatDateTime(int &DT[]){
   string sMonth,sDay,sHour,sMin,sSec;
      int nYear,nMonth,nDay,nHour,nMin,nSec;   
      
   //---- parse date and time from array
         nYear=DT[0]&0x0000FFFF;
         nMonth=DT[0]>>16;
         nDay=DT[1]>>16;
         nHour=DT[2]&0x0000FFFF;
         nMin=DT[2]>>16;
         nSec=DT[3]&0x0000FFFF;
         
   //---- format date and time items
         sMonth=100+nMonth;
         sMonth=StringSubstr(sMonth,1);
         sDay=100+nDay;
         sDay=StringSubstr(sDay,1);
         sHour=100+nHour;
         sHour=StringSubstr(sHour,1);
         sMin=100+nMin;
         sMin=StringSubstr(sMin,1);
         sSec=100+nSec;
         sSec=StringSubstr(sSec,1);

   //----
         return(StrToTime(StringConcatenate(nYear,".",sMonth,".",sDay," ",sHour,":",sMin,":",sSec)));
  }
  
void OnInit(void){
  if (IsTesting()){
    SendMessageA(0x0000000000010288,DTM_GETSYSTEMTIME,0, SystemTime);
    Print("date From: ",TimeToString(FormatDateTime(SystemTime)));
    
    SendMessageA(0x000000000001028E,DTM_GETSYSTEMTIME,0, SystemTime);
    Print("date To: ",TimeToString(FormatDateTime(SystemTime)));
  }
  .....
}

void OnTick(void){
  .....
}
//+------------------------------------------------------------------+
 
mrumskiy:

Thanks, got it!

It may come in handy for someone:

Then a counter question: Why is it necessary to get the test interval date, where can it come in handy?

 
Artyom Trishkin:

If i is a multiple of two.

This is the remainder of i divided by 2

Thank you. How, in the indicator, to exclude from the calculations the candles from 19 to 11 o'clock?

 
PolarSeaman:

Thank you. How can the indicator exclude candles between 19 and 11 o'clock from its calculations?

Watching the time and skipping if not within the set limits is easy.

The logic is simple: you know the shop is closed for lunch between 2pm and 3pm. You look at your watch and you don't go to the shop if it's lunchtime. Then why are you getting confused here? What is the difference?

 
Hi, I would like to create a condition whereby
During the time period 0-8 step will be equal to 5 pips, during the rest of the day 10 pips. But if I have orders which were opened from the previous day, then in the time period 0-8 step will also be 10 pips.


 
Artyom Trishkin:

Watching the time and skipping if it is not within the set limits is easy.

The logic is simple: you know that between 14:00 and 15:00 the shop is closed for lunch. You look at your watch and you don't go to the shop if it's lunchtime. Then why are you getting confused here? What is the difference?

The point is that if you set the time interval as in the EA

if(Hour()>=17&&Hour()<=11)return(0);

I need to exclude from history, candlesticks that are in the interval, from the calculations.

 
Tigerfreerun:
Hello, I would like to create a condition whereby
During the time period 0-8 step will equal 5 pips, during the rest of the day 10 pips. But if there are orders opened from the previous day, then in the time period 0-8 step will also equal 10 pips.


This may be the case:

  if(Hour()>=0&&Hour()<=8&&OrdersTotal()==0)step = 5; else step =10;
Reason: