ww58
- ago
I have a strategy based on candlestick patterns. It has very strange behavior:
first picture - backtest for the last 2 months

second picture - for the last 2 weeks

As you can see, the trade of 25.04 is absent on the first one.

At the same time, yesterday there was a strategy entry via strategy monitor. It is not on any backtest at all.
0
469
Solved
6 Replies

Reply

Bookmark

Sort
Cone8
 ( 24.31% )
- ago
#1
It's likely an edge case. Chart pattern conditions are dependent on ATR (ATRPercent), which is an IIR-type indicator that needs a lot of seed bars to stabilize. If using the 10-period default setting (Preferences > Chart Patterns), you need at least 30 or 40 bars before you get a stable value.

See F1 > Help > Indicators > Stability of Indicators

My guess is that the trade would disappear if you just added 1 or 2 more weeks.
0
ww58
- ago
#2
>My guess is that the trade would disappear if you just added 1 or 2 more weeks.
Right

What about the fact that there was a trade in strategy monitor, but at no point do I see it on the backtest? SM uses also 2 weeks as on the second picture
0
Cone8
 ( 24.31% )
- ago
#3
Already explained. You may (or may not) see the trade with only a little seed data - it's unstable. Next Monday it may change again because the ATR values are not stabilized. Load 4 weeks for these strategies in the S. Monitor.

Another note is that your strategy doesn't actually use any indicators, so there isn't really even a "StartIndex" period. To fix that, add another condition that uses a SMA with a period of 13 bars x 10 days (2 weeks) = 130 or more. For example, SMA(Close, 150) > 5000000 will probably never be true. That will add a StartIndex = 150 so that your strategy will ignore the first 150 bars of data. Make sure to load sufficient data, like 4 weeks.
1
Best Answer
ww58
- ago
#4
Can candlestick patterns work incorrectly due to streaming bars?

Today, the situation repeated itself, even though I rewrote the strategy in C#, added StartIndex, and increased the period to six months, which is more than enough.

Yesterday, the strategy sent an order after the market closed, and today it was executed at the opening. I was watching at that moment, SL and TP signals were generated in SM, and there are also signals in the log. Then I tried to repeat it on the backtest, but there is no trace of yesterday's order or today's trade.

Then, as a test I changed the quotes to alpaca and the backtest turned out completely different. The 30-minute bars are not that different, in my opinion.
0
Glitch8
 ( 10.85% )
- ago
#5
Yes, bars built using streaming data might not match subsequently downloaded historical bars. It’s a matter of whether the streaming provider uses conflation or sends through certain ticks that’s their process for generating historical bars might not. In my experience IQFeed is the must reliable streaming source.
0
Cone8
 ( 24.31% )
- ago
#6
Free Alpaca data is IEX only - not suitable for live system trading.

See: All About WealthLab Intraday and Realtime Data Providers
0

Reply

Bookmark

Sort