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

Re: [amibroker] RUTVOL conversion



PureBytes Links

Trading Reference Links

You will find  some of what you are looking for in
http://groups.yahoo.com/group/amibroker/files/Assorted%20AFL%20Scripts%20.zi
p

Regards
Don

----- Original Message -----
From: "barrykilzer" <kilzer@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, September 03, 2003 7:47 AM
Subject: [amibroker] RUTVOL conversion


> Hi...I am posting the TRADE version of RUTVOL that Fasttrackers use
> in hopes someone will convert it to AFL.  Salil?  I am also including
> the AFL of RUTTR which is the first part of RUTVOL.  Any help in the
> conversion is greatly appreciated.
>
> Thanks
>
>
> RUTVOL
>
> ____________________________________
>
> ;rutvol.ini (revised)
> ;by Werner Gansz, 11/27/2001
>
> [Expression]
>
> ;$tvol = Edit($tvol, 9/10/10, 1306 * 1e6)
> ;tvolq = Edit(tvolq, 9/10/10, 1643 * 1e6)
> ;$uvol = Edit($uvol, 9/10/10, 681 * 1e6)
> ;$dvol = Edit($dvol, 9/10/10, 601 * 1e6)
> ;uvolq = Edit(uvolq, 9/10/10, 751 * 1e6)
> ;dvolq = Edit(dvolq, 9/10/10, 868 * 1e6)
>
> Print($tvol, "NY TVol", $uvol, "NY UVol", $dvol, "NY DVol",
>       tvolq, "NS TVol", uvolq, "NS Uvol", dvolq, "NS Dvol")
>
> nsvolema = Ema(tvolq, 60)
> nsuvolema = Ema(uvolq, 120)
> nsdvolema = Ema(dvolq, 120)
> WriteFile(nsvolema, NSVol, "Nasdaq 60d Ema of Total Volume")
> WriteFile(nsvolema, NSUvl, "Nasdaq 120d Ema of Up Volume")
> WriteFile(nsdvolema, NSDvl, "Nasdaq 120d Ema of Dn Volume")
>
> ;NYSE volume data for FR charts
> nyvolema = Ema($tvol, 60)
> nyuvolema = Ema($uvol, 120)
> nydvolema = Ema($dvol, 120)
> WriteFile(nyvolema, NYVol, "NYSE 60d Ema of Total Volume")
> WriteFile(nyuvolema, NYUvl, "NYSE 120d Ema of Up Volume")
> WriteFile(nydvolema, NYDvl, "NYSE 120d Ema of Dn Volume")
>
> updnrs = Accu(nsuvolema, nsdvolema, 11, 44)
>
> ;Volume
>
> ;Stochastic Chart Data
> Average = 41
> Smooth =  10
> Trigger =  8
>
> ;S-Chart
> ;%K calculation
> Kstoch = 100 * (nsvolema - Min(nsvolema, Average)) /
>          (Max(nsvolema, Average) - Min(nsvolema, Average))
>
> ;%D calculation
> Dstoch = Ema(Kstoch, Smooth)
> WriteFile(dstoch, Dstoc)
>
> ;Signal Line
> signalline = Ema(Dstoch, Trigger)
>
> ;VolumeStoch.Buy = Signal(dstoch - 50) Or Signal(dstoch - 20)
>                   ;Or Signal(updnrs)
> ;VolumeStoch.Sell = Signal(dstoch - 50) Or Signal(dstoch - 80)
>
> VolumeStoch.Buy = Signal(dstoch - 80) Or Signal(dstoch - 20)
>                   Or Signal(updnrs)
> VolumeStoch.Sell = Signal(dstoch - 20) Or Signal(dstoch - 80)
>
> WriteFile(VolumeStoch, VolStoch)
>
>
> volcombo.Buy = Ruttr And VolumeStoch
> volcombo.Sell = Ruttr Or VolumeStoch
> WriteFile(volcombo, RutVol, "Ruttr Conservative combo with Volume")
>
> ;Testing
> testfam = Family(rut-i, dfscx, ndx-x, pse-x)
>
> Print("All funds and indexes below cover the complete FT database")
>
> ruttrperf = SignalPairTrade(testfam, fdrxx, ruttr)
> rutvolperf = SignalPairTrade(testfam, fdrxx, rutvol)
>
> mdays = Last(Sum(ruttrperf - ruttrperf + 1))
> onbuy = mdays * Sma(.5 + Sgn(ruttrperf * Vector(ruttr)), mdays)
> risk = onbuy / mdays
> sy = (Sum(.5 - Sgn(Days(ruttr) - .00001)) / 2) / (mdays / 252)
>
> sdf = Stdev(Roc(ruttrperf, 1), mdays) * Pow(21.15, .5) * Pow
> (1/risk, .5)
>
> prod = Pow(10, Log(Last(ruttrperf)/First(ruttrperf))/
> (Last(onbuy)/253.8)) - 1
>
> ;prior peak values of fund
> peak = Max(ruttrperf, mdays)
>
> ;current drawdown
> cdd = (peak - ruttrperf)/peak
>
> ;Compute Mdd
> mdd = Last(Max(cdd, mdays))
>
> Print(ruttr, "RUTTR performance for small cap and tech indices")
> FamPrint(100 * prod, "Prdtvty",
>         100 * sdf, "StDev", 100 * mdd, "Mdd", 100 * risk, "%Risk",
> sy, "S/Y")
>
> mdays = Last(Sum(rutvolperf - rutvolperf + 1))
> onbuy = mdays * Sma(.5 + Sgn(rutvolperf * Vector(rutvol)), mdays)
> risk = onbuy / mdays
> sy = (Sum(.5 - Sgn(Days(rutvol) - .00001)) / 2) / (mdays / 252)
>
> sdf = Stdev(Roc(rutvolperf, 1), mdays) * Pow(21.15, .5) * Pow
> (1/risk, .5)
>
> prod = Pow(10, Log(Last(rutvolperf)/First(rutvolperf))/
> (Last(onbuy)/253.8)) - 1
>
> ;prior peak values of fund
> peak = Max(rutvolperf, mdays)
>
> ;current drawdown
> cdd = (peak - rutvolperf)/peak
>
> ;Compute Mdd
> mdd = Last(Max(cdd, mdays))
>
> Print(rutvol, "Ruttr/Volume combo performance for small cap and tech
> indices")
> FamPrint(100 * prod, "Prdtvty",
>         100 * sdf, "StDev", 100 * mdd, "Mdd", 100 * risk, "%Risk",
> sy, "S/Y")
>
> _____________________________________________
>
> RUTTR in AFL
>
> _____________________________________________
>
> /* Filename: Funds_Ruttr Full */
> Rt=Foreign("RUT-I","C");
> Av=Optimize("Av",53,70,80,2);
> Ksto=100*(Rt-LLV(Rt,Av))/(HHV(Rt,Av)-LLV(Rt,Av));
> Dsto=EMA(Ksto,Optimize("Dsto",49,58,63,2));
> Sig=EMA(Dsto,Optimize("Sig",28,6,20,5));
> HisD=Dsto-Sig;
> V1=Optimize("V1",45,40,55,5);
> V2=Optimize("V2",90,65,90,5);
> RutMACD=EMA(Rt,V1)-EMA(Rt,V2);
> V3=Optimize("V3",8,6,10,2);
> SigMACD=EMA(RutMACD, V3);
> HisM=RutMACD-SigMACD;
> Plot(HisM,"",2,2);
> Title = "RUT-I MACD and RTTR Signal (Red and Green)";
> Buy=HisD>0 AND HisM>0;
> Sell=HisD<0 AND HisM<0;
> Plot(2*Buy,"",5,1);
> Plot(-4*Sell,"",4,1);
>
> PlotShapes(IIf(Buy,shapeUpArrow,shapeNone) ,colorBrightGreen);
> PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed);
>
>
>
>
> 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/
>
>
>


------------------------ 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/l.m7sD/LIdGAA/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/