New Biggest Problem

 
//+------------------------------------------------------------------+
//| nnnn.mq4 |
//| Copyright © 2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
//---------------------------------------------------------------------------------------------------
double HighestPositionState;
double LowestPositionState;
double PreviousPositionExState;
double PreviousPositionState;
double CurrentPositionState;

int OpenedPositionValue;
int OpenedPositionChange;
int OpenedPosition[];
//string-text;
//double-destinne int-cele

double init()
{
PreviousPositionExState = 0;
PreviousPositionState = 0;
CurrentPositionState = 0;
CheckPositions();
SetTypeOfTrading();
return(0);
}

int deinit()
{
return(0);
}

double start()
{
CheckPositions();
SetTypeOfTrading();
return(0);
}

double CheckPositions()
{
HighestPositionCheck();
LowestPositionCheck();
PreviousPositionExCheck();
PreviousPositionCheck();
CurrentPositionCheck();
return(0);
}
//-------------------------------------------------------------------//
double HighestPositionCheck()
{
if(Bid > PreviousPositionExState && Bid > PreviousPositionState)
{
if(Bid > CurrentPositionState)
{
HighestPositionState = Bid;
}}
return(0);
}

double LowestPositionCheck()
{
if(Bid < PreviousPositionExState && Bid < PreviousPositionState)
{
if(Bid < CurrentPositionState)
{
LowestPositionState = Bid;
}}
return(0);
}
//-------------------------------------------------------------------//
double PreviousPositionExCheck()
{
if(PreviousPositionExState != 0)
{
return(0);
}
if(PreviousPositionExState == 0)
{
PreviousPositionExState = Bid;
}
return(0);
}

double PreviousPositionCheck()
{
if(PreviousPositionState != 0)
{
return(0);
}
if(PreviousPositionState == 0)
{
PreviousPositionState = Bid;
}
return(0);
}

double CurrentPositionCheck()
{
if(CurrentPositionState != 0)
{
return(0);
}
if(CurrentPositionState == 0)
{
CurrentPositionState = Bid;
}
return(0);
}
//------------------------------------//
double CalculateTrading()
{
return(0);
}

double SetTypeOfTrading()
{
if((OrderProfit()) < 10)
{
if(HighestPositionState > PreviousPositionExState && PreviousPositionExState > PreviousPositionState && PreviousPositionState > CurrentPositionState && OpenedPositionValue < 11)
{
OpenedPositionArchiver();
// OrderSend(Symbol(OpenedPositionValue),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"Text",0,0,CLR_NONE);
OpenedPosition[OpenedPositionValue] = OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"30 dni",1,0,Green);
}
if(LowestPositionState < CurrentPositionState && CurrentPositionState < PreviousPositionState && PreviousPositionState < PreviousPositionExState && OpenedPositionValue < 11)
{
OpenedPositionArchiver();
// OpenedPosition[OpenedPositionValue] = OrderSend(Symbol(),OP_SELL,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);
OpenedPosition[OpenedPositionValue] = OrderSend(Symbol(),OP_SELL,1,Ask,3,Ask-25*Point,Ask+25*Point,"30 dni",1,0,Green);

}}
return(0);
}










int OpenedPositionArchiver()
{
if(OpenedPositionValue == 0 && OpenedPositionChange == 1)
{
OpenedPositionValue = 1;
}
if(OpenedPositionValue >= 0 && OpenedPositionChange == 1)
{
OpenedPositionValue = OpenedPositionValue + 1;
}
if(OpenedPositionValue == 0 && OpenedPositionChange == 2)
{
return(0);
}
if(OpenedPositionValue >= 1 && OpenedPositionChange == 2)
{
OpenedPositionValue = OpenedPositionValue - 1;
}
return(0);
}

//==============================================================================














problem: 23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (high value 1.6554 at 2009.03.04 01:30 is not reached from the least timeframe, high price 1.6554 mismatches)
23:26:22 TestGenerator: unmatched data error (low value 1.6518 at 2009.03.04 02:08 and price 1.6516 mismatched)
23:26:22 TestGenerator: unmatched data error (volume limit 1235 at 2009.03.04 02:00 exceeded)
23:26:22 nnnn started for testing

 
bilbop wrote >>

//==============================================================================

problem: 23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)

23:26:22 TestGenerator: unmatched data error (high value 1.6554 at 2009.03.04 01:30 is not reached from the least timeframe, high price 1.6554 mismatches)
23:26:22 TestGenerator: unmatched data error (low value 1.6518 at 2009.03.04 02:08 and price 1.6516 mismatched)
23:26:22 TestGenerator: unmatched data error (volume limit 1235 at 2009.03.04 02:00 exceeded)
23:26:22 nnnn started for testing

short of trying to undersand these errors, just ignore them and continue to test your EA

 
bilbop wrote >>

problem: 23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
...
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (high value 1.6554 at 2009.03.04 01:30 is not reached from the least timeframe, high price 1.6554 mismatches)
23:26:22 TestGenerator: unmatched data error (low value 1.6518 at 2009.03.04 02:08 and price 1.6516 mismatched)
23:26:22 TestGenerator: unmatched data error (volume limit 1235 at 2009.03.04 02:00 exceeded)
23:26:22 nnnn started for testing

I've just realized why we are getting those errors. Not every tick is registered by client terminal and this changes the bars values. So when backtester is comparing sum of volumes from lower timeframes we have errors. It simply doesn't match, because higher timeframes are refreshed with broker volumes and lower often don't. Obviously broker volumes are perfect and much bigger then those in terminal. I think this can even produce incorrect Highs and Lows...

Hope this helps.

 

Hey, why not just post your code and your logfile.

We're not worthy of you spending the time and effort to actually construct a question to pose.

 
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)
23:26:22 TestGenerator: unmatched data error (volume limit 1461 at 2009.03.04 01:30 exceeded)

I think this is one of the reasons that MQL5 will not use multiple files for history anymore.

I assume this was the question? If so then the other posts above have pretty much spelled it out. It's an indication of inconsistency in your history data from one timeframe to another, which may or may not affect your back test.

- Tovan

 
Is it a reliable way if I download historical M1 datas from my broker's website, and then convert it to higher timeframes (M5, M15 etc...) with the "built-in" period_converter script?
 
ggekko wrote >>
Is it a reliable way if I download historical M1 datas from my broker's website, and then convert it to higher timeframes (M5, M15 etc...) with the "built-in" period_converter script?

I think this is the best way. However when your terminal will start collecting new M1's problem will be back. Some solution would be to delete and upload recently collected M1 every time you do backtest - which sounds quite strange :)

 

I've got this result with downloaded historical data (M1 to M30 conversion). Is it reliable?


 
ggekko:

I've got this result with downloaded historical data (M1 to M30 conversion). Is it reliable?


Great, now how do I take that EA, and get it in my META4?  I'd like to run it for a while in my demo account. 


r/ 

 

GG

> I've got this result with downloaded historical data (M1 to M30 conversion). Is it reliable?

Define 'reliable' :)

There is always a difference between forward running of an EA on live data compared to historical data, however good the backtest data is...

If the strategy is sound and you have the results above, its time to forward test on demo & then on live!

FWIW

-BB-

 
ggekko wrote >>

I've got this result with downloaded historical data (M1 to M30 conversion). Is it reliable?

I think there are two main issues in tester.

1. No historical spread. Effect - equity like yours, because you are testing past with present spread.

2. Expected payoff value. If you have many trades you can calculate expected payoff from trade in pips. If expected profit is about 1-2 pips then this test is worthless. Any change in data feed from broker or dealing desk will kill your ea right away. Of course point 1) applies too.