Thanks Mike.What I want to find is profit/loss if i trade every signal.Backtest would consider signals depending on capital available based on position size and maximum open positions I select..
Secondly I want to find total profit/loss percent generated by each scrip so that I can identify which scrips produce better results for the trading system. If you can guide me in this direction I would be grateful. On 1 April 2010 03:58, Mike <[email protected]> wrote: > > > You need to read the turorials on how to run a backtest. > > http://www.amibroker.com/guide/h_backtest.html > > Mike > > > --- In [email protected] <amibroker%40yahoogroups.com>, rpc > <rpc20060...@...> wrote: > > > > hi > > I want to test a system by finding total profits generated.I am able to > get > > tradewise profits but not able to get scripwise profit and total profit > > generated.Follo is my code > > > > > > > > Buy = Cross(*C* , MA(*C*,10)); > > * > > > > Sell* = Cross(MA(*C*,10),*C*); > > > > buyat = ValueWhen(*Buy*,*C*,1); > > > > sellat = ValueWhen(*Sell*,*C*,1); > > > > profit = Sellat-buyat; > > > > profitpercent = profit/buyat * 100; > > > > to get total profits i have tried following one at a time > > > > totProfit = Sum(profitpercent,*BarCount*); > > > > or > > > > totprofit = cum(profitpercent); > > > > or > > > > totprofit = 0; > > > > for (i=0;i++;i<barcount-1) > > > > { > > > > totprofit[i] = totprofit[i-1]+profitpercent[i]; > > > > } > > > > Filter = *Buy* *OR* *Sell*; > > > > AddColumn(*Buy*, "Buy", 1.2); > > > > AddColumn(*Close*, "Close", 1.2); > > > > AddColumn(IIf(*Buy*,Buyat,0), "BuyPrice", 1.2); > > > > AddColumn(IIf(*Sell*,Sellat,0), "SellPrice", 1.2); > > > > AddColumn(IIf(*Sell*,Profit,0), "Profit", 1.2); > > > > AddColumn(IIf(*Sell*,ProfitPercent,0), "Profit%", 1.2); > > > > AddColumn(IIf(*Sell*,TotProfit,0), "TotProfit%", 1.2); > > > > after i run above I get zero in last column except in cum() function > where i > > get some numbers which are not correct. > > > > I would be grateful if someone could help > > > > TIA > > > > >
