April 24, 2007
Using Zig() to reveal profit potential
Indicators like the Zig() can be used to reveal the profit potential for different stocks and in different time frames. Using this function is purely a fun experiment to give you a sense of where the profits are and what happens when you reduce trade duration. This function looks into the future and, of course, should never be used for trading with real money.
As shown below in the last line of the code, the Chart Title displays profit potential for combinations of trade duration and % change. Author’s note: while this is arguable, my interpretation is that shorter trade durations will give you smaller DDs, lower risk, and greater profits. The old argument of commission costs killing a High Frequency trading system no longer holds; commission costs may almost be ignored. For managing a high number of short term trades, using the IBc can allow 100 or more automated trades per day with no effort at all.
To run this code, copy it to an Indicator, click Insert, right-click on the chart to bring up the Param window, and vary the parameters to see for yourself where the profits occur. Try changing the ticker, commissions, the test period, etc. You may be surprised and decide you are trading the wrong Tickers.
Opt1 = Param("%Zig(Change)",0.1,0,1,0.05);
Opt2 = Param("Min.AllowableDuration",1,1,20,1);
Z = Zig(C,Opt1);
Buy = Z < Ref(Z,1) AND Z < Ref(Z,-1);
Sell = Z > Ref(Z,1) AND Z > Ref(Z,-1);
Buy = Buy AND BarsSince(Sell) > Opt2;
Sell = Sell AND BarsSince(Buy) > Opt2;
Short = Sell;
Cover = Buy;
Eq = Equity(1);
Plot(C,"",colorBlack,styleBar);
Plot(z,"",colorWhite,styleLine);
ShowTriangles = ParamToggle("Arrows","HIDE|SHOW",1);
if(showTriangles)
{
PlotShapes(IIf(Buy,shapeSmallUpTriangle,shapeNone),5,0,BuyPrice,0);
PlotShapes(IIf(Sell,shapeHollowDownTriangle,shapeNone),4,0,SellPrice,0);
PlotShapes(IIf(Cover,shapeHollowUpTriangle,shapeNone),5,0,CoverPrice,0);
PlotShapes(IIf(Short,shapeSmallDownTriangle,shapeNone),4,0,ShortPrice,0);
}
InitialEquity = GetOption("InitialEquity");
Title = "\n"+"\n"+"FinalProfit:"+NumToStr((LastValue(Eq)-InitialEquity)/InitialEquity*100,1.2)+"%\n";
Edited by Al Venosa
Filed by Herman at 9:07 pm under Research and System Explorations
Comments Off on Using Zig() to reveal profit potential