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

[amibroker] Re: The Janus Factor



PureBytes Links

Trading Reference Links


Scott, I re-read Gary's article and still think it's a great piece.  
I just altered the code a bit, more universal and readable. Discard 
the first code. Please read on below the code.   

/* code start */

// ATC Scan, use filter Market/Group/Watchlist BENCHMARK'S UNIVERSE 
components

// otr = off. target's return 
// dtr = def. target's return 
// obr = off. benchmark's return 
// dbr = def. benchmark's return 
// os = off. strength
// ds = def. strength
// cumos = cumulative off. strength
// cumds = cumulative def. strength

period = 100;  // Set lookback period
benchmark = "QQQ";  // Set benchmark

Buy = Sell = Cover = Short = 0;

x = Foreign(benchmark,"C");

otr = IIf(x >= Ref(x,-1),ROC(C,1),0);
dtr = IIf(x < Ref(x,-1),ROC(C,1),0);

obr = IIf(x >= Ref(x,-1),ROC(x,1),0);
dbr = IIf(x < Ref(x,-1),ROC(x,1),0);

os = otr-obr;
ds = dtr-dbr;

cumos = Sum(os,period);
cumds = Sum(ds,period);

cumos_NE = IIf(cumos >= -cumds,cumos,0);
cumos_SW = IIf(cumos <= -cumds,cumos,0);
cumds_NE = IIf(cumos >= -cumds,cumds,0);
cumds_SW = IIf(cumos <= -cumds,cumds,0);

AddToComposite(cumos_NE,"~janus","O");
AddToComposite(cumos_SW,"~janus","H");
AddToComposite(cumds_NE,"~janus","L");
AddToComposite(cumds_SW,"~janus","C");
//AddToComposite(IIf(cumos >= -cumds,1,0),"~janus","V");
//AddToComposite(IIf(cumos <= -cumds,1,0),"~janus","I");

/* code end */


// Indicator Janus NorthEast

Plot(Foreign("~janus","O"),"Off.Strength_NE",colorGreen);
Plot(Foreign("~janus","L"),"Def.Strength_NE",colorTurquoise);
Plot(0,"",colorBlack); 


// Indicator Janus SouthWest

Plot(Foreign("~janus","H"),"Off.Strength_SW",colorRed);
Plot(Foreign("~janus","C"),"Def.Strength_SW",colorLightOrange);
Plot(0,"",colorBlack);

------

I remember having difficulty with Gary's scoring system, in 
particular when he writes that he divides a benchmark's return into a 
target's return. If the benchmark is up 1% and a target is up 2% that 
results in a score of 2, so far so good. But should a target be down -
2% then the score would be -2, while the relative performance of this 
target is obviously far worse. By instead subtracting the ROC's I 
tried to measure a balanced relative score. Any thoughts?

-treliff





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

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/