- ago
Just upgraded to WL 8 Build 82 and now no trades are occurring, even with simple code that should have two transactions. See the code below. The code below worked fine in Build 81 with the same settings. I upgraded to Build 82, and ran it, and no trades occurred. I was using the code to report a defect with charting that I was seeing in build 81.

Dataset: symbols CLSK and MARA in a dataset.
Scale: 1 minute
Data range: most recent 10 days
Filter Pre/Post Market Data: unchecked
Position sizing: Starting capital 100,000; Position size: Advanced Position Sizer, Spread equity equally

This is just a simple test strategy that will do one round trip trade if there are more than 1000 bars in the bar set. Build 81 - no problem.

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript1 { public class MyStrategy : UserStrategyBase { //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { if (!HasOpenPosition(bars, PositionType.Long)) {             //code your buy conditions here             if (bars.Count > 1000 && idx == 100)             {                PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0, "Buy");             } } else {             //code your sell conditions here             var position = FindOpenPosition(-1);             if (position != null && idx == position.EntryBar + 5)             {                ClosePosition(position, OrderType.Market, 0, "Sell");             } } } //declare private variables below } }


This is build 82 with all extensions that I use up-to-date. I tried some of my (real) strategies and they're producing no trades even though they produced a ton of trades in build 81.
0
161
Solved
9 Replies

Reply

Bookmark

Sort
- ago
#1
Maybe it has to do with the thresholds?
https://www.wealth-lab.com/Software/ChangeLog

New! Pre-Threshold Signal Blocking - At Market Entry Signals are blocked to prevent exceeding Open Positions, Cash or Buying Power Thresholds. At Market Exits are considered and can allow for more Entry Signals.
0
- ago
#2
Thanks, Eugene. However, I don't know if that should apply to following settings, where the Margin Factor is 2.00. I'm not saying it should, I just don't know. The help states the conditions in absolutes, but makes no mention of margin factor (for Equal Exposure). So, I have no idea if that is a bug or not, but thought you should know in case it is. Here's the more detailed settings I used. And, the Spread Equity Equally had Max % Equity size set to 50. In any case, when I changed to like 1000 shares it ran fine.

Help text...
QUOTE:
This money management method can be used take as much trades as possible, avoiding skipped trades due to insufficient funds.
It spreads available equity equally based on the variable number of Alerts (candidates) generated by the system, arriving at equal exposure.
The size can not exceed the minimum and maximum boundaries which are percentages, which helps protect from either betting the farm (e.g., when there are only 2 Alerts, so the size of each position would have been a whopping 50%), or not taking a trade too small (e.g. when so many candidates were produced that the size is not enough to trade one share).


Position sizing...
0
Cone8
 ( 23.52% )
- ago
#3
Do you mean signals? or trade fills?
What's in the Order Manager?
0
- ago
#4
Hi, Cone. I was just running a basic backtest with the above code. No signals are produced with the given settings.
0
Cone8
 ( 23.52% )
- ago
#5
That strategy only buys once, on bar 100 if there are more than 1000 bars.
0
- ago
#6
We might be cross-posting, but to clarify...

With the above settings no trades are produced in backtesting. With latest 10 days there are over 5000 bars (including pre/post market). Hence, a buy and sell perhaps should have occurred with the given settings. I don't know. I provided additional details in Post #2 in case you wanted to check on it.
0
Cone8
 ( 23.52% )
- ago
#7
For me it does create the trades - but not with that Sizer.
Let's see if we can track that down.
0
Cone8
 ( 23.52% )
- ago
#8
Glitch zeroed in on a seemingly innocuous change (mea culpa) that resulted in an empty list of Candidates - for PosSizers that use this like "Spread Equity Equally".
Thanks for the find, and fixed for Build 83.
0
Glitch8
 ( 12.05% )
- ago
#9
I'll get the Build out tomorrow for folks who use these Position Sizers.
1
Best Answer

Reply

Bookmark

Sort