Rank: Advanced Member
Groups: Registered, Registered Users Joined: 5/22/2005(UTC) Posts: 59
|
...."the flag pattern is a sharp runup in price followed by a consolidation for 17+ days that does not retrace more than 38% of the initial runup".
Any thought?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
Quote:the flag pattern is a sharp runup in price
over how long? days, weeks, months, years?
can you quantify the minimum change? $3, 50% ?
Quote:followed by a consolidation for 17+ days
consolidation? the price does not change? it only changes by an amount x?
17+, is that 17 - 522550 days so we find flags within the last millenium?
Quote:that does not retrace more than 38% of the initial runup
once the previous bits have been defined, this bit is easy!
You need to be VERY specific when you ask a computer to do something. Remember, a computer cannot interpret what you think you mean. It will do exactly what you say.
In simple terms: [censored]in = [censored]out!
wabbit :D
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 5/22/2005(UTC) Posts: 59
|
A sharp runup is prices moving more than 50% in a very short period of time (four to eight weeks) and then corrects sideways (consolidation) for 17+ days but not more than 5 weeks. This correction can't retrace more than 38% of the initial runup.
Hope this makes the statement more SPECIFIC!
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
Does this do it for you?
--8<------------------------
shortPeriod:=40;{days}
consolPeriod:=20;{days}
retrace:=38;{pct}
incLimit:=50;{pct}
x:=C;{data array}
Sum(x>((100-retrace)/100)*ValueWhen(1,ROC(x,shortPeriod,%)>incLimit,x),consolPeriod)>=consolPeriod;
--8<------------------------
Got any example stocks I can have a look at to make sure the returns are right?
wabbit :D
P.S. Be nice.....
[edited]
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
First re-work....
shortPeriod:=40;{days}
consolPeriod:=20;{days}
retrace:=38;{pct}
incLimit:=50;{pct}
x:=C;{data array}
consol:=Sum(x>((100-retrace)/100)*ValueWhen(1,ROC(x,shortPeriod,%)>incLimit,x),consolPeriod);
consol>=Min(consolPeriod,17) AND consol<=Max(consolPeriod,25)
[edited]
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
After spending a little more time....
--8<----------------------------------
shortPeriod:=40;{days}
consolPeriod:=20;{days}
retraceLimit:=20;{pct}
incLimit:=50;{pct}
x:=C;{data array}
y0:=ROC(x,shortperiod,%)>incLimit;
y1:=y0=1 AND Alert(y0=0,2);
y1*x; {red histogram}
y2:=ValueWhen(1,y1,x)*(100-retraceLimit)/100;
y2; {green line}
N:=BarsSince(y1)=consolperiod AND Sum(x>y2,consolPeriod)>=consolPeriod;
X:=x<y2;
I:=Cum(N+X>-1)=1;
Tr:=BarsSince(I OR N)<BarsSince(I OR X);
Tr*C;
--8<----------------------------------
Step by step:
Define the variables to be used.... no tricks here!
shortPeriod:=40;{days}
consolPeriod:=20;{days}
retraceLimit:=20;{pct}
incLimit:=50;{pct}
x:=C;{data array}
Find the day when the Rate of Change is greater than the specified amount over the specified time period. I like to plot this so I can evaluate if the triggers are responding correctly.
y0:=ROC(x,shortperiod,%)>incLimit;
y1:=y0=1 AND Alert(y0=0,2);
y1*x; {red histogram}
Now we calculate the retracement line price, and plot it too!
y2:=ValueWhen(1,y1,x)*(100-retraceLimit)/100;
y2; {green line}
The Entry is set if the ROC condition has been met, and the price has not fallen below the retracement amount during the consolidation period, since the last time this condition was met. This is a limitation, because if the ROC condition is met again in this period, it resets. It saves nesting counters and a lot of my time. It has an added plus though, it pyramids entries.
N:=BarsSince(y1)=consolperiod AND Sum(x>y2,consolPeriod)>=consolPeriod;
Once the entry has been set, I recompute the actual entry price and the new limit. Again I like to plot this to see if all is well.
y2:=ValueWhen(1,N,x)*(100-retraceLimit)/100;
y2; {green line}
Now we define the exit criteria. This is set here if the price falls below the green line, the retracement limit.... You could set your own criteria here.
X:=x<y2;
Then Roy Larsen has shown us the way from here!
I:=Cum(N+X>-1)=1;
Tr:=BarsSince(I OR N)<BarsSince(I OR X);
Tr*C; {heavy blue line}
Hope this helps.
wabbit :D
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 5/22/2005(UTC) Posts: 59
|
Hi wabbit,
Thank you very much for your effort!
However, in my 2 cents, this code is not correctly described the statement.
Let's look at an example to clarify. ESE:NYSE moved up from a low of 70.80 on 04/27/05 to 106.50 on 06/10/05, an 50.4% move. From 106.50 it developed a consolidation pattern that declined to 97.09, a drop of 9.41 points, or 26.4% of the prior upmove (<38%). The consolidation lasted 17 days or longer before a breakout occured on 07/14/05.
I am monitoring these stocks daily by human eye; I am trying hard to code this criteria but without success....
Looking forward for your help! Many thanks!!
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
I am still looking into your case .... but just an observation as we go through.
The reason my code didnt pick up ESE was because the LOW on 04/27/05 was 70.80, but the LOW on 06/10/05 was 103.00, a change of only 45.48% You were comparing highs with lows. In my code you get to set the data arrays to compare with the 'x' variable.
If you want to compare highs with lows, change the line:
y0:=ROC(x,shortperiod,%)>incLimit;
to read:
y0:=(H-Ref(L,-shortPeriod))/Ref(L,-shortPeriod)>incLimit;
and see where that takes you....
alternatively, change the threshold level of the incLimit from 50 to, say, 45
wabbit :D
P.S. Where are you? and do you skype?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
{Wabbits Flag Entry v2.02}
{concept by lcl}
{code by Wabbit}
shortPeriod:=40;{days}
consolPeriod:=17;{days}
retraceLimit:=38;{pct}
incLimit:=40;{pct}
x:=C;{data array}
y0:=ROC(x,shortperiod,%)>incLimit;
y0:=y0=1 AND Alert(y0=0,2);
y0*x; {red histogram}
y1:=If(PREV=0,y0,If(BarsSince(PREV=0)>consolPeriod,y0,PREV));
y2:=y1 AND Alert(y1=0,2);
y3:=ValueWhen(1,y2,x-(ROC(x,shortperiod,$)*(retraceLimit/100)));
y3; {green line}
N:=BarsSince(y2)=consolperiod AND Sum(x>y3,consolPeriod)>=consolPeriod;
X:=x<y3;
I:=Cum(N+X>-1)=1;
Tr:=BarsSince(I OR N)<BarsSince(I OR X);
Tr*C;
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 5/22/2005(UTC) Posts: 59
|
Hi wabbit,
I am from Kuala Lumpur, Malaysia. I don't use skype but I can be reached at ysylcl03@yahoo.com (Yahoo Messenger).
Again thank you very much for your sharing. It's very close to what stated in the statement but is not exactly described the statement.
Again let's take ESE as example to clarify. This stock moved up from a low of 70.80 on 04/27/05 to 106.50 on 06/10/05, an 50.4% move in less than 8 weeks (in my 2 cents, we can't set shortPeriod:=40 which it will calculate the ROC value in exactly 40 days).
From 106.50 it developed a consolidation pattern that declined to 97.09, a drop of 9.41 points, or 26.4% of the prior upmove (<38%). The consolidation lasted 17 days or longer (again, not exactly 17 days) before a breakout (buy entry is triggering by a breakout) occured on 07/14/05.
Hope this clarifies the statement!
P/S: English is not my mother tongue, please bear with my poor writing!
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
lcl wrote:Again let's take ESE as example to clarify. This stock moved up from a low of 70.80 on 04/27/05 to 106.50 on 06/10/05, an 50.4% move in less than 8 weeks (in my 2 cents, we can't set shortPeriod:=40 which it will calculate the ROC value in exactly 40 days).
We can do a little more work here...
We will use the LLV() function and the HHV() function to define the range of a stock over a finite period. You have to define a period - the computer cannot "just look back" and see stuff that we see with our eyes.
We then test the range (HHV()-LLV())/LLV() has to be greater than our threshold. If this is not the case, reject the stock.
We then test to see when the H=HHV() happened. If since that time, the stock has "consolidated" (as we have previously defined) then we look for the entry.
lcl wrote:From 106.50 it developed a consolidation pattern that declined to 97.09, a drop of 9.41 points, or 26.4% of the prior upmove (<38%). The consolidation lasted 17 days or longer (again, not exactly 17 days) before a breakout (buy entry is triggering by a breakout) occured on 07/14/05.
If I understand correctly: the entry is based on the first high being higher than the peak, but only if it occurs after at least 17 days?
--
All is achievable....... standby for code. In the mean time, download Patrick's excellent, free and BRAND NEW latch dile, avaialble from:
http://forum.equis.com/viewtopic.php?t=1303
My code will require this add-in.
wabbit :
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 5/22/2005(UTC) Posts: 59
|
Hi wabbit,
I've downloaded the file you mentioned but I am pretty new to latch file. How am I going to do with the file? Import it in to my MetaStock or what?
Many thanks!
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
Patrick wrote:You need to download the ForumDll and copy it in C:\\program Files\\Equis\\ExternalFunctionDll
wabbit :D
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.