Good day!
At the present moment i'm trying to optimize memory usage and i hope execution speed of strategies.
Depending on Strategy Parameters WLD script may create approximately 15 - 100 DataSeries.
And 60% of these DataSeries is simple value signal {-1,0,+1}.
I suppose better to use array of integer (or even byte ) of signal values.
But sometime i need to visualize these signals. In WLD i can use only method with DataSeries parameter.
Could you help with WealthScript method wich can convert array of integer values to DataSeries more let's say .Net style. Certainly i can do it in cycle creating DataSeries object before plot it. But i hope there is more convenient .Net method.
Size:
Color:
Eugene can probably create an extension method for DataSeries that makes a one line conversion, but it would be less memory intensive to plot the integers yourself using DrawLine() or similar. Write a method that accepts a ChartPane and an integer array (assumed to be synchronized with the chart) and draw a line from one point to the next.
Size:
Color:
)) Ok.
To be honest i use
something like that to plot signals:
PlotSeriesOscillator( oscPane, simple_rsiw, 80, 20, Color.FromArgb(80, Color.Red), Color.FromArgb(80, Color.Blue), Color.Red, LineStyle.Solid, 2 );
(picture is attached )
Would prefer if You help me with method.
Size:
Color:
I think it's not worth the effort to create this method. The couple of megabytes of RAM saved on using integers vs. double (i.e. DataSeries) will be offset by creating thousands of graphic objects. Not to mention the waste of your time that will keep you busy coding a PlotSeries* analogue.
Size:
Color:
In general i agree with u.
But in strategy script i have an option to draw or to not.
When strategy is optimizing ( or for example some strategies are optimizing) or running intraday i would prefer to switch drawing off. That means not DataSeries needed.
For example if i run optimization of 2 or 3 strategies they take 90-98% of memory. Certainly .Cache.Clear() is used and really helped me.
I suppose if i reduce 4 time memory usage system wont freeze. Sometimes it happens when 2 optimizing stragies fill more than 50 dataseries.
Only for this reason.
I know there s simple .Net decision, but not to familiar with last versions.
Something like this:
CODE:
Please log in to see this code.
2 years before it worked and now - doesnt work.
Size:
Color:
I don't agree. There is only one graphic object. Lines are rendered within the chart object. Second, rendering doesn't occur for optimizations, so the drawing process is automatically nullified.
Size:
Color:
Certainly yes.
I mean if there's no no series plotted, if i use shorter and may be quicklier type my strategy ll use less memory and probably run faster.
If i need to plot these series DataSeries object will be created.
Could You help me please.
Size:
Color:
QUOTE:
That means not DataSeries needed.
Bars.Cache.Clear effectively regains the memory, and you'll still need those poor-man DataSeries (integer arrays) for the Strategy to operate. IMHO, the bang for the buck might come from reconsidering the logic (that depends on numerous DataSeries and excessive optimizations) rather than trying to squeeze blood from a turnip. Or from plugging in more RAM. :)
Size:
Color:
I fully agree. But let's look from another side, Eugene.
Strategy code is very simple.
As strategy parameter it uses number of confirmations of different lookback periods. Next period = previous_period * 10.
For example if only one trend confirmation needed strategy will create only 2 dataseries vma and sma with one period.
If more confirmations are needed - 3 or 4 additinal periods, it creates additinal series. Number of DataSeries = Number of confirmations * 2.
Just 8 simple classes like above, 200 lines each.
Nothing to exclude really.))
In general minimum 5 series of simple signals {-1,0,+1}. If more periods - strategy creates more signals.
But if i can replace some DataSeries by integer arrayes, why not? I tried - it works great.
But still not familiar with modern .Net possibilities.
I hope you ll support me.
Size:
Color:
After all seems i realised this idea.
And it looks like int arrayes for signals are little bit better than DataSeries.
Could you just tell me, if i use following code:
CODE:
Please log in to see this code.
During optimization or strategy run under Strategy Combination is PlotSeries fully disabled or just no rendering but all parameter such as in my example
CODE:
Please log in to see this code.
- used as 2nd parameter int PlotSeries will be computed anyway?
Just want to know - do i need to do something else or that's enough.
Size:
Color:
As Cone pointed earlier, rendering doesn't occur for optimizations. No PlotSeries or other cosmetic chart operations are evaluated during optimizations. Also, PrintDebug statements are ignored too.
I'm not sure what performance gain could your example code bring. The number of items is equal to Bars.Count and internally, every Integer will get converted (cast) to Double anyway. I think Robert had a different concept on his mind.
Size:
Color:
it is converted only if plotted - if i understand right. If no conversion - number of items - the same, but item itself is shorter.
Btw if i remember right integer operations run faster too.
But if everything is ok i dont need to draw all data..
I use at the beginning: draw = true or false;
And in strategy: if (draw) then convert and plot etc.
Good to know if Plot methods are fully ignored with their parameters.
That's why im asking that - Cosmetic charts methods are fully ingored and even if they have some parameters - parameters computing will be ignored too?
Size:
Color:
QUOTE:
That's why im asking that - Cosmetic charts methods are fully ingored and even if they have some parameters - parameters computing will be ignored too?
You can easily verify this by adding some debugging logic to your Int_To_Ds class.
Size:
Color:
Thank you for idea.
During optimizatioin following code:
CODE:
Please log in to see this code.
is fully disabled. That means there is no PlotSeries computation with their parameters.
That's great.
But as for Strategy Combination -not. There is no charting in Strategy Combination at all but debug window showed me call of new Int_To_Ds(my_signal). Interesting logic.
Funny i been thinking that it must be ignored too.
Btw - in new WealthLab version are vizualizers computed every optimization cycle?
Size:
Color:
QUOTE:
Btw - in new WealthLab version are vizualizers computed every optimization cycle?
During optimizations, performance visualizers are not computed at all.
QUOTE:
But as for Strategy Combination -not. There is no charting in Strategy Combination at all but debug window showed me call of new Int_To_Ds(my_signal). Interesting logic.
I agree that it might make sense to turn off cosmetic chart operations in Combo Strategies. I'm going to ask the developer.
Size:
Color: