Libraries: Expert - page 8

 
Stanislav Korotky:

I still don't understand, why is the constant name Expert.mqh.tpl more "practical" (practical?) than templates named after the programme that spawns them? Let's say there is a programme A.mq5 and B.mq5 that use bibla. If they generated templates with their own names it would be more practical, firstly, to have the last "fingerprint" of actions of _each_ programme, instead of overwriting one by the other. Secondly, you could immediately see who the generator is by name (especially useful if the programmes are foreign). Now you can't tell that from the Expert.mqh.tpl file until you get inside. The universal solution I have given is to take the name of the MQL-programme+timestamp+random. And I don't see the need to leave the file at sync=true. I think everything has been tested and debugged long ago. In case of errors and the need for debugging, there is an option sync=false. Then the file should be left. I think everything is logical. And the edits are simple.

I agree that in practice the collision may occur rarely, unless someone uses the biblio in parallel in several programmes. I don't have it, but I just had a quick look in the code, and my eye was caught by Expert.mqh.tpl in the Files folder. Everything is purely imho.

I didn't want to delete files, so I thought one common name was enough, taking into account the reliability of work in practice.

I didn't want to see a zoo of tpl-files in the Files folder. To delete something on purpose - similarly. I deleted only here.

Возможность вызова DLL в Маркет-продуктах.
Возможность вызова DLL в Маркет-продуктах.
  • 2019.07.20
  • www.mql5.com
Возможно написание EX5 с вызовом DLL, который пройдет все проверки Маркета и будет там опубликован.В прицепе такой EX5-скрипт. Он запускает указанные приложения/документы.В прицепе еще один вариант
 
Vitaly Muzichenko:

How is it possible to run an Expert Advisor in .ex4 format by connecting it in an Expert Advisor with a different name, and it is necessary to display input parameters, i.e. to be able to fully work with it.

We have a compiled Expert Advisor with the name "Trade.ex4".

Create a new Expert Advisor with the name "Hand.ex4".

How to combine them so that when "Hand.ex4" is launched, "Trade.ex4" will fully work and "Trade.ex4" will be embedded in "Hand.ex4".

That is, we have only Hand.ex4 file on the machine, but we use Trade.ex4 in work

Thank you!

Have you found a solution?

 
Vitaly Muzichenko:

How to combine it so that when "Hand.ex4" is launched, "Trade.ex4" will be fully functional, and "Trade.ex4" will be embedded in "Hand.ex4"

That is, we have only Hand.ex4 file on the machine, but we use Trade.ex4 in work

It should work with indicators. It seems that Expert Advisors are not stitched into other Expert Advisors.

 
fxsaber:

It should work with indicators. It seems that Expert Advisors are not stitched into other Expert Advisors.

Yes, the Expert Advisor could not be embedded, no solution was found

 
Thanks guys!
 
Vitaly Muzichenko:

Yes, the counsellor could not be sewn in, no solution found

There is most likely a solution, and it looks like I used it here once in one of the variants. But I've completely forgotten how I did it.

Возможность вызова DLL в Маркет-продуктах.
Возможность вызова DLL в Маркет-продуктах.
  • 2019.07.20
  • www.mql5.com
Возможно написание EX5 с вызовом DLL, который пройдет все проверки Маркета и будет там опубликован.В прицепе такой EX5-скрипт. Он запускает указанные приложения/документы.В прицепе еще один вариант
 
fxsaber:

There's probably a solution, and I seem to have used it here once in one of the variants. But I've absentmindedly forgotten how I did it.

Here I am when I tried it, I didn't find a single way. It was for 4, I haven't tried it on 5.

 

Forum on trading, automated trading systems and testing trading strategies

Peculiarities of mql5 language, subtleties and techniques of work

fxsaber, 2020.05.21 09:13

#include <fxsaber\Expert.mqh> // https://www.mql5.com/en/code/19003

// Unloads itself if there is no symbol after the account change.
void OnDeinit( const int Reason )
{
  if (Reason == REASON_ACCOUNT)
  {
    MqlTick Tick;
    
    if (!SymbolInfoInteger(_Symbol, SYMBOL_CUSTOM) && !SymbolInfoTick(_Symbol, Tick))
    {
      Alert("Account is changed!");
      
      if (EXPERT::Remove())
        Alert("Expert is removed!");
      
      // ExpertRemove(); // It won't help.
      // ChartClose(); // Not the best solution.
    }
// else
      // For custom and other cases, augment the code with the following solution.
      // https://www.mql5.com/ru/forum/170952/page175#comment_16365819 
  }  
}
 
fxsaber:
Cool library! I wouldn't have thought of implementing the Expert Advisor opening in such a way. Can you tell me how to define an active chart using mql without using dll. I've done some work on winapi, but it turned out to be too cumbersome:
long                          Agent::ChartGetActiveID()
  {
   static long                terminal_wnd = ChartGetInteger(0,CHART_IS_DOCKED) ?
                              GetAncestor(ChartGetInteger(0, CHART_WINDOW_HANDLE), 2) :
                              GetParent(GetAncestor(ChartGetInteger(0, CHART_WINDOW_HANDLE), 2));

   static uint                process_id = 0;
   static uint                thread_id = GetWindowThreadProcessId(terminal_wnd, process_id);
   static long                mdi_wnd = GetDlgItem(terminal_wnd, 0xE900);
   static GUITHREADINFO       thread_info;


   thread_info.cbSize = sizeof(GUITHREADINFO);
   if(!GetGUIThreadInfo(thread_id, thread_info))
      return -1;

   long wnd_on_focus = 0, chart_id = -1;
   if(GetDlgItem(thread_info.hwndActive, 0xE900)== mdi_wnd)
      wnd_on_focus = GetWindow(SendMessageW(mdi_wnd, 0x0229, 0, 0), 5);
   else
      wnd_on_focus = GetWindow(thread_info.hwndActive, 5);

   for(long ch_id = ChartFirst(); ch_id != -1; ch_id = ChartNext(ch_id))
      if(ChartGetInteger(ch_id, CHART_WINDOW_HANDLE)==wnd_on_focus)
        {
         chart_id = ch_id;
         break;
        }
   return chart_id;
  }

Maybe you know how to implement this case on mql or at least with dll, but simpler?

 
vek_y4icb:
how to define an active chart using mql tools without using dll.

I don't remember exactly. I think this problem was solved. Perhaps a search will help.