kazuna8
 ( 32.02% )
- ago
The following code is supposed to disable displaying the volume pane, event icons, and the trade arrows but they are still displayed if many are drawn on the chart.

[Strategy Settings]
Single Symbol: SPY
Data Scale: Daily
Data Range: All Data

CODE:
namespace WealthScript { public class MyStrategy : UserStrategyBase { public override void Initialize(BarHistory bars) {          ChartDisplaySettings cds = new ChartDisplaySettings();          cds.ShowVolumePane = false;          cds.PaneSeparatorWidth = 1;          cds.ColorPaneSeparator = WLColor.Black;          cds.ShowEventIcons = false;          cds.DisplayTradeArrows = false;          SetChartDrawingOptions(cds);       } public override void Execute(BarHistory bars, int idx) { if (HasOpenPosition(bars, PositionType.Long)) { if (LastOpenPosition.BarsHeld > 2) { PlaceTrade(bars, TransactionType.Sell, OrderType.Market); } } else { if (idx % 5 == 0) { PlaceTrade(bars, TransactionType.Buy, OrderType.Market); } } WLColor outer = WLColor.Orange; WLColor inner = WLColor.Black; DrawDot(idx, bars.Close[idx] * 0.99, outer, 3); DrawDot(idx, bars.Close[idx] * 0.99, inner, 1); } } }
2
657
14 Replies

Reply

Bookmark

Sort
- ago
#1
Not for me. When I comment the DrawDot out I see nothing on the chart.
0
kazuna8
 ( 32.02% )
- ago
#2
Did you set the Data Range to All Data for SPY?
Mine starts from 1996/01/02.
Shorter data range won't have the problem but only when it's longer.
0
Glitch8
 ( 9.82% )
- ago
#3
After some 50,000 or so drawing commands future ones are ignored for efficiency. That’s why some drawing commands are not processed when drawing a dot on every bar for large datasets.
0
kazuna8
 ( 32.02% )
- ago
#4
It worked fine on WL6 and I see no noticeable performance degradation on WL8.
Is it .NET doing the throttling or WL?
0
- ago
#5
WL6 = WinForms
WL8 = NET Core 8, WPF
0
kazuna8
 ( 32.02% )
- ago
#6
My question is whether expanding the drawing objects on WL8 is possible.
0
Glitch8
 ( 9.82% )
- ago
#7
We can make it an option, I’ll tag this as a #FeatureRequest
1
kazuna8
 ( 32.02% )
- ago
#8
Hi Glitch,
Any chance of expanding the drawing objects?

WL6 is retiring soon, and I plan to migrate to WL8 fully.
This issue is one of the regressions when moving to WL8.
0
kazuna8
 ( 32.02% )
- ago
#9
Hi Glitch,

If making it an option would take time, how about increasing the limit (50000+ now)?

PCs are much powerful now, and GPU speed and memory sizes have been doubled/tripled/quadrupled since then.

I don't think it's gonna be an issue if you bump the limit unless you bump it significantly, say 100x.

0
- ago
#10
I think if you replace

CODE:
DrawDot(idx, bars.Close[idx] * 0.99, outer, 3); DrawDot(idx, bars.Close[idx] * 0.99, inner, 1);
... with a single object (perhaps a PlotTimeSeries), that will solve your problem. It will also render faster and use much less memory. You can also use PlotTimeSeriesCloud to create an envelop around the salient areas. In addition, there's a LineStyle.Dotted (for PlotTimeSeriesCloud) or PlotStyle.Dots (for PlotTimeSeries) if you need the dots.
0
Glitch8
 ( 9.82% )
- ago
#11
Yes superticker, that optimization would speed things up tremendously! I’ll also do some work internally around optimizing individual plots better.
0
kazuna8
 ( 32.02% )
- ago
#12
I did all the optimization, but I still prefer this limitation to be extended.

I have the fastest possible CPU and largest possible memory in my PC, so my PC is well beyond capable of handling many more objects to render without any problem.

It's a little sad for the fact that the software is limiting what the machine (also considering the money spent on it) is capable of.
0
- ago
#13
QUOTE:
I have the fastest possible CPU and largest possible memory in my PC

That's not even a consideration here. What is a consideration here is managing the heap storage for 50,000 independent objects. The garbage collector is going to go through fits trying to defragment that many objects at once. And then you're wonder why Strategy Monitor is occasionally missing some trades? Do you think that might have something to do with heap storage management and over extending your application's "working set"? Think about it.... Piled higher and deeper--the garbage to collect.

Things work best when the solution is lean and simple. Work smarter, not harder--and that includes memory management. Not to mention, keeping your code tight increases the processor's L3 cache hit ratio.
0
kazuna8
 ( 32.02% )
- ago
#14
As for Strategy Monitor occasionally missing some trades, I have only Strategy Monitor running during market time.

The chart issue, on the other hand, I open the charts in the middle of the night to ensure what would have gone in the market on the day.
0

Reply

Bookmark

Sort