Glitch8
 ( 8.31% )
- ago
Join us July 17 11am EST for a free Zoom brainstorming session where we'll collectively try and improve the performance of the Open Range Breakout system that Volker published in the latest YouTube vid:

https://www.youtube.com/watch?v=m5iuKWsvmUY

Here's the link to register:

https://us06web.zoom.us/meeting/register/tZEkcuCppjgiHNCsjTSCNGNyCXK1CgLcFBGP#/registration

Hope to see you there so we can see what we can do to juice up the returns on this already decent Strategy!
4
680
22 Replies

Reply

Bookmark

Sort
- ago
#1
After being "wowed" by the impressive performance in the video, I "attempted" to code this strategy below. However, my results are not so good. Perhaps someone can correct my code below so my results are more respectable.

CODE:
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; using WealthLab.PowerPack; //using Superticker.Components; /* WLUtil.HideVolume here */ namespace WealthScript1 {    public class MyStrategy : UserStrategyBase    {       Parameter buyFactor, sellFactor;       IndicatorBase nextSessionOpen;       public MyStrategy()       {          buyFactor = AddParameter("Buy factor of NxtOpen", ParameterType.Double, 1.05, 1.02, 1.08, 0.01);          sellFactor = AddParameter("Sell factor of Close", ParameterType.Double, 0.95, 0.9, 1.05, 0.01);          //SetChartDrawingOptions(WLUtil.HideVolume());          //PlotStopsAndLimits();       }       public override void Initialize(BarHistory bars)       {          nextSessionOpen = new NextSessionOpen(bars);          //PlotIndicator(nextSessionOpen);       }       public override void Execute(BarHistory bars, int idx)       {          if (HasOpenPosition(bars, PositionType.Long))          {             //sell conditions below             double stopPrice = bars.Close[idx] * sellFactor.AsDouble; //0.95 = 5% below latest Close             PlaceTrade(bars, TransactionType.Sell, OrderType.Stop, stopPrice, "falling stop Sell");          }          else          {             //buy conditions below             double stopPrice = nextSessionOpen[idx] * buyFactor.AsDouble; //1.05 = 5% above next session open             PlaceTrade(bars, TransactionType.Buy, OrderType.Stop, stopPrice, "breakout Buy");          }       }    } }
0
vk8
 ( 39.11% )
- ago
#2
Seems you are using 5% instead of 0.5%?
0
- ago
#3
QUOTE:
... you are using 5% instead of 0.5%?

You're absolutely right. I was using 5% instead of 0.5%. Fixing that definitely helped.
CODE:
      public MyStrategy()       {          buyFactor = AddParameter("Buy factor of NxtOpen", ParameterType.Double, 1.005, 1.002, 1.008, 0.001);          sellFactor = AddParameter("Sell factor of Close", ParameterType.Double, 0.995, 0.99, 1.005, 0.001);          //SetChartDrawingOptions(WLUtil.HideVolume());          //PlotStopsAndLimits();       }
Based on the results below, it appears this strategy works well with some stocks but not others. And the winning rate could use some improvement. But thanks a bunch for the help and ideas.

0
- ago
#4
I would be highly skeptical with such a strategy putting all my money on just one trade. Seems to me to be doomed one day to loose a lot when you have price gaps over night going against you. In the right time on the right stock it might be superior but I doubt that it's a robust system. Just my two cents. ;)
1
Glitch8
 ( 8.31% )
- ago
#5
I’d never trade only one Strategy. But this one could be a viable component to a MetaStrategy.
0
- ago
#6
When one designs any strategy, he includes several "plants" (i.e. indicators) into it such that when most of the plants lineup, he pulls the trigger. The fundamental problem with this strategy is that it only has one plant (the Stop orders) and, because it's not lining up several plants, it often fails. That's why its winning rate is only 40%. What it needs is more plants to lineup before pulling the trigger.

I tend to favor some of the "money flow" indicators because they take both price and volume action into account. But for a simple example like this, they are too involved.

However, the simple indicator everyone knows about is momentum, so I "attempted" to apply the MACD indicator to this strategy. What I discovered, however, is the MACD doesn't play well with the Buy-Stop design of this strategy. (Volatile small cap stocks with false starts trick this strategy into buying when it shouldn't.) Yet the MACD fights to try to work with this strategy anyway. Perhaps someone can select an alternative momentum indicator that would work much better.

Below are the improved results you can compare with Post #3. There is better profit because the positions are held for more bars. But the winning rate has not improved much. I would like to see a winning rate of 65 to 70% for a production strategy; this strategy needs more plants on its entry criteria.


