[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 408

 
Zhunko:

It's hard to say about the allocated one. You'd have to ask the Metakwots.

I immediately took Victor at his word, but... in order to dispel doubts I just wrote to the metaquotes.

Zhunko:

I had my real account blocked in MRC because of frequent chart opening and updating. This is not an MQL4 function, but an in-house chart viewer

What do you mean by "often opening a chart "? I understand what you mean about updating market environment variables, but I don't understand what about opening and updating a chart...

Zhunko:

Maybe, for example, MarketInfo() accesses the server or only receives part of data from market overview.

I wrote to support, I'll write back here as soon as they reply!
 
Andrew245:

I guessed that, but I can't find them, these stop loss parameters
https://docs.mql4.com/ru/trading/OrderSend
 

I once asked a question about the use of libraries. I did get a bit confused, though.

As I understand it, the library is a set of functions with code, which I don't remember exactly what it's called, "closed", i.e. it means that in the process the code of the library function is not affected by anything from the outside.

It is logical that when all of the frequently used and not only functions are moved out of the EA, it is very convenient. But why do we need the inludes then? After all, libraries work without them. So, inclusions are not needed? Who uses it?

 
pako:

Is 10% a year a good thing or a bad thing?

Well, they always say that the main thing is to keep the balance curve flat, and you can increase your profits with MM. Or is it not so?
 
Dmido:

Well, they always say that the main thing is to keep the balance curve flat, and to increase profits you can use MM. Or is it not so?


Try to increase

if the kolyan doesn't come.

 
TarasBY:
The current day begins at the beginning of the current D1 bar (iTime (NULL, PERIOD_D1, 0)), but you are not looking for easy ways?! :)))


does not work.

iTime (NULL, PERIOD_D1, 0) prints 137082240

and inserted in the function prints all available history of trades, but not trades for today.....

GetProfitFromDateInCurrency(NULL,-1,-1,(iTime (NULL, PERIOD_D1, 0))); 
видимо правильнее будет GetProfitFromDateInCurrency(NULL,-1,-1,(TimeCurrent()-iTime (NULL, PERIOD_D1, 0)));   НО И ТУТ РЕЗУЛЬТАТ ВСЕ СДЕЛКИ, ВМЕСТО СЕГОДНЯШНИХ
 
lottamer:


does not work.

iTime (NULL, PERIOD_D1, 0) prints 137082240

and inserted into the function prints all available transaction history, not today's transactions.....

If you use GetProfitFromDateInCurrency() (original - this is IMPORTANT: I do not know what you must have got there in your version), then the function must be called like this:
GetProfitFromDateInCurrency (Symbol(), -1, -1, iTime (NULL, PERIOD_D1, 0));

and the function will return profits on orders closed since the beginning of the current day.

And ALL of the nonsense in the code is caught via Print().

 
hoz:
What do you mean by "frequent opening of chart"? I understand about updating of market environment variables, but I don't understand about opening and updating of chart...
When you open and update a chart there are requests for new data on the server. Some greedy brokerage companies prefer not to spend their money on more powerful servers and wider channel, but to spread it among their pockets. They have to limit the number of requests from the terminal so a weak server doesn't get "hung up". MRC has only 2000 requests per day. This is 10 times less than the number of their instruments multiplied by the number of TFs, not counting trade requests.
hoz:

I once asked a question about the use of libraries. I did get a bit confused, though.

As I understand it, the library is a set of functions with code, which I don't remember exactly what it's called, "closed", i.e. it means that in the process the code of the library function is not affected by anything from the outside.

It is logical that when all of the frequently used and not only functions are moved out of the EA, it is very convenient. But why do we need the inludes then? After all, libraries work without them. So, inclusions are not needed? Who uses them?

The inclusions in MQL4 help to arrange the code. For example, this is how an indicator for 3000 lines looks like in my article:

#property indicator_separate_window

#include <stdlib.mqh>
#include <stderror.mqh>
#include <ServicesMT4.mqh>
#include <Spectrum.mqh>
#include <TimeFrames.mqh>
#include <GeneralFunctions.mqh>
#include <DynamicArray2.mqh>
#include <SPECTRUM_IND_Macros.mq4>
#include <SPECTRUM_IND_Preset_Buffers.mq4>
#include <SPECTRUM_IND_Extern_Variable.mq4>
#include <SPECTRUM_IND_Global_Variable.mq4>
#include <SPECTRUM_IND_Functions_Project.mq4>

void init()
 {
  int    i = 0;
  string i_sName = StringSubstr(WindowExpertName(), 0, StringLen(WindowExpertName()) - 8);
  g_nCounterStart = 0;
  #include <SPECTRUM_IND_Check_Param.mq4>
  if (Postfix == "") g_sNameIndicator = i_sName + g_sPostfix;
  else g_sNameIndicator = i_sName + g_sPostfix + Postfix + " ";
  g_sNameObject = g_sNameIndicator + "Derivative ";
  g_sNameLine = g_sNameIndicator + "Line ";
  g_sNameSpectrum = g_sNameIndicator;
  IndicatorShortName(g_sNameIndicator);
  #include <SPECTRUM_IND_Extern_Variables_In_Array.mq4>
  #include <SPECTRUM_IND_Buffers.mq4>
  ServiceRefreshChart(WindowHandle(Symbol(), 0), 1000);
 }

void deinit()
 {
  ObjectsDeleteAll(g_nWindow);
  DeleteObject();
 }

void start()
 {
  if (g_bStop) return;
  #include <SPECTRUM_IND_Start_Variable.mq4>
  #include <SPECTRUM_IND_Start_Initialize.mq4>
  #include <SPECTRUM_IND_Optimization.mq4>
  #include <SPECTRUM_IND_Calc_Filters.mq4>
  #include <SPECTRUM_IND_Calc_Last_Derivative.mq4>
  #include <SPECTRUM_IND_Show_Lines.mq4>
  #include <SPECTRUM_IND_Show_Sum.mq4>
  g_nBegin = s_nBegin;
  g_nTemp_SizeChart = s_nSizeChart;
  g_tLastTime = iTime(NULL, g_nPeriod, 0);
  ArrayCopy(g_adTemp_PriceBeginBar, s_adPriceBeginBar);
 }
The 5 lines of similar operations accumulate, or a separate algorithm, or some other criteria of the group and it can be allocated in a separate file. Still, it's better to look at code up to 200 lines rather than 10000 lines at once. You will get tired to tweak it. In MQL4, it is better to avoid function calls. Especially, in loops. If possible, it is better to expose the function. The code will work much faster. Inclusions are of great help here.

Unfortunately, the compiler does not allow using one inclusion more than once in one module. This is usually a way to save on repetitive code.

 
hoz:
I immediately took Victor at his word, but... to dispel any doubts I just wrote to the metaquotes.
...

Victor is absolutely and completely right. That request to the server, which comes when the chart opens, is not a request from the emulator function, but from a manual action of the user.

 
Integer:

Victor is absolutely and completely right. The request to the server, which comes when the chart opens, is not a request from an emcool function, but from a manual user action.

The request from the chart is similar to the request from RefreshRates(). I have no doubt that it is referring to the server. That said, RefreshRates() is not a trading function.

I'll have to ask the Metacvots.