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

RE: [amibroker] Re: Finding points between points



PureBytes Links

Trading Reference Links

Ace, I want information processed from these points, finding the points is
just a first step.

I think I have that boolean bit already in the loop, and finding simple
low-high-low is easy enough and would halve the code I sent, but it excludes
any second significant point that comes along. In the chart I sent the
second high would be lost which is a significant move

I have done it in straight AFL but it becomes cumbersome and limited in its
use further down my track with it. What I have shown is just the first part,
I go onto medium and minor price moves as well that require the same type of
formula. I was hoping for a shorter solution than using base AFL.


Cheers,
Graham
http://groups.msn.com/asxsharetrading
http://groups.msn.com/fmsaustralia 

-----Original Message-----
From: acesheet [mailto:acesheet@xxxxxxxxx] 
Sent: Friday, 19 December 2003 1:20 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Finding points between points


Graham,

Could you try something like a simple boolean variable that changes 
from 1 to 0 (not an array) to let you know if what you found is the 
next low or the next high you are looking for? You could then add it 
as a status condition in your searching routines. In other words 
when searching for a low after a high has been found and then 
another high is found keep storing the latest high until a low comes 
along and switches the boolean to 0 (assuming it was 1 when a high 
was found).

That may help.

-ace

--- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> I am pulling whats left of my hair on this one
> I want to find the turning points for major price moves and make
certain
> that each point is alternating between high then low. If a new
high is found
> before a low TP and is higher than the previous high, it becomes
the new
> high TP. (similar for the lows). BUT I then want to insert a low
(or high)
> between the concurrent highs but cannot seem to get it. (the
alternative
> would be to remove the first TP and keep the next one)
> In words just using the highs as example, find the Highest high
for a period
> of time, then search for the next lowest low, but if higher high
is found
> before the next lowest low, then it is kept (lower highs are
rejected before
> a low is found).
> 
> Can someone please help, here is the code I have so far for
plotting. The
> answer is probably so easy, but I feel like a first time novice
not seeing
> the forest for the trees.
> 
> 
> //BASE CALCULATION OF TURN POINTS Plot(C,"",colorBlack,styleBar);
> 
> //Assign H & L for zero volume Bars as = Last Bar with H not= L H = 
> IIf( V==0 AND GroupID()!= 1, ValueWhen( V > 0, H ), H ); L = IIf( V==0 
> AND GroupID()!= 1, ValueWhen( V > 0, L ), L );
> 
> //MAJOR TRENDS
> 
> //Set the intitial values for looping
> MajorTop = Null;
> MajorBottom = Null;
> LastMajorTop = 0;
> MajorResLevel = Null;
> MajorSupLevel = Null;
> MajorBotBar = Null;
> MajorBotBar = Null;
> //look backward & forward bars for trends
> MajorM = Param("M",10,5,20,1);
> MajorN = Param("N",50,30,80,5);
> 
> //DEFINE THE BACKWARD & FORWARD REQUIREMENTS
> MajorHigh =
> H == Ref( HHV( H, ( 2 * MajorM ) + 1 ), MajorM ) AND
> H > Ref( HHV( H, MajorN ), -MajorM-1 ) AND
> H > Ref( HHV( H, MajorN ), MajorM + MajorN );
> 
> MajorLow =
> L == Ref( LLV( L, ( 2 * MajorM ) + 1 ), MajorM ) AND
> L < Ref( LLV( L, MajorN ), - MajorM-1 ) AND
> L < Ref( LLV( L, MajorN ), MajorM + MajorN );
> 
> //Loop to find MajorTops and MajorBottoms, plus price values of
MajorTops &
> MajorBottoms
> for( i=1; i<BarCount-1; i++ )
> {
>  if( MajorHigh[i] && LastMajorTop[i-1]==0 )
>  {
>   MajorTop[i] = 1;
>   MajorResLevel[i] = H[i];
>   LastMajorTop[i] = 1;
>   MajorTopBar[i] = i;
>   MajorSupLevel[i] = MajorSupLevel[i-1];
>  }
>  else
>  {
>   if( MajorHigh[i] && LastMajorTop[i-1]==1 && H[i]>MajorResLevel[i-
1] )
>   {
>    MajorTop[i] = 1;
>    MajorResLevel[i] = H[i];
>    LastMajorTop[i] = 1;
>    MajorTopBar[i] = i;
>    MajorSupLevel[i] = MajorSupLevel[i-1];
>   }
>   else
>   {
>    if( MajorLow[i] && LastMajorTop[i-1]==1 )
>    {
>     MajorBottom[i] = 1;
>     MajorSupLevel[i] = L[i];
>     LastMajorTop[i] = 0;
>     MajorBotBar[i] = i;
>     MajorResLevel[i] = MajorResLevel[i-1];
>    }
>    else
>    {
>     if( MajorLow[i] && LastMajorTop[i-1]==0  && L[i]<MajorSupLevel
[i-1] )
>     {
>      MajorBottom[i] = 1;
>      MajorSupLevel[i] = L[i];
>      LastMajorTop[i] = 0;
>      MajorBotBar[i] = i;
>      MajorResLevel[i] = MajorResLevel[i-1];
>     }
>     else
>     {
>      MajorSupLevel[i] = MajorSupLevel[i-1];
>      MajorResLevel[i] = MajorResLevel[i-1];
>      LastMajorTop[i] = LastMajorTop[i-1];
>     }
>    }
>   }
>  }
> }
> GraphXSpace = 5;
> 
> PlotShapes( MajorBottom * shapeStar, colorGreen, 0, L, 0 ); 
> PlotShapes( MajorTop * shapeStar, colorSeaGreen, 0, H, 0 );
> 
> Plot( MajorSupLevel, "MajorSupTP Level", colorSeaGreen,
> styleNoLine|styleDots );
> Plot( MajorResLevel, "MajorResTP Level", colorBrown,
styleNoLine|styleDots
> );
> 
> 
> Cheers,
> Graham
> http://groups.msn.com/asxsharetrading
> http://groups.msn.com/fmsaustralia


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Yahoo! Groups Links

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

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/ 


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Yahoo! Groups Links

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

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/