CODE:
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; using WealthLab.PowerPack; //using Superticker.Components; /* WLUtil.HideVolume here */ namespace WealthScript1 {    public class RangeBreakout : UserStrategyBase    {       Parameter buyFactor, sellFactor;       IndicatorBase nextSessionOpen, macdHist, momentumSmoothed;       public RangeBreakout()       {          buyFactor = AddParameter("Buy factor of NxtOpen", ParameterType.Double, 1.005, 1.002, 1.008, 0.001);          sellFactor = AddParameter("Sell factor of Close", ParameterType.Double, 0.995, 0.99, 1.005, 0.001);          //SetChartDrawingOptions(WLUtil.HideVolume());          //PlotStopsAndLimits();       }       public override void Initialize(BarHistory bars)       {          nextSessionOpen = new NextSessionOpen(bars);          macdHist = new MACDHist(bars.Close);          PlotIndicator(macdHist);          momentumSmoothed = new SMMA(new Momentum(macdHist,1), 5);          PlotIndicator(momentumSmoothed);       }       public override void Execute(BarHistory bars, int idx)       {          if (HasOpenPosition(bars, PositionType.Long))          {             //sell conditions below             if (momentumSmoothed[idx] < 0.0)             {                double stopPrice = bars.Close[idx] * sellFactor.AsDouble; //0.995 = 0.5% below latest Close                PlaceTrade(bars, TransactionType.Sell, OrderType.Stop, stopPrice, "falling stop Sell");             }          }          else          {             //buy conditions below             if (momentumSmoothed[idx] > 0.05 && (momentumSmoothed[idx]-momentumSmoothed[idx-1])/momentumSmoothed[idx-1] > 0.0)             {                double stopPrice = nextSessionOpen[idx] * buyFactor.AsDouble; //1.005 = 0.5% above next session open                PlaceTrade(bars, TransactionType.Buy, OrderType.Stop, stopPrice, "breakout Buy");             }          }       }    } }
0
- ago
#7
Congratulations for developing such an interesting strategy!

In my backtests, this strategy performed very well during bull markets of the financial asset. What ideas can be applied to identify that we are within this period? Crossings of two SMAs, EMAs, and MACD, for example, did not show apparent success.
0
- ago
#8
QUOTE:
Crossings of two SMAs, EMAs, and MACD, for example, did not show apparent success.

The MACD does cross two EMAs. And if you look at my solution in Post #6, the MACD does demonstrate considerable improvement to this strategy.

I've have since added a turtle exit (ATR dependent exit) to this strategy, but that only produced slight improvement. The real problem remains with the entry criteria. It gets too easily fooled by false starts with highly volatile stocks as I pointed out in Post #6. There needs to be more confirming criteria (more "plants") added to the entry criteria. I have thought about turning the candle bar extension loose on the entry criteria (I mean ANDing with both [or all] entry criteria.). That should exclude the false starts.
1
ww58
- ago
#9
QUOTE:
There needs to be more confirming criteria (more "plants") added to the entry criteria

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4729284
This ORB strategy received good profitability thanks to Relative Volume pre-selection. It might make sense to implement something similar here too.
0
- ago
#10
Could you post the PDF here?
0
- ago
#11
Here is the PDF of the mentioned article.
8007-ssrn-4729284-1-pdf
1
- ago
#12
I was thinking that with the new functions that was added (thanks Cone!) with the most recent WL8 update - OptionSynthetic.CalculateOptionPrice() , GetOptionSymbol() , and OptionHelper.PriceAtDelta() , you can further leverage up the gains on this model.

I will try to post some actual code when I can get some time to do so. I'm not a very fluent coder, and my actual day job is currently occupying lots of my time and energy, so haven't been able to quite get to doing as much coding and trading as I would like.

I am also a believer in many of the ideas already verbalized in this thread: don't put all eggs in this basket (especially for options, which can go up 100%+ in one trade to 0% if the trade goes the wrong way...I would do more active position sizing for that), using indicators (I prefer RSI, but everyone use what works best for them) to optimize buying, and large part of this strategy success is picking a nice underlying symbol that works well (overall very bull-ish over the last few years).
0
- ago
#13
Interesting!

Lets experiment with volume indicators such as Relative Volume, Market Facilitation Index, and OBV in order to find a confirmation.
0
- ago
#14
I could replicate Volker his strategy and results. Seems indeed promising. It is simple and without indicators which is a plus in my opinion. Not easy to find something like that.

Some Questions:
Why URNM ? Did you test on a basket of ETF's and this was the most promising?
I tried it on TQQQ, AMZN and NVDA: even with optimization of the parameters, there was no outperformance against the underlying.

