Who wants a strategy? Lots and for free) - page 50

 

There is no any difference between "Journal by Bars" and "Journal by Position". They only display the information in different ways.


*A Data Bars Filter "filters" "Journal by Position "* it looks like that because there is no entry before "Oldest 'm' bars". The "Journal by Bars" shows the bars because they are loaded in the program but no trades are executed in the "Oldest" bars.


The "Data Bars Filter" and "Date Filter" are exactly that - filters. They are used to permit (or forbid) market entry for the interval specified. This do not change the strategy logic.


We cannot use "Data Bars Filter" or "Date Filter" in a "Closing logic Condition" slot. That would change the strategy exit logic.

 
Miroslav_Popov писал(а) >>

There is no any difference between "Journal by Bars" and "Journal by Position". They only display the information in different ways.

*A Data Bars Filter "filters" "Journal by Position "* it looks like that because there is no entry before "Oldest 'm' bars". The "Journal by Bars" shows the bars because they are loaded in the program but no trades are executed in the "Oldest" bars.

The "Data Bars Filter" and "Date Filter" are exactly that - filters. They are used to permit (or forbid) market entry for the interval specified. This do not change the strategy logic.

We cannot use "Data Bars Filter" or "Date Filter" in a "Closing logic Condition" slot. That would change the strategy exit logic.

I understood all this very well.

I tried to use these "perversions" in order to

1) To limit left and right optimization section.

2. To see the strategy behaviour after out of the optimization plot.

3. The graph curves did not interfere with looking at the relatively real part of the graph. (Point 1 - see the history section bounded on the left and right)

4. While minimizing the number of button presses.

(And in reality, it is often necessary to "look" more closely at some part of the history. At the same time, opening a separate (full chart) window "Balans/Equity Chart" is not convenient).

And all that until a bug with "Remove data older then" checkbox in Data Horizont is fixed .

So,let's wait for Data Horizont !!!!

 

The first bar in the magazine positions ...1254. Which, IMHO, should not change.


The Forex Strategy Builder wants a minimum of 300 bars. For it is 1554- 300 = 1254

 
/// <summary>
/// Data Horizon - Cuts some data
/// </summary>
int DataHorizon()
{
	if (iBars < MINIMUMBARS) return 0;

	int  iTempBars     = iBars;
	int  iTempStartBar = 0;
	int  iTempEndBar   = iBars - 1;
	bool bChange       = false;

	// Set the maximum nuber of bars
	if (iBars > iMaxBars && iMaxBars >= MINIMUMBARS)
	{   // We need to cut out the oldest bars
		iTempBars     = iMaxBars;
		iTempStartBar = iBars - iMaxBars;
		bChange       = true;
	}
	

	// Set the starting date
	DateTime dtStartingDate = new DateTime( iStartYear, iStartMonth, iStartDay);
	if ( bUseStartDate && aBar[ iTempStartBar].Time < dtStartingDate)
	{   // We need to cut out the oldest bars
		for (int iBar = iTempStartBar; iBar < iTempBars - MINIMUMBARS; iBar++)
		{
			if ( aBar[ iBar].Time >= dtStartingDate)
			{
				iTempStartBar = iBar;
				iTempBars     = iTempEndBar - iTempStartBar + 1;
				bChange       = true;
				break;
			}
		}
	}

	// Set the end date
	DateTime dtEndingDate   = new DateTime( iEndYear, iEndMonth, iEndDay);
	if ( bUseEndDate && aBar[ iTempEndBar].Time > dtEndingDate)
	{   // We need to cut out the newest bars
		for (int iBar = iTempStartBar + MINIMUMBARS; iBar < iTempEndBar; iBar++)
		{
			if ( aBar[ iBar].Time >= dtEndingDate)
			{
				iTempEndBar = iBar - 1;
				iTempBars   = iTempEndBar - iTempStartBar + 1;
				bChange     = true;
				break;
			}
		}
	}

	// Cut the data
	if ( bChange)
	{
		Bar[] aBarCopy = new Bar[iBars];
		aBar. CopyTo( aBarCopy, 0);

		aBar = new Bar[ iTempBars];
		for (int iBar = iTempStartBar; iBar <= iTempEndBar; iBar++)
			aBar[ iBar - iTempStartBar] = aBarCopy[ iBar];

		iBars  = iTempBars;
		dtTime = aBar[ iTempBars - 1].Time;
		bCut   = true;
	}

	return 0;
}

MINIMUMBARS = 300

iMaxBars - What we set in "Data Horizon"

 

:( I cannot post the code properly. It removes the leading tabs.

 
Miroslav_Popov писал(а) >>

// Set the starting date
DateTime dtStartingDate = new DateTime(iStartYear, iStartMonth, iStartDay);
if (bUseStartDate && aBar[iTempStartBar].Time < dtStartingDate)
{ // We need to cut out the oldest bars
for (int iBar = iTempStartBar; iBar < iTempBars - MINIMUMBARS; iBar++)
{
if (aBar[iBar].Time >= dtStartingDate)
{
iTempStartBar = iBar;
iTempBars = iTempEndBar - iTempStartBar + 1;
bChange = true;
break;
}
}
}

i.e. (you have to use Ctrl+Alt+M instead of formatting the text)

if ( bUseStartDate && aBar[ iTempStartBar].Time < dtStartingDate)
{ // We need to cut out the oldest bars
 for (int iBar = iTempStartBar; iBar < iTempBars - MINIMUMBARS; iBar++)
 {
  if ( aBar[ iBar].Time >= dtStartingDate)
  {
   iTempStartBar = iBar;
   iTempBars = iTempEndBar - iTempStartBar + 1;
   bChange = true;
   break;
  }
 }
}

but where else for the first if?

Or did you want to

if (bUseStartDate && aBar[iTempStartBar].Time < dtStartingDate)
 iTempStartBar = Какая_там_функция_пересчета_времени_в_бары(dtStartingDate)

Similarly for "end date"

 

**where else for the first if?

We cut data when:

1. Check box is checked: bUseStartDate == true

2. the selected date is after (newer) than the beginning of our historical data: aBar[iTempStartBar].Time < dtStartingDate


In the opposite case simply there is no cutting.


-------

Edit:

You cannot remove dates older than September 30th 2008. That is because if you remove them less than 300 bars will remain. (Daily chart)


for (int iBar = iTempStartBar; iBar < iTempBars - MINIMUMBARS; iBar++)

 
Miroslav_Popov писал(а) >>

** where's the else for the first if? **

Yeah. Hurriedly, I'm sorry. :(

It turns out, that for generation of strategy on H4 I can't use period less than 2.5 months (300/6=50days - weekend without bars ~ 2.5. months) is not critical, but also the interval of strategy checking (OOS) must start not later than 2.5 months before the current date (not convenient, because I doubt that the fitted strategy will live so long, and it's more interesting to see "how the strategy optimized the day before yesterday would behave today"), or subtract the "overlapping section", or ... Add empty bars to the file (hopefully computer time is not checked)

:)

Summary - I always set maximal number of bars (to avoid generation hangs), and set optimization/checking intervals by dates.

 

. добавлять пустые бары в файл (надеюсь, что время компьютера не проверяется)


It will catch them. Remove the check mark "Market" - "Check Data"

 
voltair >> :

And what data are needed to choose correctly? What do you need to investigate?

For example... how the strategy behaves in different types of markets, and now... I've encountered often a year's worth of profits over 2, and the last month's drain and the trend persists.