#twitter-follow { border: 0;position: fixed; top: 240px; left:0;} #live-support { border: 0;position: fixed; top: 370px; left:0;} #knowledge-base { border: 0;position: fixed; top: 170px; left:0;}

 Michael Johnston 2012-11-08 21:58:57 Hi everyone, I am a rookie and trying to grasp the functionality of the backtest function. I am having a little trouble coding this strategy and would really like to test its record. I would like a buy order on a williams%R with a 72 period cross over of the -75 line in the previous day, and the sell order for that should be when will%R crosses the -20 line I would like a short order on williams%R with a 72 period cross over of the -15 line in the previous day, and the cover order for that should be when will%R crosses the -80 line. any help with this would be great. Thank you very much.
 QuantShare 2012-11-09 09:44:02   0 Best Answer Hi Michael, Here is the formula to implement this strategy: buy = cross(Willr(72), -72); // Willr crosses above -72. To get crosses below, just invert "Willr" and "-72" sell = cross(Willr(72), -20); short = cross(Willr(72), -15); cover = cross(Willr(72), -80); The default order is initiated at the open of tomorrow. If you want to reference the previous day in your formula, you can use the "ref" function. Example: a = ref(close, 1);
No more messages