- ago
The property returns null in both StrategyExecutionModes.StreamingChart and StrategyExecutionModes.StrategyMonitor;

It is not clear in the monthly email whether it is just limited to StrategyExecutionModes.Strategy.


0
449
3 Answers

Reply

Bookmark

Sort
- ago
#1
ExecutionDataSetName is null in the context of single symbol backtest such as streaming chart.
0
- ago
#2
I agree with your statement above, but it is not the issue. I do run the strategy on a dataset not a single symbol.
steps:
- Create any simple strategy.
- Drop it in Strategy Monitor.
- Configure it to operate on a dataset named "MyDataSet".
- Then examine ExecutionDataSetName. You will find it null.
- In The example below you will notice that no signal is generated, but if you remove && ExecutionDataSetName == "MyDataSet", a signal will be generated.

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using System.Drawing; using System.Collections.Generic; namespace WealthScript1 { public class MyStrategy : UserStrategyBase { //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) {          DrawHeaderText("DataSet -->" + ExecutionDataSetName); } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { if (!HasOpenPosition(bars, PositionType.Long)) {             if(idx == (bars.Count - 1) && ExecutionDataSetName == "MyDataSet")             {                PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0, "");             } } else { //code your sell conditions here } } //declare private variables below } }
0
- ago
#3
Sorry, we neglected to set that in the SM, will work on getting that assigned for the next build.
0

Reply

Bookmark

Sort