#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;}

 How do I simulate if then statements for the simulator? Back to threads - Tags: Backtester 0

 Bain 2013-01-22 00:23:43 I want to backtest a strategy with the following rules but I do not know how to program it into quantshare: Daily Strategy: Buy VXX Short VXZ if VXX/VXZ > 1.1; Close positions at end of day Buy VXZ Short VXZ if VXX/VXZ < 0.9; Close positions at end of day
 QuantShare 2013-01-22 09:41:26   2 In "Symbols & Dates" tab, add VXX and VXZ symbols. In the strategy formula, type: a = GetSeries("VXX", close); b = GetSeries("VXZ", close); ratio = a / b; buy = iff(stringequal(name(), "VXX") and ratio > 1.1, 1, 0); short = iff(stringequal(name(), "VXZ") and ratio > 1.1, 1, 0); buy = iff(stringequal(name(), "VXZ") and ratio < 0.9, 1, 0); short = iff(stringequal(name(), "VXX") and ratio < 0.9, 1, 0); For more advanced "if then" statements, you can either create a custom indicator or you can use the money management script.
 Alpha Trader 2013-04-23 01:27:02   0 I have a similar question. I'm trying to backtest a system that looks at SPY and IWM but with different parameters. I'd like to use the C# method of If in the simulator... or any other method..? Here's what I was hoping would work, but apparently it doesn't like the statement. Would the "Choose" Function work somehow? if(Name()== %u201CSPY%u201D) { op0 = 80; op1 = 50; } if(Name()== %u201CIWM%u201D) { op0 = 80; op1 = 50; } Rule1 = (Close) > (SMA(Close,op0)); Rule2 = (Close) < (SMA(Close,op1)); buy = (Rule1); sell = (Rule2); Thanks!
 Alpha Trader 2013-04-23 01:27:57   0 - Correction - if(Name()== %u201CIWM%u201D) { op0 = 200; op1 = 200; }
 Alpha Trader 2013-04-23 01:29:12   0 Full Correction - if(Name()== "SPY") { op0 = 80; op1 = 50; } if(Name()== "IWM") { op0 = 200; op1 = 200; } Rule1 = (Close) > (SMA(Close,op0)); Rule2 = (Close) < (SMA(Close,op1)); buy = (Rule1); sell = (Rule2); Thanks! Read more: http://www.quantshare.com/index.php?option=thread&tid=881&screen=0&toend=1&ref=04798256777107868#ixzz2REK3e6Yg Follow us: @quantshare on Twitter
 QuantShare 2013-04-23 10:01:48   0 QS language doesn't support "if(...){...}". If you want to use C#, you will have to create a custom function or use the money management script. With QS language, you can implement your strategy by typing: op0 = iff(stringequal(name(), "SPY"), 80, 200); op1 = iff(stringequal(name(), "SPY"), 50, 200); Rule1 = (Close) > (SMA(Close,op0)); Rule2 = (Close) < (SMA(Close,op1)); buy = (Rule1); sell = (Rule2);
No more messages