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

[amibroker] Re: peak/trough with number of bars



PureBytes Links

Trading Reference Links

KK, 

try these functions that I developed:

//---------------------------------------------------------------
//-------------------- N Degree Swing High ----------------------
//---------------------------------------------------------------
// The 'degree' of a swing high refers to the 
// number of lower/equal highs to both sides of the bar 
// being analyzed. As an example if n=2 then there are
// 2 lower or equal highs prior to the analyzed bar and
// 2 lower or equal highs to the right of the bar
//---------------------------------------------------------------
function SwingHigh(n)
{
// Degree of SH set
// --------------------------------------------------
// Peak points (SH's)
  pk=Ref(HHV(H,2*n+1)==Ref(H,-n),n);
// --------------------------------------------------
// SH envelope values
  sh1=IIf(pk,H,Null);
  sh=Ref(HighestSince(pk,sh1,1),-n-1);
  return sh;
}
//---------------------------------------------------------------
//-------------------- N Degree Swing Low ----------------------
//---------------------------------------------------------------
//---------------------------------------------------------------
// The 'degree' of a swing low refers to the 
// number of higher/equal lows to both sides of the bar 
// being analyzed. As an example if n=2 then there are
// 2 higher or equal lows prior to the analyzed bar and
// 2 higher or equal lows to the right of the bar
//---------------------------------------------------------------
function SwingLow(m)
{
// Degree of SL set
// --------------------------------------------------
// Trough points (SL's)
  tr=Ref(LLV(L,2*m+1)==Ref(L,-m),m);
// --------------------------------------------------
// SH and SL envelope values
  sl1=IIf(tr,L,Null);
  sl=Ref(HighestSince(tr,sl1,1),-m-1);
  return sl;
}

These work quite well.

-ace

--- In amibroker@xxxxxxxxxxxxxxx, "kk2628" <kk2628@xxxx> wrote:
> Hi,
> 
> I have tried to use the peak and trough function to do some wave 
analysis but I encounter some problems due to the sudden surge at 
certain time. I thought it will be nice if these two functions can 
incorporate the count bars as one of the parameter e.g. peak(array, 
change, barcount,n=1). It will be even better if the change 
parameter can be use as point as well as percentage. TJ, can this to 
be included in the wish list please.
> 
> tks
> KK




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/