- ago
Is PutCallRatio removed from Data Extensions ? It is a Building Block strategy, I am getting compile error when I run the strategy. (screenshot is attached)
it worked fine before, Is anything missing here ?

Here is the code after 'Open as c# coded strategy', the error is that BarHistory doesn't have property PutCallRatio (in method Initialize() below):

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript3 { public class MyStrategy : UserStrategyBase {     public MyStrategy() : base() { StartIndex = 0; } public override void Initialize(BarHistory bars) {     indicator = bars.PutCallRatio; foreach(IndicatorBase ib in _startIndexList) if (ib.FirstValidIndex > StartIndex) StartIndex = ib.FirstValidIndex; } public override void Execute(BarHistory bars, int idx) {          int index = idx;          Position foundPosition0 = FindOpenPosition(0);          bool condition0;          if (foundPosition0 == null)          {             condition0 = false;             {                if (indicator[index] >= 1.1)                {                   condition0 = true;                }             }             if (condition0)             {                Backtester.CancelationCode = 1;                _transaction = PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0, 0, "Buy At Market (1)");             }          }          else          {          } } public override void NewWFOInterval(BarHistory bars) {          indicator = bars.PutCallRatio; }       private TimeSeries indicator;       private Transaction _transaction; private List<IndicatorBase> _startIndexList = new List<IndicatorBase>(); } }

0
71
4 Replies

Reply

Bookmark

Sort
- ago
#1
0
- ago
#2
The C# code given in the Initialize{block} doesn't make any kind of sense. PutCallRatio is an indicator, not a BarHistory property. The block you're using in DataExtensions isn't creating the C# code right. It should look something like the code below.
CODE:
public override void Initialize(BarHistory bars) {          indicator = new PutCallRatio(bars,PutCallRatios.TOTALPC);     PlotIndicator(indicator); }
And the foreach statement is nonsense. The building block you are calling has a bug. Can you tell us which building block it is so it can be fixed?
0
- ago
#3
QUOTE:
Here is the code after 'Open as c# coded strategy', the error is that BarHistory doesn't have property PutCallRatio (in method Initialize() below):


PutCallRatio is an indicator; what made you think it's a property of the BarHistory object? It has never been so the code is junk.

You're using unsupported WL build 80. Upgrade to B106 before going further.
0
Glitch8
 ( 11.64% )
- ago
#4
>>Is PutCallRatio removed from Data Extensions?<<

No, it is present and accounted for.

0

Reply

Bookmark

Sort