[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Coding a pattern of variable length



PureBytes Links

Trading Reference Links

Hi,

No, not quite.

The Bar which defines the start of the pattern is not defined 
correctly. I'll try to explain. Its just a shame I can't post an 
image which would clarify things.

The Start of the pattern would not be Cross(IndA, IndB). It would 
simply be IndA > IndB. 

The 2nd bar in the pattern would be IndA < IndB. I guess that this 
2nd bar could be coded as Cross(IndB, IndA).

Using your plotted code as an example:

What I'm looking for is on the first bar the green line should be 
above the blue line AND on the 2nd bar the green line should be below 
the blue line.

Looking at the code on a chart this is not happening.


Is this any clearer?




--- In amibroker@xxxxxxxxxxxxxxx, "Mr. Valley" <valleymj@xxx> wrote:
>
> If you look at the criteria for bar 1 and Bar5 in example 1, they 
are
> defined the same, leaving only the middle as a different criteria.
> Woundn't that be correct?
> So, the variable lengths would be from Green to Green in this 
example.  True
> or no?
> 
> _SECTION_BEGIN("Pattern Hunter v2");
> IndA= Ref(H,-1)-Ref(L,-1);
> IndB = EMA(IndA,14);
> Middle = IndA < IndB ;
> Plot(IndA,"Daily Range",5,1);
> Plot(IndB ,"Smooth Daily Range",6,1);
> Buynow = Cross(IndA, IndB);
> SellNow = Middle;
> Plot(10, /* defines the height of the ribbon in percent of pane 
width
> */"",IIf( BuyNow, colorGreen, IIf( SellNow, colorRed, 
colorRed)), /* choose
> color*/styleOwnScale|styleArea|styleNoLabel, -0.5, 100);
> _SECTION_END();
> 
>   -----Original Message-----
>   From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
On
> Behalf Of chorlton_c_hardy
>   Sent: Saturday, March 01, 2008 11:55 PM
>   To: amibroker@xxxxxxxxxxxxxxx
>   Subject: [amibroker] Re: Coding a pattern of variable length
> 
> 
> 
>   Hello Mr Valley,
> 
>   Firstly, Thanks for taking the time to help.
> 
>   The actual Buy Condition you posted "Buynow = Cross(IndA, IndB)"
>   would be correct and this would be the LAST bar in the pattern.
> 
>   However, to confirm the actual pattern, I would also need to 
confirm:
> 
>   1. When the first bar in the pattern appeared ie. The previous 
time
>   that IndA > IndB.
> 
>   2. that IndA < IndB occurred on ALL the bars between the first & 
last
>   bars,
> 
>   I'll give a couple of examples of what would be classed as a
>   confirmed pattern.
> 
>   Example 1:
> 
>   Bar 1 = IndA > IndB
>   Bar 2 = IndA < IndB
>   Bar 3 = IndA < IndB
>   Bar 4 = IndA < IndB
>   Bar 5 = IndA > IndB
> 
>   Pattern Length = 5
> 
>   Example 2:
> 
>   Bar 1 = IndA > IndB
>   Bar 2 = IndA < IndB
>   Bar 3 = IndA < IndB
>   Bar 4 = IndA < IndB
>   Bar 5 = IndA < IndB
>   Bar 6 = IndA < IndB
>   Bar 7 = IndA > IndB
> 
>   Pattern Length = 7
> 
>   Hopefully, this makes sense.
> 
>   I'll just like to add that all the above is just for the BUY
>   Condition. I don't want to worry about Sell Conditions at the 
moment
>   as I need to get my head round this first :-)
> 
>   Thanks,
> 
>   Chorlton
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "Mr. Valley" <valleymj@> wrote:
>   >
>   > Do you mean like this?
>   >
>   > IndA= Ref(H,-1)-Ref(L,-1);
>   > IndB = EMA(IndA,14 );
>   > Middle = IndA < IndB ;
>   > Plot(IndA,"Daily Range",5,1);
>   > Plot(IndB ,"Smooth Daily Range",6,1);
>   > Buynow = Cross(IndA, IndB);
>   > SellNow = Middle;
>   > Plot(10, /* defines the height of the ribbon in percent of pane
>   width
>   > */"",IIf( BuyNow, colorGreen, IIf( SellNow, colorRed,
>   colorLightgrey )), /*
>   > choose color*/styleOwnScale|styleArea|styleNoLabel, -0.5, 100);
>   >
>   >
>   >
>   > -----Original Message-----
>   > From: amibroker@xxxxxxxxxxxxxxx 
[mailto:amibroker@xxxxxxxxxxxxxxx]
>   On
>   > Behalf Of chorlton_c_hardy
>   > Sent: Saturday, March 01, 2008 10:08 PM
>   > To: amibroker@xxxxxxxxxxxxxxx
>   > Subject: [amibroker] Re: Coding a pattern of variable length
>   >
>   >
>   > Of course, no worries.
>   >
>   > Ind_A = Daily Range of an individual Bar (diff between High & 
Low)
>   >
>   > Ind_B = Smoothed version of the above
>   >
>   > In this example I want to find patterns where:
>   >
>   > 1. on first bar & last bar of pattern the Daily Range (Ind_A) is
>   > greater than the Smoothed Daily Range (Ind_B). [Increased
>   Volatility]
>   > 2. Each of the middle bars in pattern have a reduced Daily 
Range.
>   > Ind_A < Ind_B [Reduced Volatility]
>   >
>   > However, I also have some other ideas which are similar but rely
>   on
>   > different indicators so hence my wording in my original 
question.
>   >
>   > Basically, to allow me to use this code as a template for my 
other
>   > ideas, I'm trying to code:
>   >
>   > 1. First & Last bars in Pattern = Indicator_A > Indicator_B
>   > 2. Each of the middle bars in Pattern = Indicator_A < 
Indicator_B
>   >
>   > Hopefully, the above makes sense.
>   >
>   > Thanks again for your help with this one....
>   >
>   > regards,
>   >
>   > Chorlton
>   >
>   > --- In amibroker@xxxxxxxxxxxxxxx, "Mr. Valley" <valleymj@> 
wrote:
>   > >
>   > > Please explain what IndA and IndB are as it would make it much
>   > easier to
>   > > determine what you are trying to accomplish?
>   > > Example?
>   > >
>   > > -----Original Message-----
>   > > From: amibroker@xxxxxxxxxxxxxxx
>   [mailto:amibroker@xxxxxxxxxxxxxxx]
>   > On
>   > > Behalf Of chorlton_c_hardy
>   > > Sent: Saturday, March 01, 2008 9:35 PM
>   > > To: amibroker@xxxxxxxxxxxxxxx
>   > > Subject: [amibroker] Re: Coding a pattern of variable length
>   > >
>   > >
>   > >
>   > > Hi Mr Valley,
>   > >
>   > > Thanks for the reply & the code.
>   > >
>   > > Would it be possible for you to explain a few things though as
>   my
>   > > coding knowledge is pretty basic?
>   > >
>   > > 1. I think your code assumes a pattern length of 5 which in
>   > reality I
>   > > wouldn't know in advance.
>   > >
>   > > 2. Can you explain Cond1. I think its saying that Close has to
>   > cross
>   > > above the average Closing Price over the last 5 periods. Sorry
>   but
>   > > I'm not sure what this achieving. Could you clarify please?
>   > >
>   > > 3. How does one confirm that the middle condition will be
>   > inbetween
>   > > the first and last bars? According to the Pattern Condition,
>   all 3
>   > > conditions Cond1, Cond2 and Middle just have to be TRUE. The
>   order
>   > > they appear in doesn't seem controlled to me unless I am
>   > > misunderstanding something.
>   > >
>   > > Any help much appreciated,
>   > >
>   > > Kind regards,
>   > >
>   > > --- In amibroker@xxxxxxxxxxxxxxx, "Mr. Valley" <valleymj@>
>   wrote:
>   > > >
>   > > > Something Like this?
>   > > >
>   > > > IndA= Close;
>   > > >
>   > > > IndB = MA(Ref(C,-5),5);
>   > > >
>   > > > Middle = Close < MA(C,34);
>   > > >
>   > > > Cond1 = Cross(IndA,IndB);
>   > > >
>   > > > Cond2 = Cross(IndA,IndB);
>   > > >
>   > > > Cond3 = Middle ;
>   > > >
>   > > > Pattern = Cond1 AND Cond2 AND Cond3;
>   > > >
>   > > > Plot(Close,"Close",1,64);
>   > > >
>   > > > Plot(Pattern,"Pattern Hunter v1",6,2 | styleOwnScale);
>   > > >
>   > > >
>   > > >
>   > > > -----Original Message-----
>   > > > From: amibroker@xxxxxxxxxxxxxxx
>   > [mailto:amibroker@xxxxxxxxxxxxxxx]
>   > > On
>   > > > Behalf Of chorlton_c_hardy
>   > > > Sent: Saturday, March 01, 2008 8:42 PM
>   > > > To: amibroker@xxxxxxxxxxxxxxx
>   > > > Subject: [amibroker] Re: Coding a pattern of variable length
>   > > >
>   > > >
>   > > > Hi again,
>   > > >
>   > > > In addition to my original question, I will need to add
>   further
>   > > > conditions which will allow me to assess each of the various
>   > bars
>   > > of
>   > > > the complete pattern
>   > > >
>   > > > eg. If the pattern consisted of 5 bars in total, then I need
>   the
>   > > > flexibility to assess each of the bars (bar1, bar2, etc)
>   > > individually
>   > > > & make comparisons between them. ie. Bar5's Close > Bar1's
>   > Close,
>   > > > etc, etc.
>   > > >
>   > > > Would this be easy to do in relation to my original 
question??
>   > > >
>   > > > Thanks in advance,
>   > > >
>   > > > Chorlton
>   > > >
>   > > > --- In amibroker@xxxxxxxxxxxxxxx, "chorlton_c_hardy"
>   <chorlton-
>   > c-
>   > > > hardy@> wrote:
>   > > > >
>   > > > > Hello All,
>   > > > >
>   > > > > Can anyone offer some help regarding a coding problem, 
which
>   > I'm
>   > > > having?
>   > > > >
>   > > > > Basically I want to search for a "pattern" which consists
>   of:
>   > > > >
>   > > > > 1. On the First & Last Bars of the pattern, "Indicator A" 
is
>   > > > > ABOVE "Indicator B"
>   > > > >
>   > > > > 2. On ALL the bars in the middle of the 
pattern, "Indicator
>   A"
>   > > is
>   > > > > BELOW "Indicator B"
>   > > > >
>   > > > > What makes this difficult (well for me anyway) is that the
>   > > number
>   > > > of
>   > > > > bars in the middle can vary. If the pattern consisted of a
>   > > specific
>   > > > > number of bars, then it would be easy, but with this
>   > variation,
>   > > I'm
>   > > > > intially stumped.
>   > > > >
>   > > > > Consequently, is it possible for someone to point me in 
the
>   > > right
>   > > > > direction of how to begin coding this please?
>   > > > >
>   > > > > Many Thanks,
>   > > > >
>   > > > > Chorlton
>   > > > >
>   > > >
>   > >
>   >
>




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/