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

 
Анатолий Железняк #:

Then the question is: Who is this person ? Is he a friend of yours? Introduce him.

I told you: at user level!!!

It was at user level.

expiration is the time of expiration of a pending order.

But it doesn't suit you.

To take one order "out of EA's care" is impossible, because the care goes to the magician, and you can't change it.

We have to rewrite the EA with a different order control

 
MakarFX #:

This was at user level

expiration time of the pending order.

But this does not work for you.

You can't take one order "out of EA's control", because the control is based on a wizard, and you can't change it.

We have to rewrite the EA with another order control.

Live long.

 
MakarFX #:

This was at user level

expiration time of the pending order.

But this does not work for you.

You can't take one order "out of EA's control", because the control is based on a wizard, and you can't change it.

You have to rewrite the EA with a different order control ...

Makar don't tear yourself up

 
Анатолий Железняк #:

Oh, my God! I asked for a user level and you ask me to go through the whole EA and ask in a mentoring tone, "What's yours?" I don't want to get into it. I like playing games, not figuring out the insides of toys.

If Magik isn't 0, close the position and re-enter.

 
MakarFX #:

This was at user level

expiration time of the pending order.

But this does not work for you.

You can't take one order "out of EA's control", because the control is based on a wizard, and you can't change it.

We have to rewrite the EA with a different order control

You can leave the custody even with the same wizard, the question is what kind of order you need if you want it, then you cannot do it if it is specific to your list.

 
for (int i=0;i<OrdersTotal()-2;i++) последних 2 видеть не будет даже с тем же магиком только что ему нужно до путя так и не понятно 
 
Aleksandr Egorov #:
He needs it as a user, without fixing the code
 
Is there a way to set a hotkey to make the"input box" object active so that text can be typed there? For example, the lot size for a future trade.
 
MakarFX #:
He needs it as a user, without fixing the code

then it's not good at all ))

 

Hello. Can you give me a hint? MT5

I am making: an indicator that takes screenshots on a timer and puts them in folders (symbol period).

The intended algorithm: a screenshot is made at initialization. Since file operations take time, the timer moves the screenshot made first and makes a new one.

The screenshot made during initialization is successfully moved by timer.

Problem:
1 The first screenshot taken by timer in the folder is not displayed immediately. It is displayed ONLY when terminal is closed or indicator is restarted.
2 screenshots except first one are not moved, error 5019 (file does not exist), although they are displayed in folder (except first one made by timer).


#property strict
#property indicator_chart_window
#property indicator_plots 0

enum ENUM_FULL_MANUAL { full, //весь график
            manual, //указанный
            };
input int timer=5; //время на шаг в секундах
input ENUM_FULL_MANUAL skr_mode=full; //размер скриншота   
input int width = 640; // ширина 
input int height = 320;// высота 
input string format = ".png";

ENUM_ALIGN_MODE align_mode=ALIGN_RIGHT; // тип выравнивания

string name_folder, name_file;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
Print("OnInit()");

ScreenShot();
         
name_folder=Symbol()+"  "+StringPeriod();
FolderCreate(name_folder);


EventSetTimer(timer);


return(INIT_SUCCEEDED);
}
//===================================================================
void OnDeinit(const int reason)
{
EventKillTimer();
Move() ; 
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
             const int prev_calculated,
             const datetime &time[],
             const double &open[],
             const double &high[],
             const double &low[],
             const double &close[],
             const long &tick_volume[],
             const long &volume[],
             const int &spread[])
{
//---

//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
{
   Print("OnTimer() ");
   Move() ; 
   ScreenShot();
}//+------------------------------------------------------------------+
bool Move(){
   string src_path; 
   string dst_path; 
   StringConcatenate(src_path,"","//",name_file); 
   StringConcatenate(dst_path,name_folder,"//",name_file); 
   ResetLastError();
   if(FileMove(src_path,0,dst_path,0)){
      Print("FileMove OK ");
      return true;
   }   
   else{
      string err_text="FileMove ERR: "+(string)GetLastError();
      if(GetLastError()==5019) err_text+=("  5019 name_file "+name_file);
      Print(err_text);
   }  
   return false;
}

bool ScreenShot(){   
   name_file=TimeToString(TimeLocal(), TIME_DATE|TIME_SECONDS)+format;
   StringReplace(name_file, ":", "-");
   if(skr_mode==full){
      if(ChartScreenShot(0, name_file, (int)ChartGetInteger(0, CHART_WIDTH_IN_PIXELS, 0)
      , (int)ChartGetInteger(0, CHART_HEIGHT_IN_PIXELS, 0), ALIGN_RIGHT)){
         Print("screen name_file ", name_file);
         return true;
      }
      else{
         Print("screen ERR: ", GetLastError());
      }   
   }   
   if(skr_mode==manual){
      if(ChartScreenShot(0, name_file, width, height, align_mode)){
         return true;
      }
   }      
   return false;  
}
string StringPeriod(){
   if(Period()==1) return "M1";
   if(Period()==2) return "M2";
   if(Period()==3) return "M3";
   if(Period()==4) return "M4";
   if(Period()==5) return "M5";
   if(Period()==6) return "M6";
   if(Period()==10) return "M10";
   if(Period()==12) return "M12";
   if(Period()==15) return "M15";
   if(Period()==20) return "M20";
   if(Period()==30) return "M30";
   if(Period()==16385) return "H1";
   if(Period()==16386) return "H2";
   if(Period()==16387) return "H3";
   if(Period()==16388) return "H4";
   if(Period()==16390) return "H6";
   if(Period()==16392) return "H8";
   if(Period()==16396) return "H12";
   if(Period()==16408) return "Daily";
   if(Period()==32769) return "Weekly";
   if(Period()==49153) return "Monthly";
   return "ERROR";
}