Pattern recognition: double bottoms
Author: hedge15
Creation Date: 9/9/2016 8:47 PM
profile picture

hedge15

#1
I would appreciate your help with this code.

I downloaded the code for pattern recognition specifically for dbl btms from http://www2.wealth-lab.com/WL5WIKI/PatternRecognition.ashx

If you look at the chart I attached it posts the stock when price hits the higher red circle but I want to to post when it hits the 1st red circle (on the actual retest of the bottom).

The code doesn't really include the logic from what I see (and I am just starting to code) almost like its pulling the logic from somewhere else within WealthLab.

Any help would be GREATLY APPRECIATED!!!

profile picture

Eugene

#2
This is not an issue (so I've renamed the improperly titled thread), it's just by design. Detection of patterns cannot happen where you want it to i.e. when it hits the 1st red circle. At this point in time it would take a crystal ball in an ideal world to call it a bottom. :)

There's a natural delay for any pattern recognition algorithm to do its job under the hood. Specifically, this one uses TroughBar and, as said in its online usage guide the Wiki, it will lag and report troughs a few bars later than they actually occurred in hindsight which is unavoidable when backtesting trading systems. The line to the right leg of the W Bottom is drawn after the fact on the bar that precedes the Alert (the bar with reddish background).

In summary, there's no artificial delay here and nothing to worry about.
profile picture

hedge15

#3
Thank you for the response. If you can identify the 1st peak, a list of all hits retesting tat peak would be perfect, leaving it up to me and my rules when and if to enter the trade. By the time it hits a traditional dbl btm or dbl top scan, I am in the trade a few days.

Is this possible, to get a hot of retests of the peaks or Trough on the retest, leaving it to the trader to decide when and if to enter?
profile picture

Eugene

#4
Sure it's possible. Here's a helpful design pattern for you to learn: WealthScript Techniques | Setups, Triggers, Delays, and Timeouts

Using it you can express your idea like does the code below. Speaking of double bottoms, it saves the first leg once found and enters on a limit order at the 1st leg's price - which is a retest. This is only an example so I leave the rest up to you to experiment and to improve:

CODE:
Please log in to see this code.
profile picture

hedge15

#5
I just ran it on the SP100 for 1991 to 2016 and there wasnt 1 signal. I will look at it over the weekend but there must be something wrong. Thanks for the help.
profile picture

hedge15

#6
reran it and it had 935 trades over the past 15 years. Need to look through it but thanks for the head start.
profile picture

Eugene

#7
To run on entire S&P 100, choose a Raw Profit position size - like 100 shares. This way you shouldn't get any signals skipped due to insufficient capital.
profile picture

Cone

#8
Here's another take on it. Set a minimum width (between the anticipated double bottom), and here I used 10% excursions for identifying troughs.

CODE:
Please log in to see this 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).