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

Re: [AmiBroker] Re: Z Score ?



PureBytes Links

Trading Reference Links




Mr. Valley:
 
It appears you are asking 2 different questions that are somewhat 
related but not used in the same way: first, the Z-score as an entry filter and 
a 3*ATR trailing stop in a Tharp position size statement. First, regarding the 
Tharp positionsize statement, here is how you would combine a max stoploss, a 
trailing profit target stop (chandelier exit), and a positionsize 
statement:
 
Cstop = optimize(Cstop, 3,1,4,0.5); //the ATR multiplier
ApplyStop(0,2,Cstop*ATR(10),True, False); //if Cstop is 3, this would be a 
3*ATR stoploss calculated from the entryprice
PositionSize = iif(Buy, -1 * BuyPrice/(Cstop*ATR(10)), -1 * 
ShortPrice/(Cstop*ATR(10))); //for going long or short
ApplyStop(2,2,3*ATR(10),True, True); //this will exit you at 3*ATR below 
the highest high since the trade was initiated (or lowest low on the short 
side). 
 
The Z-score, which you defined as Zscore = (C - 
ref(C,-x))/stdev(C,x) sounds like it is very similar in principle to 
Tharp's Efficiency Index, which is defined as EI = (C - ref(C,-x)/ATR(x). I 
think the way you would use it would be as a boolean Buy (or Short) qualifier. 
In other words, something like this:
 
Buy = <your normal buy rules> AND Zscore > y; // or
Buy = <your normal buy rules> AND EI > y; //where y is an 
optimizable variable. 
 
What this says is that you buy when the Zscore or Efficiency Index is 
greater than some scalar defined from an optimization. An efficient stock is a 
stock whose price movements are high relative to its volatility changes (i.e., 
the price change is high but the volatility change is minor). So, if a stock 
increases by 3 points while its volatility only increases a little, that's good 
because it gives you greater profitability at a given volatility. Examining the 
formulas above, the positionsize is determined by the stock's underlying 
volatility. If a stock has a low volatility, you would buy more of it than 
another stock whose volatiltiy is higher. If its price increases without a 
significant move in volatility, it is said to be efficient in regards to the 
changes. If you have a stop and reverse type system, you would re-enter on the 
short side at a higher price and at similar volatility as when you bought it. 

 
Hope this makes sense.
 
