Crashed in OnStart
Crashed in OnStart
12 Jun 2019, 02:36
Not sure what ive done - bu ti get this message when backtesting a bot i wrote.
12/05/2019 21:01:00.123 | Crashed in OnStart with ArgumentException: Incorrect parameters count. Parameter name: parameterValues
This is the code. I cant See 'parameterValues' anywhere.
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class Scalper01 : Robot
{
[Parameter("Volume", DefaultValue = 1000, MinValue = 1000, Step = 1000)]
public int _vol { get; set; }
private VWAP _vwap;
private ExponentialMovingAverage _emaf;
private ExponentialMovingAverage _emas;
private StochasticOscillator _stoch;
private double _tp;
private double _sl;
protected override void OnStart()
{
_vwap = Indicators.GetIndicator<VWAP>();
_emaf = Indicators.ExponentialMovingAverage(MarketSeries.Close, 13);
_emas = Indicators.ExponentialMovingAverage(MarketSeries.Close, 66);
_stoch = Indicators.StochasticOscillator(5, 3, 3, MovingAverageType.Exponential);
_tp = 9.0;
_sl = 3.0;
}
protected override void OnTick()
{
double _price = MarketSeries.Close.Count;
double _emafPrice = _emaf.Result.Count;
var _longPos = Positions.Find(null, Symbol, TradeType.Buy);
var _shortPos = Positions.Find(null, Symbol, TradeType.Sell);
var _vwapup = _vwap.Result.IsRising();
var _vwapdn = _vwap.Result.IsFalling();
var _emafres = _emaf.Result.Last(0);
var _emasres = _emas.Result.Last(0);
var _stochup = _stoch.PercentD.HasCrossedAbove(21, 3);
var _stochdn = _stoch.PercentD.HasCrossedBelow(79, 3);
if (_vwapup && _stochup == true)
{
if (_emafres > _emasres && _stochup == true)
{
if (_price == _emafPrice)
if (_longPos != null)
ExecuteMarketOrder(TradeType.Buy, Symbol, _vol, null, _sl, _tp);
}
}
if (_vwapdn == true)
{
if (_emafres < _emasres && _stochdn == true)
{
if (_price == _emafPrice)
if (_shortPos != null)
ExecuteMarketOrder(TradeType.Sell, Symbol, _vol, null, _sl, _tp);
}
}
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
}
}
PanagiotisCharalampous
12 Jun 2019, 09:28
Hi zedodia,
Probably you are not passing the correct parameters to one of the indicators? Which is the VWAP indicator you are using?
Best Regards,
Panagiotis
@PanagiotisCharalampous