//@Name:Week E-R filter //@Description:Buy-sell signal from the weekly Elder-Ray indicator. 1=buy, -1=sell. /* Author: ShareScript Support Returns 1 if both lines are rising and the bear line is below 0 (buy signal) Returns -1 if if both lines are falling and the bull line is above 0 (sell signal) */ // Care has been taken in preparing this code but it is provided without guarantee. // You are welcome to modify and extend it. Please add your name as a modifier if you distribute it. function getVal(share) { var data = share.getWeeklyBarArray(500); if (data.length<3) return 0; var period=13; var BullP = new Array(); var BearP = new Array(); var ma1 = new MA(period, MA.Exponential); for (var i=0; iBullP[b]&&BearP[a]>BearP[b]&&BearP[a]<0? 1:(BullP[a]0?-1:0) return output }