In the past weeks I have noticed, that quite a few inverse leveraged ETFs aren't generating buy/sell signals when backtesting from 2016 and earlier, although the conditions would be given multiple times and the price-data is available. Here's an example with UVXY and a sample strategy that comes from the Evolver. Currently I'm on WL8 B32.
Is there a logical explanation for this behavior?
Is there a logical explanation for this behavior?
Rename
To simplify it, here's a coded versions of the building block stuff.
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; using WealthLab.TASC; using finantic.Indicators; namespace WealthScript3 { public class MyStrategy : UserStrategyBase { public MyStrategy() : base() { AddParameter("Buy ConsDown", ParameterType.Double, 6, 1, 10, 1); AddParameter("Buy StochK", ParameterType.Double, 45, 5, 100, 2); StartIndex = 36; } public override void Initialize(BarHistory bars) { indicator = new ConsecDown(bars.Low,6); PlotIndicator(indicator,new WLColor(0,0,0)); indicator1 = bars.High; indicator2 = new MHLMA(bars,11,32,WhichMA.EMA); PlotIndicator(indicator2,new WLColor(0,0,255)); indicator12 = bars.Open; indicator22 = new ASEMA2(bars.Close,5,10); PlotIndicator(indicator22,new WLColor(255,0,0)); indicator13 = bars.Close; indicator23 = bars.Volume; externalSymbol = GetHistory(bars, "QQQ"); indicator3 = new StochK(externalSymbol,11); PlotIndicator(indicator3,new WLColor(0,128,0),default,default,"QQQPane"); indicator14 = bars.High; indicator24 = new MABandUpper(bars.Open,27,10,0.88); PlotIndicator(indicator24,new WLColor(255,165,0)); indicator15 = bars.Volume; indicator25 = new MHLMA(bars,11,36,WhichMA.SMA); PlotIndicator(indicator25,new WLColor(128,128,0)); } public override void Execute(BarHistory bars, int idx) { int index = idx; Position foundPosition0 = FindOpenPosition(0); bool condition0; if (foundPosition0 == null) { condition0 = false; { if (indicator[index] >= Parameters[0].AsDouble) { if (index - 2 >= 0 && indicator1[index] < indicator2[index - 2]) { if (index - 1 >= 0 && indicator12[index] < indicator22[index - 1]) { if (index - 1 >= 0 && indicator13[index] < indicator23[index - 1]) { if (indicator3[index] > Parameters[1].AsDouble) { condition0 = true; } } } } } } if (condition0) { _transaction = PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0, 0, "Buy At Market (1)"); } } else { condition0 = false; { if (index - 4 >= 0 && indicator14[index] < indicator24[index - 4]) { if (index - 3 >= 0 && indicator15[index] > indicator25[index - 3]) { condition0 = true; } } } if (condition0) { Backtester.CancelationCode = 266242; ClosePosition(foundPosition0, OrderType.Market, 0, "Sell At Market (1)"); } } } public override void NewWFOInterval(BarHistory bars) { indicator = new ConsecDown(bars.Low,6); indicator1 = bars.High; indicator2 = new MHLMA(bars,11,32,WhichMA.EMA); indicator12 = bars.Open; indicator22 = new ASEMA2(bars.Close,5,10); indicator13 = bars.Close; indicator23 = bars.Volume; externalSymbol = GetHistory(bars, "QQQ"); indicator3 = new StochK(externalSymbol,11); indicator14 = bars.High; indicator24 = new MABandUpper(bars.Open,27,10,0.88); indicator15 = bars.Volume; indicator25 = new MHLMA(bars,11,36,WhichMA.SMA); } private IndicatorBase indicator; private TimeSeries indicator1; private IndicatorBase indicator2; private TimeSeries indicator12; private IndicatorBase indicator22; private TimeSeries indicator13; private TimeSeries indicator23; private IndicatorBase indicator3; private BarHistory externalSymbol; private TimeSeries indicator14; private IndicatorBase indicator24; private TimeSeries indicator15; private IndicatorBase indicator25; private Transaction _transaction; } }
Have you tried disabling the conditions one by one and rerunning the strategy to find out a clue?
During that period the strategy isn't able to buy even 1 share at 100% equity since the price of UVXY doesn't drop below $100K until the end of 2016 (due to reverse splits).
Thanks for your advice @Cone and @Eugene.
The decisive factor was the volume in relation to the price. From August 2016, the volume tripled and ran up to 20k-30k, while the price simultaneously fell into this range. Previously, this was not the case, so the rule "Close is less than Volume 1 bar a go" is decisive.
With a little common sense, I find this mindless rule almost as superfluous as a refrigerator in the Arctic...
The decisive factor was the volume in relation to the price. From August 2016, the volume tripled and ran up to 20k-30k, while the price simultaneously fell into this range. Previously, this was not the case, so the rule "Close is less than Volume 1 bar a go" is decisive.
With a little common sense, I find this mindless rule almost as superfluous as a refrigerator in the Arctic...
Your Response
Post
Edit Post
Login is required