Also very important to note: what slippage and fees are you using?
I guess the 0,1 standard slippage but no fees.

So strategies like these are ONLY possible for traders who can enjoy zero fee trading.

It's worth to change from broker if this is the only issue standing in the way of becoming a millionaire but I'll need some extra research on this :-)

The URNM results can be even better if you optimise the percentages.
I always use log scale which gives a better view.

0
- ago
#15
Let me summarize shortly what we came up with in the brainstorm session:
* try more symbols (see also Post #4)
* replace percentages with a volatility measure
* Show MaxDD of winning positions vs. DD of losing positions
* check for Volume / reduce slippage
* add indicators: Volume Breakout, Market Volatility Index, Relative Volume (see also Post #13)
* implement the original Open Range Breakout intraday system (on N minute bars)
* check the volume condition mentioned in the paper above (see Post #11)
* Try to quantify if the open is often outside previous day's trading range (seems to be the case with URNM)
* Use IndicatorSelection to find an indicator to be used as filter
* try the short version of this trading idea

During the brainstorm session we did not find the time to check/test/verify any of these ideas thoroughly enough. Some spontaneous trials were not very successful.

Some more ideas which came to my mind:
* try a profit target
* try dynamic stop-loss and profit target orders, i.e. the calculations change with trade duration.
* try a dynamic portfolio
* try Neural Nets (and other ML algorithms)

I think this is an excellent opportunity for an community effort in improving an existing trading system and challenging WL's possibilities.

Any volunteers?
2
- ago
#16
Important: what is the goal? Is a double APR against the benchmark with a lower DD a good system? Do we stop when we have 20% APR with a low DD?

The challenge now is to see if this 'setup' is robuust enough on other markets. If it works on a random basket of some stocks that would be promising. If it also works on currencies and intraday data that would mean a lot. With some other parameters eventually.

I took a basket of 'most active' stocks from different sectors. The 'most active' was more than a year ago but still OK in my opinion. (AAPL ADBE AMD AMZN AVGO CRM CSCO CVX DIS GOOG HD INTC JNJ JPM MA META MRK MSFT NVDA PANW PG PYPL TSLA TSM TXN UNH WMT XOM)

Since it is a breakout system, I tried to add a SMA.
Lesser than 5 SMA gives 10,30%APR.
Greater than 5 SMA gives only 4,5% APR.
No SMA gives 5,72% APR.
So in this case there is an advantage to add a SMA and optimize the percentages.





5% equity.
ADD: - a transaction weight of lowest RSI 20 is added to have stable results.
- a profit target of 7% increased the APR to 11,59%.
0
Glitch8
 ( 8.31% )
- ago
#17
From my perspective some of the highlights were this:

- Found live trading with URNM had too much slippage to be viable, so attempted to introduce new symbols with more liquidity.
- Swapping URNM for URA (also a Uranium ETF) resulted in a much lower annualized return (38.06%) than URNM (131.23%) but still attractive and potentially more tradable due to higher volume.
- Running on a DataSet of 3 symbols (URA, TQQQ, and NXE) resulted in an annualized return of 64.90%, and observing the by-symbol equity curves revealed that the symbols were complimentary.
- Adding a volume based filter (I created it using MathIndOpInd) allowed us to achieve better "quality" trades (higher average profit percent) but eliminated so many trades that the overall profit was reduced. I feel this higher quality variant is attractive to add to an existing MetaStrategy.

Thanks to everyone who participated, and we're going to target doing a brainstorm each month so stay tuned for the next session!
2
Glitch8
 ( 8.31% )
- ago
#18
Here's the result on the 3-symbol DataSet (URA, TQQQ, NXE)

1
Cone8
 ( 3.70% )
- ago
#19
Is that for the strategy in Post #16 (excluding the SMA filter)?
0
vk8
 ( 39.11% )
- ago
#20
It was a nice to hear different suggestions. As always there is no right or wrong just personal preference. The portfolio approach is always a possible way to "diversify" the risc.
Right now I would focus on the execution and testing with intraday data. I plan to do in the next week or so. I will publish the results here or in a video.
Please post your findings here.

Test smart, trade smarter!
0
- ago
#21
QUOTE:
Here's the result on the 3-symbol DataSet (URA, TQQQ, NXE)


What was the setup and code used?
0
Glitch8
 ( 8.31% )
- ago
#22
- Buy at Stop 0.5% above NextSessionOpen
- Sell at Stop 0.5% below close
- Data Range: most recent 10 years
- Position size: 33.33% of equity (margin 1.1)
- DataSet URA, TQQQ, NXE
2

Reply

Bookmark

Sort