[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 59

 
xrust писал(а) >>
You can, change the name of the detailed report to normal report and you will be happy

Can you tell me, if it's not difficult, where exactly this name can be changed? The user help doesn't say anything about it at all.

 
Uh... you're baffling me.... You've never renamed a file?
 
Dear experts, please don't ignore my question.

Is there an indicator that counts volatility, for example daily. But not the one, that gives an undefined number like 0.34. But it should calculate the number of candlesticks per day and divide it by a given period (number of days) so that the indicator knows the average value. Example: Opening 100, closing 200; the second day - opening 200, closing 250. Average volatility for these 2 days = ((200-100)+(250-200))/2 days=(100+50)/2=75
Where to download if available.
 
xrust писал(а) >>
Uh... you're stumping me here.... >> have you never renamed a file?

The terminal is supposed to automatically generate a report every 20 minutes and send it to the ftp server. This function saves a regular report by default. This function of the terminal by default saves a regular report, while I would like an itemized report with additional information and a graph. You can manually save the detailed report without any problems and select the history period you want.

And first you have me stumped - what and where should I manually rename to organize the automatic function? It's not clear at all.

 

Repeating a post from https://forum.mql4.com/ru/10422, perhaps my own question would be more appropriate here.


Here is some code from example.ini:

[common]
numCross=3

[cross1]
name=EURUSD

[cross2]
name=GBPUSD

[cross3]
name=USDJPY


reads number of pairs and then saves names of pairs in array of string one by one:

#include <IniFiles.mqh>

extern string config_path = "C:\Program Files\MetaTrader - MetaQuotes\experts\example.ini";

string CrossName[];
int numCross=0;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
string sectionName = "common";

numCross = ReadIniInteger(config_path, sectionName, "numCross", 0);
ArrayResize(CrossName, numCross);

for (int i=0; i<numCross; i++)
{
sectionName = StringConcatenate("cross", i+1);
CrossName[i] = ReadIniString(config_path, sectionName, "name", "-");
Print("init.1: CrossName[", (i+1), "]=", CrossName[i]);
}
Print("init.1: read complete");

for (i=0; i<numCross; i++)
{
Print("init.2: CrossName[", (i+1), "]=", CrossName[i]);
}


Print("-------------------------------");
for (i=0; i<numCross; i++)
{
sectionName = StringConcatenate("cross", i+1);
CrossName[i] = StringSubstr(ReadIniString(config_path, sectionName, "name", "-"), 0, 0);
Print("init.3: CrossName[", (i+1), "]=", CrossName[i]);
}
Print("init.3: read complete");

for (i=0; i<numCross; i++)
{
Print("init.4: CrossName[", (i+1), "]=", CrossName[i]);
}

return(0);
}


It seems to be simple and after reading ini we should get an array of pair names.

But as a result, after reading another parameter from ini and assigning a value to another element of the array,

all other previously assigned elements get the same value.

2009.04.09 02:17:06 example GBPUSD,H4: init.4: CrossName[3]=USDJPY
2009.04.09 02:17:06 example GBPUSD,H4: init.4: CrossName[2]=GBPUSD
2009.04.09 02:17:06 example GBPUSD,H4: init.4: CrossName[1]=EURUSD
2009.04.09 02:17:06 example GBPUSD,H4: init.3: read complete
2009.04.09 02:17:06 example GBPUSD,H4: init.3: CrossName[3]=USDJPY
2009.04.09 02:17:06 example GBPUSD,H4: init.3: CrossName[2]=GBPUSD
2009.04.09 02:17:06 example GBPUSD,H4: init.3: CrossName[1]=EURUSD
2009.04.09 02:17:06 example GBPUSD,H4: -------------------------------
2009.04.09 02:17:06 example GBPUSD,H4: init.2: CrossName[3]=USDJPY
2009.04.09 02:17:06 example GBPUSD,H4: init.2: CrossName[2]=USDJPY
2009.04.09 02:17:06 example GBPUSD,H4: init.2: CrossName[1]=USDJPY

