{"id":48,"date":"2007-04-24T21:07:26","date_gmt":"2007-04-24T21:07:26","guid":{"rendered":"http:\/\/69.65.98.246\/userkb\/2007\/04\/24\/using-zigzag-to-reveal-profit-potential\/"},"modified":"2010-12-28T09:23:40","modified_gmt":"2010-12-28T09:23:40","slug":"using-zigzag-to-reveal-profit-potential","status":"publish","type":"post","link":"http:\/\/www.amibroker.org\/editable_userkb\/2007\/04\/24\/using-zigzag-to-reveal-profit-potential\/","title":{"rendered":"Using Zig() to reveal profit potential"},"content":{"rendered":"

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.<\/p>\n

As shown below in the last line of the code, the Chart Title displays profit potential for combinations of trade duration and % change. Author\u00e2\u20ac\u2122s 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.<\/p>\n

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.<\/p>\n

Opt1 = Param(\"%Zig(Change)\",0.1,0,1,0.05);
\nOpt2 = Param(\"Min.AllowableDuration\",1,1,20,1);
\nZ = Zig(C,Opt1);
\nBuy = Z < Ref(Z,1) AND Z < Ref(Z,-1);
\nSell = Z > Ref(Z,1) AND Z > Ref(Z,-1);
\nBuy = Buy AND BarsSince(Sell) > Opt2;
\nSell = Sell AND BarsSince(Buy) > Opt2;
\nShort = Sell;
\nCover = Buy;
\nEq = Equity(1);
\nPlot(C,\"\",colorBlack,styleBar);
\nPlot(z,\"\",colorWhite,styleLine);
\nShowTriangles = ParamToggle(\"Arrows\",\"HIDE|SHOW\",1);
\nif(showTriangles)
\n{
\nPlotShapes(IIf(Buy,shapeSmallUpTriangle,shapeNone),5,0,BuyPrice,0);
\nPlotShapes(IIf(Sell,shapeHollowDownTriangle,shapeNone),4,0,SellPrice,0);
\nPlotShapes(IIf(Cover,shapeHollowUpTriangle,shapeNone),5,0,CoverPrice,0);
\nPlotShapes(IIf(Short,shapeSmallDownTriangle,shapeNone),4,0,ShortPrice,0);
\n}
\nInitialEquity = GetOption(\"InitialEquity\");
\nTitle = \"\\n\"+\"\\n\"+\"FinalProfit:\"+NumToStr((LastValue(Eq)-InitialEquity)\/InitialEquity*100,1.2)+\"%\\n\";<\/code><\/p>\n

Edited by Al Venosa<\/p>\n","protected":false},"excerpt":{"rendered":"

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, […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[66],"tags":[],"_links":{"self":[{"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/posts\/48"}],"collection":[{"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":0,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/posts\/48\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/media?parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/categories?post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/tags?post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}