- ago
These are strategy backtest settings and results. I gave it much money), there are only 10 trades not longer than 20 bars holding, but 100K+ NSF trades.





0
276
12 Replies

Reply

Bookmark

Sort
- ago
#1
Oh, I got it - all of them are short trades. Still a bug?
0
- ago
#2
I'd expect the NSF count to be zero given your "Max Open Short" of -1. The answer could likely be found somewhere else: preferences, strategy code, market details etc.
0
- ago
#3
QUOTE:
The answer could likely be found somewhere else: preferences, strategy code, market details etc.


What do you mean by that? - Should I keap on searching?)
0
- ago
#4
Since your problem report lacks some key detail it makes me unable to reproduce and opens up for guesswork which may be counterproductive.
0
- ago
#5
After a small counterproductive research...))

Two of my dll strategies generate this issue, but not all of them. It doesn't depend on the dataSet.

Sorry, I just can't send all my grails to you so you could debug your platform)).
0
- ago
#6
We do not require users to send us their code but a sufficient problem report in a case like your implies having an "as-small-as-possible" code that demonstrates the anomaly, if the issue is supposedly caused by the code.
0
- ago
#7
Ok, here is my strategy template. It generates NSF if short deactivated too.

CODE:
using System.Collections.Generic; using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; namespace Strategies { public class StrategyName : UserStrategyBase { // Params: int rollingWindow; // Timeseries: IndicatorBase highestHigh; IndicatorBase lowestLow; public override void BacktestBegin() { WriteToDebugLog("Backtest started."); } public StrategyName() { AddParameter("rollingWindow", ParameterTypes.Int32, 125, 5, 750, 5); } public override void Initialize(BarHistory bars) { rollingWindow = Parameters.FindName("rollingWindow").AsInt; highestHigh = Highest.Series(bars.High, rollingWindow); lowestLow = Lowest.Series(bars.Low, rollingWindow); PlotIndicator(highestHigh); PlotIndicator(lowestLow); StartIndex = rollingWindow; } public override void Execute(BarHistory bars, int idx) { List<Position> longOpenPositions = new List<Position>(); List<Position> shortOpenPositions = new List<Position>(); bool commonOpeningFilters; bool commonClosingFilters; // PREPROCESSING. { List<Position> openPositions = OpenPositions; foreach (Position pos in openPositions) { if (pos.PositionType == PositionType.Long) longOpenPositions.Add(pos); if (pos.PositionType == PositionType.Short) shortOpenPositions.Add(pos); } } // COMMON OPENING FILTERS. { commonOpeningFilters = true; } if (commonOpeningFilters) { // LONG OPENING. { bool longOpeningFilters = true; bool longOpeningSignal = true; if (longOpeningFilters && longOpeningSignal) { PlaceTrade(bars, TransactionType.Buy, OrderType.Market); } } // SHORT OPENING. { bool shortOpeningFilters = true; bool shortOpeningSignal = true; if (shortOpeningFilters && shortOpeningSignal) { PlaceTrade(bars, TransactionType.Short, OrderType.Market); } } } if (longOpenPositions.Count > 0 || shortOpenPositions.Count > 0) { // COMMON CLOSING FILTERS. { commonClosingFilters = true; } // LONG CLOSING. if (commonClosingFilters && longOpenPositions.Count > 0) { foreach (Position pos in longOpenPositions) { if (pos == null) continue; bool longClosingFilters = true; bool longClosingSignal = true; if (longClosingFilters && longClosingSignal) { ClosePosition(pos, OrderType.Market); } } } // SHORT CLOSING. if (commonClosingFilters && shortOpenPositions.Count > 0) { foreach (Position pos in shortOpenPositions) { if (pos == null) continue; bool shortClosingFilters = true; bool shortClosingSignal = true; if (shortClosingFilters && shortClosingSignal) { ClosePosition(pos, OrderType.Market); } } } } } public override void BacktestComplete() { WriteToDebugLog("Backtest done."); } } }
0
- ago
#8
Comments on my template are welcome too (if it's not efficient somewhere), as I use it for all my strategies now.
0
- ago
#9
Thanks. It's my bad, "Retain NSF..." was unchecked in my case. Since it's checked on your end you're seeing a non-zero NSF count even with "Max Open Short" of -1. Guess it's a non-issue then.
0
- ago
#10
Why not an issue?)

You say: no short please, the results say: not enough mone for short (and you see all that NSF count in total results (not only short results)).

retaining NSF looks like an avoiding problem), because I need NSF data if it's correct.
0
- ago
#11
Trades rejected by the max. position filters are also flagged as NSF by WL7. That's how it works. It's up to Dion to decide whether this behavior could be changed or not.
0
- ago
#12
I see, thanks.
0

Reply

Bookmark

Sort