Amibroker Name() function comparison

Hi,

I am trying to run a very simple version of Amibroker on all symbols I have. It somehow works on few other symbols. But, not on these symbols. Just buy and sell at each timestamp (I am working on minute level data).

if(Name() == "NIFTY18APR10000CE.NFO")
{
	Sell = 1;
	Buy = 1;
    SetPositionSize( 50, spsShares );

}

if(Name() == "NIFTY-I.NFO")
{
	Sell = 1;
	Buy = 1;
	SetPositionSize(50, spsShares);
}

I have attached both of the excel files in drive. Here is the link. https://drive.google.com/open?id=1NAS1oIP7e_-s7xEejtqvWUc9pwUHl96B Backtesting results are empty. I thought trade should have occurred at each point. Any help is appreciated.
Thanks!!

1 Like

@Raunaak, If you BUY and SELL on each timestamp, should you not have ZERO position?

@snoopy.pa30 But, Trade signals should have been generated during backtesting. Even if I remove one of the buy or sell statement, backtesting results still come out to be empty.

If you try a different system...

Buy = Cross(C,MA(C,3));
Sell = Cross(MA(C,3), C);

Do you get some results?

No, I don't get any results.

if(Name() == "NIFTY18APR10000CE.NFO")
{
	Buy = Cross(C,MA(C,3));
	Sell = Cross(MA(C,3), C);

}

if(Name() == "NIFTY-I.NFO")
{
	Buy = Cross(C,MA(C,3));
	Sell = Cross(MA(C,3), C);

}

@Raunaak did you follow the suggestions of the How do I debug my formula? thread?

In particular:

When backtesting, check the Detailed Log

Inspecting the Detailed Log will tell you precisely what signals are generated each and every bar, what are position scores and when / why signals are ignored (due to constraints such as insufficient funds)

Can you post your full AFL

@snoopy.pa30 I just want to run this simple code. I need to write the complete strategy. If I am able to write this code, half of my work is done. Here is the current simple code.

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();


if(Name() == "NIFTY18APR10000CE.NFO")
{
	Buy = Cross(C,MA(C,3));
	Sell = Cross(MA(C,3), C);

}

if(Name() == "NIFTY-I.NFO")
{
	Buy = Cross(C,MA(C,3));
	Sell = Cross(MA(C,3), C);

}

All this seems to work for other (daily) symbols which I downloaded from yahoo finance. But, backtesting multiple symbols does not seem to work for these symbols.

@beppe I am going through this thread.

Thanks a lot!!

@Raunaak, I think you have made some assumptions incorrectly.

What do you expect to happen with this code?

What are the settings in the Analysis window?

What are the settings in the Backtester Settings for General tab?

@snoopy.pa30 All I want is to generate trade signals on multiple symbols even if I run amibroker once only. Here, I thought it would be generating backtest report with atleast some trades. This works for symbols I downloaded from yahoo finance. I think it has something to do with current data properties like minute level, etc. I have attached data here https://drive.google.com/open?id=1NAS1oIP7e_-s7xEejtqvWUc9pwUHl96B Could you please run the above code on this dataset?
Is following the settings in Analysis window?
image
Following is the backtester settings for general tab.
image