/* @Name:Better than Gold @Description:Relative Strength of Gold or anything else that takes your fancy relative to its own Moving Average @Returns:Number */ /*Hacked from RelTo (of Sharescope) by Roger Harmer. I have wanted to do this for a long time. Positive values indicate a strength relative to Gold (or change it to whatever you want, but you can always buy a Gold ETF so why would you want less?). Positive values return shares which are ascending faster than gold (or whatever). */ /*Click on the top of the column to sort it and the fastest movers will sort to the top. This is not suitable for shorting unless you change the Gold to something else which is obviously declining. Check the results by putting up a Relative to...(G£ in this case) on a Sharescope screen so so you can check what the results look like. There are always one or two that look a bit feeble and you just discard them from consideration. This one is not exactly dependent on the period of choice as the Sharesope one is, although I like the Sharescope one and still use it. */ function init() { this.relshare = getShare("LBM:G£"); //Get the gold prices } function getVal(x) { var period = 45; var len = 50; var F1 = relshare.getCloseArray(len); var S1 = x.getCloseArray(len); var m1 = new MA(period, MA.Simple); var rs = new Array(); var rsm = new Array(); var diff; for (var i=0; i