- ago
It looks like something went terribly wrong here))).

Settings:



Strange results:





The equity looks normal though:




0
763
11 Replies

Reply

Bookmark

Sort
- ago
#1
If you open the Positions tab it would help you troubleshoot your code.
0
- ago
#2
So, do you insist it's my code problem?))

How can code cause something like this? I banned short opening (you can see it on settings screenshot), so my overall results should match long results, don't they.

And I looked at Position tab - the biggest profit is 98%, nothing close to 250%).
0
- ago
#3
You've got a problem on your end, perhaps due to your regional settings. See the first screenshot (at the bottom). I'd suggest you close WL7 and delete Settings.txt in AppData\Roaming\WealthLab7\. Ideally you might want to configure Windows with "." (dot) as the decimal and currency separator (a la U.S. regional settings).
0
- ago
#4
1. I looked into Settings.txt - I'm not sure I want to get these settings lost).

2. Are you talking about "WL7: Specified argument was out of the range..."? - this one was always there, so I don't think it caused the issuer I described.

3. Setting "." as a separater causes this exception:

System.Windows.Markup.XamlParseException: Вызов конструктора для типа "WealthLab7.MainWindow", удовлетворяющего указанным ограничениям привязки, привел к выдаче исключения.
---> System.FormatException: Input string was not in a correct format.
at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
at System.Double.Parse(String s)
at InterpreterGlobal.InvokeReader(String , InterpreterGlobal )
at WealthLab.Core.SettingsManager.Get(String key, Double defaultValue)
at ServiceMessage.CreateThread(Object , String , Double , ServiceMessage )
at WealthLab7.MainWindow.LoadFormSettings()
at WealthLab7.MainWindow..ctor()
--- End of inner exception stack trace ---
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__1_0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
0
- ago
#5
It's your call not to make changes to the Windows regional settings but if you've done so you will have to delete Settings.txt and reconfigure WL7 from scratch.

I'm not implying it's the culrpit but given the lack of details regarding the Positions tab and strategy code I don't have any further suggestions.
0
- ago
#6
I couldn't reproduce this after WL7 restarting (without any changes). But still this doesn't look OOP enough for me). I'm talking about strategy code being able to get results inconsistent.
0
Glitch8
 ( 10.62% )
- ago
#7
It surely looked weird, and nothing like I’ve ever experienced. I can’t think of a reason off the top of my head about what would cause this, so let’s keep and eye out and see if we can determine what causes this!
1
- ago
#8
Thanks!
And I’ll send new details if I face this again and if I have new insights.
0
- ago
#9
Some more details on this.

I faced that again.

Params and some results:





The strategy is about opening and closing position at the same bar.

CODE:
PlaceLimitOrderLowLiquidity(idx, bars, TransactionType.Buy, price); PlaceTrade(bars, TransactionType.Sell, OrderType.MarketClose);


these lines of code are this close to each other in my strategy (if it matters).

Where PlaceLimitOrderLowLiquidity() is my custom function to control entry price for low liquidity symbols. That's my code for it:

CODE:
public void PlaceLimitOrderLowLiquidity(int idx, BarHistory bars, TransactionType transactionType, double price) { if (transactionType == TransactionType.Buy || transactionType == TransactionType.Cover) { if (ExecutionMode != StrategyExecutionModes.StrategyMonitor) { // Если цена не доходит до заявки - ничего не делаем. if (price < bars.Low[idx + 1]) { } // Если цена в течение свечи "проходила" цену заявки. else if (price < bars.High[idx + 1] && price > bars.Low[idx + 1]) { if (bars.Open[idx + 1] < price) PlaceTrade(bars, transactionType, OrderType.Stop, price); else PlaceTrade(bars, transactionType, OrderType.Limit, price); } // Если цена покупающего ордера выше цен, по которым шла торговля в течение свечи. else if (price > bars.High[idx + 1]) { PlaceTrade(bars, transactionType, OrderType.Stop, bars.High[idx + 1]); } } else if (transactionType == TransactionType.Short || transactionType == TransactionType.Sell) { // Если цена не доходит до заявки - ничего не делаем. if (price > bars.High[idx + 1]) { } // Если цена в течение свечи "проходила" цену заявки. else if (price < bars.High[idx + 1] && price > bars.Low[idx + 1]) { if (bars.Open[idx + 1] > price) { PlaceTrade(bars, transactionType, OrderType.Stop, price); } else PlaceTrade(bars, transactionType, OrderType.Limit, price); } // Если цена продающего ордера ниже цен, по которым шла торговля в течение свечи. else if (price < bars.Low[idx + 1]) { PlaceTrade(bars, transactionType, OrderType.Stop, bars.Low[idx + 1]); } } } else { PlaceTrade(bars, transactionType, OrderType.Limit, price: price); } }
0
- ago
#10
QUOTE:
2. Are you talking about "WL7: Specified argument was out of the range..."? - this one was always there, so I don't think it caused the issuer I described.

I take my words back after running your code. Indeed this error in the status bar wasn't caused by the regional settings. It's the accessing idx+1 in your code that raises the warning in the DateSynchedList.

Wasn't able to repro this weird condition yet despite running on different DataSets. Maybe am missing something.

CODE:
public override void Execute(BarHistory bars, int idx) {          var price = bars.AveragePriceHLCC[idx] * 0.98;          PlaceLimitOrderLowLiquidity(idx, bars, TransactionType.Buy, price);          PlaceTrade(bars, TransactionType.Sell, OrderType.MarketClose);
0
- ago
#11
QUOTE:
Indeed this error in the status bar wasn't caused by the regional settings


Thanks, Eugene, I've updated my lib to prevent this.

QUOTE:
Wasn't able to repro this weird condition yet despite running on different DataSets. Maybe am missing something.


You know, I do not get this result every time with just the same code. I didn't find out how strategy and backtesting params cause this. I'll keep on working with this strategy, so maybe i'll get new ideas about it.
0

Reply

Bookmark

Sort