I'm still at the early phase of learning AmiBroker and am trying to code
my first easy test system.  It's the example EMA crossover system given
in the User's Guide.

I have a one-minute chart open with  a year's worth of historical
one-minute FOREX data (Euro-USD). After writing my formula, I click on
Analysis. On the pop-up panel, I check off  "Run every 1 min" on all
quotations. But when the back test runs, it runs on daily data instead
of the one-minute data.

(1) How do I get the backtest to run on the one-minute data, not daily?

(2) Is there a quick and easy way to automatically plot the buy/sell
points so I can view the entry and exit positions on the graph?

(3) Does the backtest engine choose close prices for the entry and
exits? If so, is this realistic, given that the high/low within each bar
can often be plus or minus several PIPs away from the actual close?


Below is my code:

_SECTION_BEGIN("Price");

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close
%g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C,
SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle |
ParamStyle("Style") | GetPriceStyle() );

if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
  ToolTip=StrFormat("Open: %g\nHigh:  %g\nLow:   %g\nClose:  %g
(%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C,
1 )));
}
_SECTION_END();

/////////////////////////////////////////////////////
// simplest buy sell rules;
// Buy when the Close crosses above the 45-Day EMA;
// sell when the 45-day ema crosses above the close;
//////////////////////////////////////////////////////

Buy = Cross( Close, EMA( Close, 45 ) );
Sell = Cross( EMA( Close, 45 ), Close );
SetPositionSize(5,spsShares);

Reply via email to