2009.04.09 02:17:06 example GBPUSD,H4: init.1: read complete
2009.04.09 02:17:06 example GBPUSD,H4: init.1: CrossName[3]=USDJPY
2009.04.09 02:17:06 example GBPUSD,H4: init.1: CrossName[2]=GBPUSD
2009.04.09 02:17:06 example GBPUSD,H4: init.1: CrossName[1]=EURUSD

It turns out that when assigning a string array to a variable, it's actually the assignment of

reference, not value. I searched through all the available documentation plus the forum but didn't find any answer why it's so.

I found the way out by using StringSubstr, but something tells me it's not quite right.


Question to those who know: how to correctly assign values of other variables to elements of string array ?

 
Yug >> :

Repeating a post from https://forum.mql4.com/ru/10422, perhaps my own question would be more appropriate here.


I remembered! Peculiarity of string implementation. After the array is resized, it should be passed through and zeroed:

ArrayResize( CrossName, numCross);

for (int i=0; i< numCross; i++)
{
   CrossName[ i] = "";
}
I could be wrong, but it should help.
 
XinoXano писал(а) >>

The terminal is supposed to automatically generate a report every 20 minutes and send it to the ftp server. This function saves a regular report by default. This function of the terminal by default saves a regular report, while I would like an itemized report with additional information and a graph. You can manually save the detailed report without any problems and select the history period you want.

And first you have me stumped - what and where should I manually rename to organize the automatic function? It's not clear at all.

Report templates statement.htm, and detailed report StatementDetailed.htm are located in the folder terminal\templates\. By default, the terminal sends plain statement.htm report, you need StatementDetailed.htm, I suggested you in Russian rename the file StatementDetailed.htm in windows environment to statement.htm. Or write also instruction on renaming ?

 

Dear experts,

please help me with LOKing transactions

More details and code here: Help me deal with LOKing of Positions'.

Always respectfully,

 
xrust писал(а) >>

Report templates statement.htm, and detailed report StatementDetailed.htm are located in terminal\templates\ folder. By default, the terminal sends a regular report statement.htm, but you need detailed statementDetailed.htm, I suggested you in Russian to rename in windows file StatementDetailed.htm to statement.htm. Or write instructions for renaming as well?

No rename myself I will be able, but to replace one template to another, it did not occur to me ...

Thank you very much! Now everything is clear and everything works!!!!

 
Everlost >> :

Very simple - when the signal Cls_S or Cls_B comes, we forget about the position opened last (reset the value of the Last_Position variable back to -1).

if ((Cls_S==true || Cls_B==true) && Last_Position>=0) Last_Position=-1;

I see it in theory. But now the Expert Advisor has completely stopped making trades(

I have it like this:

//Учет ордеров истории
int ORDtime=0;
double ORDprofit=0.01;
int ORDtype=-1;
for (int j=OrdersHistoryTotal()-1; j>=0; j--) 
{
  if (OrderSelect( j, SELECT_BY_POS, MODE_HISTORY)) 
  {
    if (OrderSymbol()==Symbol()) 
    {
      if (OrderCloseTime()!=0 && OrderCloseTime()> ORDtime) 
      {
        ORDtime=OrderCloseTime();
        ORDtype=OrderType();
        ORDprofit=OrderProfit();
      }
    }
  }
}
...
//Торговые критерии на открытие и экстренное закрытие ордеров
if (( ORDtype==-1)&&(...))
   {
    Opn_B=true;
   }
if (( ORDtype==-1)&&(...))    
   {
    Cls_B=true;
   }
if (...)
   {
    Opn_S=true;
   }
if (...)    
   {
   Cls_S=true;
   }
// Дополнительные условия к открытию
if (( Cls_B==true|| Cls_S==true)&&( ORDtype>=0)) ORDtype=-1;       //ДОПИСАТЬ УСЛОВИЕ ИСТОРИЧЕСКИХ ОРДЕРОВ


is there some kind of mistake?
Reason: