TroughDivergence
Author: tradercn
Creation Date: 11/17/2011 8:50 AM
profile picture

tradercn

#1
In a down trend, as far as I know the divergence between MACD and price trough generates the trade signal with high probability in the Elliot wave 3. Since Elliot wave is subject, I try to use OpenCloseIndicator to replace the condition of Elliot wave 3. OCI equals to sum(open)-sum(close).
To detect the divergence, I uses TroughDivergence in community.components. However, the divergence can not be showed properly as I expected.
I want to upload attachments to get your help, how can I do that please? And, is there any other functions better than troughdivergence? Thanks.
profile picture

Eugene

#2
No attachments currently but if that's an image, you could post the image link obtained from any image hoster out there.
profile picture

Eugene

#3
Regarding other functions please see this FAQ: Can I detect divergences using Wealth-Lab?
profile picture

tradercn

#4
Hi Eugene,

You've been very helpful. I will look through the link you provided above.
The problem I have, is the strategy generates trading signals much more than my expectation. What I expect is, the trough divergence between MACD and price (PlotTroughDivergence==-1), oci is less than -100, both conditions trigger buying signals. In my understanding, on the chart, the trade signals are the places where exist divergence line(MACDPane and Price Pane) and oci is below -100. But there are two many signals showed on the chart. Here is the link:
http://imageshack.us/f/838/picgt.jpg/
From the chart, it is supposed to signal three times. But you can see many signals on this chart.
Here is the code.
CODE:
Please log in to see this code.

I guess it is because of the condition of BuyAtMarket, but I don't know what is wrong. Thanks for your help again.
profile picture

tradercn

#5
BTW, just found the three codes examples don't show properly. Here are the links. You might want to check them out.
http://www2.wealth-lab.com/WL5WIKI/TASCJuly2008.ashx
http://www2.wealth-lab.com/WL5WIKI/TASCOct2008.ashx
http://www2.wealth-lab.com/WL5WIKI/TASCOct2010.ashx
Focus on the strategy code part please.

profile picture

Eugene

#6
QUOTE:
What I expect is, the trough divergence between MACD and price (PlotTroughDivergence==-1), oci is less than -100,

But your code, in contrast to your expectations, takes trades in the "either Divergence or OCI" manner:
CODE:
Please log in to see this code.

The "and" operator in C# is & (or &&):
CODE:
Please log in to see this code.
profile picture

tradercn

#7
Thank you so much. You are great!
But after I changed it the trading signals are less than my expectation. Here is the picture: http://imageshack.us/f/832/pic2wn.jpg/
I have two questions if you look at this chart. There are two divergences, I call them A and B. For Divergence B, there is no trading signal with oci < -100. For Divergence A, in my understanding, on price pane, the lowest green bar is supposed to be the end of the Divergence A, so the buy signal should be triggered at the next day rather than two days later. Is there anything wrong here?
To help you to clarify what is the problem. Here is the index data I used. https://docs.google.com/open?id=0B3nvPJ30rJORMmNlMWMwOWQtZDk2MC00NmY3LTgwNjgtMDIyMTk3NDUzNDU0
Thanks again for your help.
profile picture

Eugene

#8
QUOTE:
For Divergence B, there is no trading signal

Double check your position sizing. Make sure you've read the User Guide chapter on 100% sizing too.
profile picture

tradercn

#9
I checked Position zing. It is Raw Profit Mode, fixed dollar 100000. Margin Factor 1 to 1.

I looked at the divergence B again. I am wondering, which bar is the end of the divergence? The end of divergence B on price pane is Oct 28 2008. However, it sounds, the end of divergence B on MACD Pane is Nov 5, where oci >-100. Is it? Which bar is the end of divergence please? I guess it is the key.
profile picture

Eugene

#10
QUOTE:
the lowest green bar is supposed to be the end of the Divergence A, so the buy signal should be triggered at the next day rather than two days later. Is there anything wrong here?

Absolutely nothing. Internally the technique is built on Peak/Trough, so you're welcome to learn more on their Wiki help pages (namely "Calculation" section).
QUOTE:
I checked Position zing. It is Raw Profit Mode. Margin Factor 1 to 1.

Then the indicator on the bar preceding the signal was not below -100. Insert a PrintDebug call on top of BuyAtMarket with the bar number and indicator value and the concern will naturally be solved.
profile picture

tradercn

#11
I will look at the Peak/Trough wiki help pages.
About the PrintDebug, do you have any example? I know my question is very simple. :)
I opened Data Window. The divergence B doesn't generate TroughDivergence -1. That means this function has some bug. Can I say that?
Thanks again.
profile picture

Eugene

#12
In the QuickRef, of course.
profile picture

tradercn

#13
Gocha! :) Thanks.
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).