mrsic8
 ( 10.26% )
- ago
Hello,
does anyone know what the last number means?



CODE:
using finantic.Indicators; using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; namespace WealthScript1 { public class PercentageUpDown : UserStrategyBase { public PercentageUpDown() { AddParameter("PeriodSROC", ParameterType.Int32, 4, 2, 90, 4); AddParameter("ConsecutivUpLookback", ParameterType.Int32, 4, 2, 8, 1); AddParameter("Percentage", ParameterType.Double, 4, 2, 26, 2); AddParameter("ExitAfterX", ParameterType.Int32, 5, 1, 31, 2); } //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { _indicator = new SROC(bars.Close, Parameters[0].AsInt); PlotIndicator(_indicator, WLColor.Violet, PlotStyle.ThickLine); double percentage = Parameters[2].AsDouble; _consecutiveUp = new ConsecUp(_indicator - percentage, Parameters[1].AsInt); PlotIndicator(_consecutiveUp, WLColor.Aqua, PlotStyle.DashedLine, true, "ConsecUp"); StartIndex = 14; } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { _enterLong = _consecutiveUp[idx] >= Parameters[1].AsInt && _indicator[idx] >= Parameters[2].AsDouble; _exitLong = bars.Close[idx] >= Parameters[3].AsInt; { if (!HasOpenPosition(bars, PositionType.Long)) { if (_enterLong) { PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0, 0, "BuyAtMarket"); WriteToDebugLog(_consecutiveUp); } } else { var isLastPositionAcitve = HasOpenPosition(bars, PositionType.Long); if (isLastPositionAcitve) { Position p = LastPosition; if (_exitLong && p.PositionType == PositionType.Long) { ClosePosition(p, OrderType.Market); if (LastOpenPosition != null) WriteToDebugLog(LastOpenPosition.EntryDate.Date.ToShortDateString()); } } } } } //declare private variables below private IndicatorBase _indicator; private IndicatorBase _consecutiveUp; private bool _enterLong; private bool _exitLong; } }}


Regards,
0
669
Solved
2 Replies

Reply

Bookmark

Sort
Glitch8
 ( 10.06% )
- ago
#1
It's the Count property, how many values are in the (in this case) IndicatorBase instance.
2
Best Answer
mrsic8
 ( 10.26% )
- ago
#2
Thanks.
0

Reply

Bookmark

Sort