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

[amibroker] Re: Darvas Box



PureBytes Links

Trading Reference Links




Does anyone in the group have expertise in 
Tradestation and EasyLanguage as well as AFL?
I am trying to duplicate the Tradestation Keltner 
channel in Amibroker and have had no success so far. The Keltner Channel in the 
formula library does not duplicate the Tradestation Keltner Channel. I have 
written custom indicators for Amibroker based on the Tradestation webpage 
definition and explanation of the Keltner Channel and Average True Range. I 
suspect that Tradestation uses a SMA method to smooth the ATR unlike the 
Amibroker version.
These are the parameters from the Tradestation 
website for the Keltner Channel:
 
Input Information


  
  
    
      Name
    
      Expression
    
      Default
    
      Description
  
    
      Price
    
      <A 
       
      href="'numeric_expression.htm');">Numeric
    
      Close
    
      Price used to calculate the midline.
  
    
      Length
    
      Numeric
    
      20
    
      Length used to calculate the midline.
  
    
      Factor
    
      Numeric
    
      1.5
    
      Factor applied to the average true range used to determine the Keltner 
      Channel bands.
  
    
      Displace
    
      Numeric
    
      0
    
      The number of bars to displace the plot of the Keltner Channel 
      bands.
 
The midline is the key. I assumed it's 
default is a 20 period sma of the ATR.
 
Their parameters for the ATR are:
 

In his book, New Concepts in Technical 
Trading Systems, Welles Wilder, Jr. uses a value known as true range in 
his directional movement calculations. He defines true range as the larger of 
the following: 
<FONT 
>·<SPAN 
>      The 
distance between today's <FONT 
>High and today's <FONT 
>Low.
<FONT 
>·<SPAN 
>      The 
distance between today's <FONT 
>High and yesterday's 
Close.
<FONT 
>·<SPAN 
>      The 
distance between today's <FONT 
>Low and yesterday's <FONT 
>Close.
AvgTrueRange 
is simply an average of the True Range values over a period of time. For more 
information, see <A 
href="">TrueRange.
Function
<FONT 
>AvgTrueRange(Length)
Parameters

  
  
    
      Length
    
      Number of bars in the average.
Returns
A numeric value containing the average of the true range over <FONT 
>Length bars.
Usage
The <FONT 
>AvgTrueRange tends to 
smooth out price bars of higher or lower than average volatility.
 
 
With this in mind I wrote the following indicator to add to the price window 
in Amibroker using my inputs of 8 periods and a 1.3 factor(which doesn't 
duplicate the Tradestation result using those same inputs): 
RangeH=<FONT 
color=#0000ff>IIf(((H+L)/<FONT 
color=#ff00ff>2)>((H+<FONT 
color=#0000ff>Ref(C,-1))/<FONT 
color=#ff00ff>2),(H+L)/<FONT 
color=#ff00ff>2,(H+Ref(C,-<FONT 
color=#ff00ff>1))/2);
Range=IIf(RangeH>(L+<FONT 
color=#0000ff>Ref(C,-1))/<FONT 
color=#ff00ff>2,RangeH,(L+<FONT 
color=#0000ff>Ref(C,-1))/<FONT 
color=#ff00ff>2);
TruHi=IIf(H><FONT 
color=#0000ff>Ref(C,-1),H,<FONT 
color=#0000ff>Ref(C,-1));
TruLo=IIf(L<<FONT 
color=#0000ff>Ref(C,-1),L,<FONT 
color=#0000ff>Ref(C,-1));
AvTR=MA(C,<FONT 
color=#ff00ff>8);
MABand=(MA((TruHi-TruLo),<FONT 
color=#ff00ff>8)*1.3);
UBand=AvTR+MABand;
LBand=AvTR-MABand;
Plot(AvTR,"AvTR",<FONT 
color=#ff00ff>1,1);
Plot(UBand,"UBand",<FONT 
color=#ff00ff>1,1);
Plot(LBand,"LBand",<FONT 
color=#ff00ff>1,1); 
I don't own Tradestation, so their website is the 
only resource I have for them.
If anyone has any insight to my problem I would 
greatly appreciate any help. 
 
 
Dan


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 the Yahoo! Terms of Service.