history data problem?

Back to topics list To post a new topic, please log in or register
avatar
33
ztmalick 2013.08.28 22:57
 

I have tried to print from a EA and only get duplicate timestamps and the last 19 minutes of a day. Why is this? I have attached the code and the settings I use in the ST as well as part of the output.

Also I have exported data from the history center which looks good and is second accurate and then imported it in again and still have the same problem - why wont the code print for every data entry? My understanding is that the start function is run for every tick or unit.

Many thanks in advance,

Zeshan

//+------------------------------------------------------------------+
//|                                                           MA.mq4 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
Print("test");
//----
   return(0);
  }
//+------------------------------------------------------------------+

 
avatar
33
ztmalick 2013.08.28 23:05 #
 
it also skips as well
avatar
14167
RaptorUK 2013.08.28 23:06 #
 
zmalick:
it also skips as well
Yes . . . did you look at the log file instead ?

avatar
14167
RaptorUK 2013.08.28 23:09 #
 
zmalick:

I have tried to print from a EA and only get duplicate timestamps

How many ticks do you expect to have in a M1 bar ? you get a print for each tick . . 20 ticks == 20 prints, 2000 ticks == 2000 prints

avatar
33
avatar
33
avatar
14167
RaptorUK 2013.08.29 00:05 #
 
zmalick:
I expect one data point per minute thats whats in the data file so for a 24hr test its 24x60 = 1440 outputs.

If thats what you want you need to make your code do that, start() runs for each tick, you get a Print for each tick not one per M1 bar . . .

Right click on the content of the Journal tab, then click open, it will find your log file . . . open the log file and you will see ALL the output from the Print() calls.

 
avatar
33
ztmalick 2013.08.29 00:46 #
 
RaptorUK:

If thats what you want you need to make your code do that, start() runs for each tick, you get a Print for each tick not one per M1 bar . . .

Right click on the content of the Journal tab, then click open, it will find your log file . . . open the log file and you will see ALL the output from the Print() calls.

Dear Raptor,

I followed your instructions and it seems the data is fine in the log file. Thanks for your help. :)

 
avatar
14167
RaptorUK 2013.08.29 00:50 #
 
zmalick:

Dear Raptor,

I followed your instructions and it seems the data is fine in the log file. Thanks for your help. :)

when you have a lot of Print() statements in a short period of time the journal/experts tab can't keep up and some will be missing, they will always be in the relevant log though.

 
avatar
1
bit4life 2015.05.07 00:07 #
 
RaptorUK:
when you have a lot of Print() statements in a short period of time the journal/experts tab can't keep up and some will be missing, they will always be in the relevant log though.

Hallo RaptorUK,

we already had interactions on this thread, but I completely forgot the credentials. Sorry for bringing up this topic from the past again, but I am sorry, and I think that your statement does not hold in any case and perhaps not with the last builds. Here is the scenario.

I'm running build 765 disconnected from the web just for testing purposes. Strategy tester. Tested on both 32- and 64-bits systems (Windows 8 and 7 respectively). In \portable and standard mode. I have two copies of the client with hard-installed historical M1 series UTC normalized... so a quite "standard" install. 

Now, in the strategy tester I have a huge code, but I will try to extract the relevant parts.

In my EA in the very beginning of the OnTick function I have:

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   Analyze();
   double currATR = iATR(Symbol(), 0, ATRperiod, 1);
   double distATR = currATR * ATRmult;
//... and much more from here on...


Now, the "Analyze()" function is contained in an include (of course #included in the EA), which makes something like:

void Analyze()
        {
         if(isInitialize == true) OnInitialize();
         ScanOrders();
//...and of course much more

 What I am saying is that, at every incoming tick, OnTick calls Analyze(), and Analyze() calls ScanOrders(). 

Within scan orders I have this statements:

  
void ScanOrders()
   {
    if(verbose > 3) 
       {
        Print("----------- Entering the OrdersScan() function ---------------");
        Print("Current bid/ask: ", NormalizeDouble(Bid, Digits), "/", NormalizeDouble(Ask, Digits));
        Print("At this stage dimension of ordersObj_Old is ", ArrayRange(ordersObj_Old, 0) - 1, 
              " and of ordersObj_New ", ArrayRange(ordersObj_New, 0) - 1);
        Print("Open orders are ", OrdersTotal());
       }

//... much many more things ... but the function then returns with these concluding lines:

if(verbose > 3)
                {
                 if(ArraySize(newTrades) > 0){Print("newTrades now contains tickets: "); IntDumpPrint(newTrades);}
                 if(ArraySize(newPending) > 0) {Print("newPending now contains tickets: "); IntDumpPrint(newPending);}
                 if(ArraySize(pendingTriggered) > 0) {Print("pendingTriggered now contains tickets: "); IntDumpPrint(pendingTriggered);}
                 if(ArraySize(closedTrades) > 0) {Print("closedTrades now contains tickets: "); IntDumpPrint(closedTrades);}
                 if(ArraySize(pendingCancelled) > 0) {Print("pendingCancelled now contains tickets: "); IntDumpPrint(pendingCancelled);}
                 Print("------------ Exiting from scanOrders() ----------------------");
                }
        
    return;
   }

 

I am running the EA on the tester with verbose level 3 for debugging purposes, and what I see in the tester log file (not in the tab, of course) is something that I cannot really believe. Here is an extract (partially parsed, for removing a bit of useless information like EA name and the like):

03.29 08:52   ----------- Entering the OrdersScan() function ---------------
03.29 08:52   Current bid/ask: 1.3334/1.3336
03.29 08:52   At this stage dimension of ordersObj_Old is 1 and of ordersObj_New 1
03.29 08:52   Open orders are 1
03.29 08:52   After resizing ordersObj_Old contains now 1  elements, and ordersObj_New 1
03.29 08:52   Dumping out the two order counters and the two orderObjects after updating:
03.29 08:52   ordersCnt_New[0 - 5]0; 1; 0; 0; 0; 0
03.29 08:52   ordersCnt_Old[0 - 5]0; 1; 0; 0; 0; 0
03.29 08:52   ordersObj_New[1]: 1; 1; 1.33432; 1.33432; 0.00000; 0.10000
03.29 08:52   ordersObj_Old[1]: 1; 1; 1.33432; 1.33432; 0.000000.10000
03.29 08:52   ------------ Exiting from scanOrders() ----------------------
03.29 08:52   Current bid/ask: 1.33345/1.33365
03.29 08:52   Current bid/ask: 1.33344/1.33364
03.29 08:52   Current bid/ask: 1.33347/1.33367
03.29 08:52   Current bid/ask: 1.3335/1.3337
03.29 08:52   Current bid/ask: 1.33348/1.33368
03.29 08:53   ----------- Entering the OrdersScan() function ---------------
03.29 08:53   Current bid/ask: 1.3335/1.3337

 So: now. How can we explain that, after a correct chunk where you see in the log file the correct sequence "Entering the OrderScan" section [that's of course the wrong name, but this is irrelevant] , several useful dumps, and the "Exiting from scanOrders()", you have that bulk dirty sequence of "Current bid/ask" statements without anything else? They are executed just within the same if{} block enclosing the other Print statements! I have serious problems in following the sequence of events here. And I have then the section where my bug lives, in which I cannot really trust the order of the printed out information...

 As said, this is very reproducible: two machines, and the like.

 

Thanks a lot for your (and others') help in advance. 

 

Back to topics list  

To add comments, please log in or register