wealth-lab back testing
November 15, 2005 by Trader Rich
I’m sure some of you have already checked out www.wealth-lab.com which is an interactive development laboratory. I cannot use the developer because it is only available to users outside of the United States and Canada.
What I have checked out is the ChartScripts that are presented by other users on the site. You can interactively see how certain equities have performed over the last 5 years using a particular trading system.
One trading system in particular I’ve looked at is the Stochastic Price Reverse - market V4.5. I’ve looked at the code associated with this to try to emulate this test in my backtesting lab. These scripts are developed with equities in mind so some of the constants need to be changed. In my initial runs, I’ve seen a lot of promise with this trading system. Quite simply, if Stochastic K% is > 97 using 16 period parameter, initiate a sell. Exit the position after 1 full period. If stochastic K% is < 5 using 9 period parameter, initiate a buy. Exit the position after 1 full period. In addition, this trading system verifies that past close of equity is greater than or less than other past closes. These constants cannot be used for currencies because of the price change percentages being much lower. Running this on the 4 major currency pairs, I’ve seen an average 2 year gain of about 1500 pips.
They use their own proprietary programming language but it is a very readable programming language and layman may be able to understand it. I’ve posted the code here:
var STOCHPANE, BAR: integer;
var StochPeriod, StochPeriodShort: integer;
{Stoch. period for longs}
StochPeriod:= 9;
{Stoch. period for shorts}
StochPeriodShort:= 16;
for Bar := 20 to BarCount - 1 do
begin
if not LastPositionActive then
{Entry rules}
begin
if (StochK( Bar, StochPeriod) < 5) then
if (0.96*@#AverageC[ Bar-2 ] > @#AverageC[ Bar-1 ] ) then
if (0.86*@#AverageC[ Bar-1 ] > @#AverageC[ Bar ] ) then
BuyAtMarket(Bar+1,”);
if (StochK( Bar, StochPeriodShort) > 97) then
if (1.12*@#AverageC[ Bar-2 ] < @#AverageC[ Bar-1 ] ) then
if (1.24*@#AverageC[ Bar-1 ] < @#AverageC[ Bar ] ) then
ShortAtMarket(Bar+1,”);
end
else
{Exit rules}
begin
if MarketPosition = 1 then SellAtClose( Bar + 1, LastPosition, ” );
if MarketPosition = -1 then CoverAtClose( Bar + 1, LastPosition, ” );
end;
end;
{Plotting}
StochPane := CreatePane( 120, true, true );
PlotSeries( StochKSeries(StochPeriod), StochPane, #Purple, #Thin);
PlotSeries( StochKSeries(StochPeriodShort), StochPane, #Green, #Thin);
Popularity: 1%


Comments
Feel free to leave a comment...
and oh, if you want a pic to show with your comment, go get a gravatar!