Al Venosa
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Mr Valley 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Monday, December 08, 2003 10:01 
  AM
  Subject: RE: [AmiBroker] Re: Z Score 
  ?
  
  <FONT face=Arial color=#0000ff 
  size=2>Howard,
  <FONT face=Arial color=#0000ff 
  size=2> 
  I 
  was thinking of using it on the entry side.
  <FONT face=Arial color=#0000ff 
  size=2> 
  I'm 
  trying to figure out them implementation of it.
  <FONT face=Arial color=#0000ff 
  size=2> 
  1% 
  risk per position
  3 * 
  ATR trailing exit stop
  <FONT face=Arial color=#0000ff 
  size=2> 
  To 
  implement on Stocks and futures
  <FONT face=Arial color=#0000ff 
  size=2>Thanks,
  <FONT face=Arial color=#0000ff 
  size=2>Marc
  
    <FONT face=Tahoma 
    size=2>-----Original Message-----From: Howard Bandy 
    [mailto:howardbandy@xxxxxxxxx]Sent: Monday, December 08, 2003 
    7:10 AMTo: <A 
    href="">amibroker@xxxxxxxxxxxxxxxSubject: 
    RE: [amibroker] Re: Z Score ?
    
    <SPAN 
    >Hi Mr Valley 
    –
    <SPAN 
    > 
    <SPAN 
    >I do use ZScore in 
    a lot of my systems.  Do you have a specific Tharp idea in 
    mind?
    <SPAN 
    > 
    <SPAN 
    >Howard
    <SPAN 
    > 
    <DIV 
    >
    <SPAN 
    >-----Original 
    Message-----From: Mr 
    Valley [mailto:valleymj@xxxxxxxxxxx] <SPAN 
    >Sent: Sunday, December 07, 2003 9:50 
    AMTo: 
    amibroker@xxxxxxxxxxxxxxx<SPAN 
    >Subject: RE: [amibroker] Re: Z Score 
    ?
    <SPAN 
    > 
    
    <SPAN 
    >Thank 
    you.
    
    <SPAN 
    > 
    
    <SPAN 
    >Has anyone done 
    anything extensive with say, combining Tharp, with Z 
    Score?
    
    <SPAN 
    > 
    
    <SPAN 
    >Mr 
    Valley
    
      <FONT face=Tahoma 
      size=2>-----Original 
      Message-----From: 
      the_chairmann [mailto:jhart_1972@xxxxxxxxx]<SPAN 
      >Sent: Sunday, December 07, 2003 7:17 
      AMTo: 
      amibroker@xxxxxxxxxxxxxxx<SPAN 
      >Subject: [amibroker] Re: Z Score 
      ?
      <SPAN 
      >Here's the indicator 
      formula:<SPAN 
      ><FONT 
      face="Courier New">periods=20;<FONT 
      face="Courier New">ZScore=(Close-MA(Close,20))/StDev(Close,20);<FONT 
      face="Courier New">Plot (MA(ZScore,3), "Z-Score 3 Day 
      MA",6,4);Plot 
      (MA(MA(ZScore,3),5), "5 Day MA Z-Score 
      MA",5,4);--- In 
      amibroker@xxxxxxxxxxxxxxx, "Mr Valley" <valleymj@xxxx> 
      wrote:> Has anyone coded Z 
      Score Transformation Exploration in .afl?<FONT 
      face="Courier New">> <FONT 
      face="Courier New">>              
      Score - Mean<FONT 
      face="Courier New">>      Z =  
      --------------------<FONT 
      face="Courier New">>            
      Std Deviation> 
      > 
      Thanks,> 
      > Mr. 
      Valley<FONT 
      face="Courier New" size=2>Send BUG REPORTS 
      to bugs@xxxxxxxxxxxxx<FONT face="Courier New" 
      size=2><SPAN 
      ><FONT 
      face="Courier New">Send SUGGESTIONS to 
      suggest@xxxxxxxxxxxxx<FONT 
      face="Courier New">-----------------------------------------<FONT 
      face="Courier New">Post AmiQuote-related messages ONLY to: 
      amiquote@xxxxxxxxxxxxxxx (Web 
      page: <A 
      href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
      face="Courier New">--------------------------------------------<FONT 
      face="Courier New">Check group FAQ at: <A 
      href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
      <SPAN 
      >Your use of Yahoo! Groups is subject to the <A 
      href="">Yahoo! Terms of 
      Service. 
    <SPAN 
    ><FONT 
    face="Courier New" size=2>Send BUG REPORTS to 
    bugs@xxxxxxxxxxxxx<SPAN 
    ><FONT 
    face="Courier New">Send SUGGESTIONS to 
    suggest@xxxxxxxxxxxxx<FONT 
    face="Courier New">-----------------------------------------<FONT 
    face="Courier New">Post AmiQuote-related messages ONLY to: 
    amiquote@xxxxxxxxxxxxxxx (Web 
    page: <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
    face="Courier New">--------------------------------------------<FONT 
    face="Courier New">Check group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    <SPAN 
    >Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of 
    Service. 
    Send BUG REPORTS to 
    bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
    suggest@xxxxxxxxxxxxx-----------------------------------------Post 
    AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
    <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
    group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
    
  Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 
  
<BLOCKQUOTE 
><FONT 
  face="Courier New">---Outgoing mail is certified Virus 
  Free.Checked by AVG anti-virus system (<A 
  href="">http://www.grisoft.com).Version: 6.0.543 
  / Virus Database: 337 - Release Date: 
11/21/2003






Yahoo! Groups Sponsor


  ADVERTISEMENT 









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



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.