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

[amibroker] Re: TS Code Help



PureBytes Links

Trading Reference Links

Ed,

Here is the complete TS code:

{Ergodic Indicator:}

{from William Blau's book --- "Momentum, Direction and Divergence"
FORMAT: Ergodic_TSI(Price, r, s, u,, SmthLen)
 where r = length of first EMA smoothing of 1 day momentum,
    s = length of second EMA smoothing of 1 day smooting,
   u = length of third EMA smooting of 1 daymomentum,
   SmthLen = length of ema signal line.

This is plotting the Average only (value2)}


Inputs: Price(c), r(7),  s(27), u(1), Zeroline(0), SmthLen(7),
upcolor_1(green), downcolor_1(red), dotsize(2);

Value1 = TSI(Price, r, s, u);

Value2 = XAverage(TSI(Price, r, s, u), SmthLen);

If value2 > value2[1] then
Plot3(Value2, "SigLin",  upcolor_1,  default,  dotsize);

If value2 < value2[1] then
Plot3(Value2, "SigLin",  downcolor_1,  default,  dotsize);

=====================================================================

{TSI function = True Strength Index by Bill Blau}

{FORMAT: TSI(Price,r,s,u)
 Where: r = length of first EMA smoothing of 1 day momentum,
    s = length of second EMA smoothing of 1 day smooting,
   u = length of third EMA smooting of 1 daymomentum.}

Inputs:    Price(NumericSeries), r(NumericSimple), s(NumericSimple),
               u(NumericSimple);

Value1= 100*TXAverage(Price-Price[1],r,s,u) ;  { Numerator }

Value2=TXAverage(AbsValue(Price-Price[1]),r,s,u) ;   { Denominator }

If Value2 <> 0 then TSI = Value1 / Value2

Else TSI = 0;
========================================================

{TXAverage function

FORMAT: TXAverage(Price,r,s,u) }

Inputs: Price(NumericSeries), r(NumericSimple),s(NumericSimple),
            u(NumericSimple);

TXAverage = XAverage(XAverage(XAverage(Price,r),s),u) ;
===============================================
{ XAverage Function   (Exponential average) }

inputs:
 Price( numericseries ),
 Length( numericsimple ) ; { this input assumed to be a constant >= 
1 }

variables:
 SmoothingFactor( 2 / ( Length + 1 ) ) ;

if CurrentBar = 1 then
 XAverage = Price
else
 XAverage = XAverage[1] + SmoothingFactor * ( Price - XAverage[1] ) ;

xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

MTM:=C-Ref(C,-1);
A1:=100*(Mov(Mov(MTM,5,E),60,E)/ Mov(Mov(Abs(MTM),5,E),60,E));
A1;

--- In amibroker@xxxxxxxxxxxxxxx, "E Winters" <e.winters1@xxxx> wrote:
> John,
> Smithlen is most likely a variable defined at the beginning of the 
TS code
> since the XAverage length would go where Smithlen is. Look 
for "Vars:" or
> "Input:" at the beginning of your code.  The same applies to r, s, 
and u.
> They are parameters which are passed to the TSI function in 
Tradestation.
> In order to identify what they are used for you would have to look 
at the
> code for TSI itself.  If you have Tradestation, open the 
Powereditor and
> look for the TSI code.  From there you should be able to identify 
what the
> parameters represent.
> Regards,
> Ed
> ----- Original Message -----
> From: "John" <jea55129@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Friday, December 05, 2003 6:33 AM
> Subject: [amibroker] TS Code Help
> 
> 
> | Group,
> |
> | I am translating a TS code and am having problems on these two 
lines.
> | 1) Value2 = XAverage(TSI(Price, r, s, u), SmthLen);
> | Question. What is SmthLen. I cannot find it in TS manual. I know 
how
> | to code XAverage,TSI and Price but what about the r,s and u? They 
are
> | numbers 7,27 and 1. Any ideas?
> |
> | 2)If Value2 <> 0 then TSI = Value1 / Value2. I cannot use <> in an
> | iif. Any ideas? Maybe 2 iif's?
> |
> | Thanks
> |
> | John
> |
> |
> |
> | Send BUG REPORTS to bugs@xxxx
> | Send SUGGESTIONS to suggest@xxxx
> | -----------------------------------------
> | 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 
http://docs.yahoo.com/info/terms/
> |
> |


------------------------ 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
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/