Errors, bugs, questions - page 1579

 
Dennis Kirichenko:

Look at the PrintFormat() function. In your case, it is better to use it.

Then it goes like this:

Parsimony rules :-)

Tried the code, got zeros

2016.05.12 00:41:43.336 Info_SymbolList AUDJPY,M15: symbolName=AUDJPY, ATR_D_1001=0.0000

 
Dennis Kirichenko:

Try writing only string variables to the file.

It's like this:

all variables are written normally, exceptATR_D_1000 , this is not clear...
 
-Aleks-:
all variables are written normally, exceptATR_D_1000 , it's not clear...

G try it like this

FileWrite(handle,symbolName);
FileWrite(handle,MarketInfo(symbolName,MODE_SPREAD));
FileWrite(handle,MarketInfo(symbolName,MODE_MINLOT));
FileWrite(handle,MarketInfo(symbolName,MODE_MARGINREQUIRED)*MarketInfo(symbolName,MODE_MINLOT));
FileWrite(handle,MarketInfo(symbolName,MODE_TICKVALUE)*MarketInfo(symbolName,MODE_MINLOT)*100);
FileWrite(handle,MarketInfo(symbolName,MODE_STOPLEVEL));
FileWrite(handle,str2);
FileWrite(handle,ATR_D_1000);
FileWrite(handle,ATR_M15_9600)
FileWrite(handle,iBars(symbolName,1440));
FileWrite(handle,iBars(symbolName,15));
 
Sergey Gritsay:

G Try this

Thanks, I'll give it a try. But, if theATR_D_1000 variable is not printed, how can we expect it to be written?
 
-Aleks-:
Thanks, I'll give it a try. But, if variableATR_D_1000 is not printed, how can we expect it to be written?
D It will print. Most likely the problem is in the history paging, because 1000 day bars is quite huge, the indicator takes a long time to calculate on first run, then everything is normal
0       18:17:32.387    Script test_1 USDCHF,H1: loaded successfully
0       18:17:35.135    test_1 USDCHF,H1 inputs: Start=1463014800; End=1463025600; 
0       18:17:40.219    test_1 USDCHF,H1: initialized
0       18:17:55.643    test_1 USDCHF,H1: ATR_D_1000=0.0
0       18:17:55.643    test_1 USDCHF,H1:  symbolName=USDCHF ATR_D_1001=0.0
0       18:17:55.643    test_1 USDCHF,H1: uninit reason 0
0       18:17:55.644    Script test_1 USDCHF,H1: removed
0       18:20:26.749    Script test_1 USDCHF,H1: loaded successfully
0       18:20:33.592    test_1 USDCHF,H1: initialized
0       18:20:33.593    test_1 USDCHF,H1: ATR_D_1000=0.008878300000000023
0       18:20:33.593    test_1 USDCHF,H1:  symbolName=USDCHF ATR_D_1001=0.008878300000000023
0       18:20:33.593    test_1 USDCHF,H1: uninit reason 0
0       18:20:33.594    Script test_1 USDCHF,H1: removed
0       18:21:48.047    Script test_1 USDCHF,Daily: loaded successfully
0       18:21:53.155    test_1 USDCHF,Daily: initialized
0       18:21:53.155    test_1 USDCHF,Daily: ATR_D_1000=0.008468200000000019
0       18:21:53.155    test_1 USDCHF,Daily:  symbolName=USDCHF ATR_D_1001=0.008468200000000019
0       18:21:53.156    test_1 USDCHF,Daily: uninit reason 0
0       18:21:53.157    Script test_1 USDCHF,Daily: removed
0       18:22:13.167    Script test_1 USDCHF,H4: loaded successfully
0       18:22:19.313    test_1 USDCHF,H4: initialized
0       18:22:19.313    test_1 USDCHF,H4: ATR_D_1000=0.008468200000000019
0       18:22:19.313    test_1 USDCHF,H4:  symbolName=USDCHF ATR_D_1001=0.008468200000000019
0       18:22:19.313    test_1 USDCHF,H4: uninit reason 0
0       18:22:19.314    Script test_1 USDCHF,H4: removed
0       18:22:26.488    Script test_1 USDCHF,H1: loaded successfully
0       18:22:32.343    test_1 USDCHF,H1: initialized
0       18:22:32.344    test_1 USDCHF,H1: ATR_D_1000=0.008468200000000019
0       18:22:32.344    test_1 USDCHF,H1:  symbolName=USDCHF ATR_D_1001=0.008468200000000019
0       18:22:32.344    test_1 USDCHF,H1: uninit reason 0
0       18:22:32.345    Script test_1 USDCHF,H1: removed
 
Sergey Gritsay:
D Everything prints out. Most likely the problem is in the history loading, because 1000 day bars is quite huge, the indicator takes a long time to calculate on the first run, then everything is normal.
What is the code, can you attach the script? I can't get it to move, thanks.
 
-Aleks-:
What's the code, can you attach a script? I can't get it to move, thank you.
It's the same as yours.
//+------------------------------------------------------------------+
//|                                                       test_1.mq4 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {

   double ATR_D_1000=0;

   string symbolName=_Symbol;

   ATR_D_1000=iATR(symbolName,1440,1000,1);

   Print("ATR_D_1000=",ATR_D_1000);

   Print(" symbolName=",symbolName," ATR_D_1001=",iATR(symbolName,1440,1000,1));
  }
//+------------------------------------------------------------------+
 

EX5 loading failed (on execution)

typedef void (*fn)();
fn GP( fn f ) { return f; }
void OnStart2() { Print( __FUNCSIG__ ); }
void OnStart()
{
        Print( GP( OnStart2 ));
}

otherwise - fine

void OnStart()
{
        Print( GP( OnStart ));
}
 
if the order ticket function returns a value of type int, what happens when we hit a ceiling, for example, now we have 9-digit ticket numbers, is there a 10-digit ceiling? or will the broker reset the order counter?
 
Sergey Gritsay:
same as yours.
Thanks - found a mistake in the code.