- ago
In my WL6 strategy I used a Tuple to bring several indicator series and strings from the bar by bar section to the display section. With WL7 code, I'm not sure how to handle the Tuple declaration with
CODE:
public override void Execute(BarHistory bars, int idx)

declaration.
Is there a simple way to handle this.
So far I'm very impressed the results of my converted WL6 strategy to WL7. I tested my 10 stock portfolio and was able to adjust the decision parameter to achieve a greater over all return.
0
648
Solved
6 Replies

Reply

Bookmark

Sort
- ago
#1
Gary, I remember these conversations on WL6 forum regarding usage of Tuple. (https://wl6.wealth-lab.com/Forum/Posts/Return-Tuple-40514 and https://wl6.wealth-lab.com/Forum/Posts/Return-more-than-one-DataSeries-40511). The Tuple syntax per se hasn't changed in .NET Core.

Could you expand on what the stopping point is? Also, chances are you may not need your previous Tuple solution because the backtester in WL7 has changed significantly and so displaying a DataSeries of Gain/Loss for the stock backtest (which was the reason behind Tuples) may be handled differently now.
0
- ago
#2
Eugene,
I don't think Tuple is compatible with your
CODE:
public override void Execute(BarHistory bars, int idx)
class. I agree that I should try to use the class to bring the data back to the display section. Is there a way I can modify the
CODE:
public override void Execute(BarHistory bars, int idx)
so that I add the data items to get the data to display.
0
- ago
#3
Gary, please review 2nd paragraph of my reply above. Let's focus on your goal and then we decide if Tuples are necessary or not.
0
- ago
#4
Eugene,
I have not been able to figure out how to use a Tuple with WL7, at least as yet.
In my WL6 strategy I used a Tuple to separate the bar iteration area and display. I used
CODE:
public Tuple<DataSeries, DataSeries, DataSeries, DataSeries, string, string, string > GetTradeLoop(DataSeries dsoInd)
to do this.
Then at the bottom I used
CODE:
Tuple<DataSeries, DataSeries, DataSeries, DataSeries,string, string, string > myTuple = new Tuple<DataSeries, DataSeries, DataSeries, DataSeries ,string, string, string >(dblGainLoss, Buy_Disp, Sell_Disp,       dblPctDrop, strNxtDayStop, strNxtBarSellStop, strDosAdjFact );          //PrintDebug(tempGainLoss[1400]);          return myTuple;
That collects the data.
Then in the display section I used
CODE:
//get the Tuple data          Tuple<DataSeries, DataSeries, DataSeries, DataSeries, string, string, string> temp = GetTradeLoop(dso);          dblGainLoss = temp.Item1;          Buy_Disp = temp.Item2;          Sell_Disp = temp.Item3;          dblPctDrop = temp.Item4;          strNxtDayStop = temp.Item5;          strNxtBarSellStop = temp.Item6;                   strDosAdjFact = temp.Item7;

All of this works like charm.
When I attempt this in WL7, I get error messages as if it is not compatible. Today I will try to see if I can use a Tuple using different format.
0
- ago
#5
QUOTE:
In my WL6 strategy I used a Tuple to separate the bar iteration area and display.

Gary, that's what I mean when saying that Tuples may not be required at all. In WL7 the bar iteration and display are already separate by design. (In addition, strategies now can inherently access the portfolio equity curve). Please see Strategy Execution section in the API document below:

https://www.wealth-lab.com/Support/ApiReference/UserStrategyBase
0
Best Answer
- ago
#6
You have a good hint. I was able to add text to the "Price" pane from the Execute section. I will continue along this line.
Thank you Eugene,
0

Reply

Bookmark

Sort