S&C 2013-07 | The Step Candle Pattern (Vervoort)
Author: Eugene
Creation Date: 6/5/2013 1:45 AM
profile picture

Eugene

#1
Code for TASC 2013-07 | The Step Candle Pattern (Vervoort) strategy has been published in the Wealth-Lab Wiki (click).
profile picture

rmandel00

#2
I copied the code and pasted it into a new strategy ran it but get no zig-zag lines, no annotations for the candels and the bars are all a light blue. What have I done wrong?
Thanks,
Rich Man
profile picture

Eugene

#3
You probably haven't updated the TASCIndicators library to its latest version 2013.04 (or higher), as instructed by the article text or error messages acting as clue in the Strategy Editor's error message area.
profile picture

rmandel00

#4
I had installed the 2013.04 version of TASCIndicators library and I don't see any error messages in the pane below the code. Any other thoughts?
I did notice, in looking over the code the following line has curved red underlines
double t1 = 0, p1 = 0, inPrice, outPrice = 0, magnitude = 0;
int tb1 = 0, pb1, barDetected = 0, zigBar = 0, zagBar = 0;
also:
double inPrice = 0, outPrice = 0, magnitude = 0;
int barDetected = 0, zigBar = 0, zagBar = 0;
Despite these, the program compiles.


Thanks,
Rich MAn
profile picture

Eugene

#5
Red underlines are OK in this case. Maybe you're not loading enough bars, or the chosen swing percentage is not OK for your stock. Experiment.
profile picture

rmandel00

#6
I have found the on my code, line 151 is commented out:
//BuildZZ();
Likewise on the published write up of the strategy:
http://www2.wealth-lab.com/WL5WIKI/TASCJuly2013.ashx?HL=irsts
it is commented out. If I remove the // from the line, the strategy works, places the candle markers and the red and blue zigzag lines.
Rich Man

profile picture

Eugene

#7
It's commented purposefully. BuildZZ() is legacy code borrowed from S&C 2013-06 article and generally shouldn't be used. The strategy works fine using BuildZZHiLo() which is its successor.

Chances are a handled exception happens in BuildZZHiLo() in runtime but we'll never know since you didn't indicate how many bars you loaded, what combination of stock/timeframe it is, and which Reversal %/Lookback settings did you use.
profile picture

rmandel00

#8
I started with the default settings for Reversal%/Lookback for a number of different ETF's including SPY, DIA and QQQ also AAPL. I examined 10 years of daily data. I adjusted down the two sliders and no settings yielded the zig zag or candle annotations to the chart. Pretty much all conditions gave me both the zig zag and candle annotations while all settings gave me these annotations using BuildZZ().
profile picture

Eugene

#9
Considering this, it really looks like a handled exception in BuildZZHiLo().

If you make the default exception handling in BuildZZHiLo()...
CODE:
Please log in to see this code.

...more verbose:
CODE:
Please log in to see this code.

...then it could give some clue.
profile picture

thodder

#10
Eugene,

I'm seeing the same thing as rmandel00.

I put the catch changes you suggest, but there's no pop-up.

I made the following changes to the code around line 61:
CODE:
Please log in to see this code.


The PrintDebug creates the following output for security AAPL for a backtest of the past 3 years:
QUOTE:
Drawing line: z.zigBar=0;z.inPrice=0;z.zagBar=16;z.outPrice=265.99
Drawing line: z.zigBar=16;z.inPrice=265.99;z.zagBar=38;z.outPrice=235.56
Drawing line: z.zigBar=38;z.inPrice=235.56;z.zagBar=157;z.outPrice=364.9
Drawing line: z.zigBar=157;z.inPrice=364.9;z.zagBar=199;z.outPrice=320.16
Drawing line: z.zigBar=199;z.inPrice=320.16;z.zagBar=202;z.outPrice=355.13
Drawing line: z.zigBar=202;z.inPrice=355.13;z.zagBar=242;z.outPrice=310.5
Drawing line: z.zigBar=242;z.inPrice=310.5;z.zagBar=267;z.outPrice=404.5
Drawing line: z.zigBar=267;z.inPrice=404.5;z.zagBar=276;z.outPrice=353.02
Drawing line: z.zigBar=276;z.inPrice=353.02;z.zagBar=306;z.outPrice=422.86
Drawing line: z.zigBar=306;z.inPrice=422.86;z.zagBar=316;z.outPrice=354.24
Drawing line: z.zigBar=316;z.inPrice=354.24;z.zagBar=325;z.outPrice=426.7
Drawing line: z.zigBar=325;z.inPrice=426.7;z.zagBar=353;z.outPrice=363.32
Drawing line: z.zigBar=353;z.inPrice=363.32;z.zagBar=445;z.outPrice=644
Drawing line: z.zigBar=445;z.inPrice=644;z.zagBar=455;z.outPrice=555
Drawing line: z.zigBar=455;z.inPrice=555;z.zagBar=456;z.outPrice=618
Drawing line: z.zigBar=456;z.inPrice=618;z.zagBar=473;z.outPrice=522.18
Drawing line: z.zigBar=473;z.inPrice=522.18;z.zagBar=560;z.outPrice=705.07
Drawing line: z.zigBar=560;z.inPrice=705.07;z.zagBar=598;z.outPrice=505.7501
Drawing line: z.zigBar=598;z.inPrice=505.7501;z.zagBar=608;z.outPrice=594.59
Drawing line: z.zigBar=608;z.inPrice=594.59;z.zagBar=618;z.outPrice=501.23
Drawing line: z.zigBar=618;z.inPrice=501.23;z.zagBar=628;z.outPrice=555
Drawing line: z.zigBar=628;z.inPrice=555;z.zagBar=644;z.outPrice=435
Drawing line: z.zigBar=644;z.inPrice=435;z.zagBar=655;z.outPrice=484.94
Drawing line: z.zigBar=655;z.inPrice=484.94;z.zagBar=669;z.outPrice=419
Drawing line: z.zigBar=669;z.inPrice=419;z.zagBar=684;z.outPrice=469.95
Drawing line: z.zigBar=684;z.inPrice=469.95;z.zagBar=702;z.outPrice=385.1
Drawing line: z.zigBar=702;z.inPrice=385.1;z.zagBar=714;z.outPrice=465.75


For some reason the DrawLine and AnnotateBar methods don't seem to have any affect. The chart only shows silver bars without any of the extras.
profile picture

thodder

#11
Note: I'm trying to add a file attachment so you can see a screen print, but the 'Add Attachment(s)' doesn't seem to work.
profile picture

Eugene

#12
Since it's not an exception, I had an Aha moment:

Reason: Semi-Log chart scale.
Solution: switch to normal Linear chart scale.

QUOTE:
Note: I'm trying to add a file attachment so you can see a screen print, but the 'Add Attachment(s)' doesn't seem to work.

Either the file extensions wasn't allowed (allowed are: *.jpg, *.gif, *.png, *.zip, *.rar, *.pdf, *.txt), or its size exceeded 2-3 Megabytes.
profile picture

thodder

#13
Switching to Linear chart scale seemed to fix it for me. Is that proper, or is there an issue with DrawLine?

On adding the file attachment, all the 'Add Attachment(s)' link seems to do is take me to the top of this topic. I don't have a method to enter the file name. It is a jpg and it is only 46KB in size. I tried using IE8 as well as Google Chrome to add the attachment. Neither browser would work.
profile picture

Eugene

#14
Perhaps it has something to do with price being 0:
QUOTE:
Drawing line: z.zigBar=0;z.inPrice=0;z.zagBar=16;z.outPrice=265.99


Currently, the good old IE8 has compatibility problems with the site. Not sure about Chrome but in Firefox 22, attachments work fine.
profile picture

rmandel00

#15
Switching to linear charts fixed if for me as well. Thanks for your help.
Rich Man
profile picture

thodder

#16
Eugene,

I think you have something there. I made the following code change around line 57:
CODE:
Please log in to see this code.


Notice the test for z.inPrice. After that, the semi-log mode seems to work with AAPL.

I am seeing these errors in the wlp.txt log file:
QUOTE:
2013-07-06 09:50:44,609 [1] ERROR WealthLabPro.ChartForm [(null)] - Overflow error.
2013-07-06 09:50:48,140 [1] ERROR WealthLabPro.ChartForm [(null)] - Overflow error.
2013-07-06 09:50:48,375 [1] ERROR WealthLabPro.ChartForm [(null)] - Overflow error.


With the test for 'z.inPrice == 0.0', that appears to have eliminated one of the errors, but two others remain. At first glance, the other two errors don't appear to affect the drawing of the chart.
profile picture

Eugene

#17
Thank you Tim. That's a reasonable change: no zeros or negative values should be on a log scale because log(0) = -infinity. Fixed the Wiki article code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).