SA
how to fix the problems of that sentence?
18 Feb 2021, 04:13
I wrote the lines of code and received this message :
(Error CS1501: No overload for the 'StochasticOscillator' method accepts 6 argument)
how can i solve this problem? Thanks a lot for the help!
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.ESouthAmericaStandardTime, AccessRights = AccessRights.None)]
public class bot : Robot
{
[Parameter(DefaultValue = 0.0)]
public double Parameter { get; set; }
[Parameter("Source")]
public DataSeries Source { get; set; }
[Parameter("Volume", DefaultValue = 10000, MinValue = 1000)]
public int Volume { get; set; }
[Parameter("Stop Loss (pips)", DefaultValue = 35, MinValue = 10)]
public double StopLoss { get; set; }
[Parameter("Take_Profit", DefaultValue = 30, MinValue = 10)]
public double TakeProfit { get; set; }
[Parameter("Start Time", DefaultValue = 7.0)]
public double StartTime { get; set; }
[Parameter("Stop Time", DefaultValue = 16.0)]
public double StopTime { get; set; }
DateTime _lastTrade;
private DateTime _startTime;
private DateTime _stopTime;
private RelativeStrengthIndex _1hrsi1;
private StochasticOscillator _hstoch1;
private StochasticOscillator _hstoch2;
private UltimateOscillator _ult1;
protected override void OnStart()
{
_startTime = Server.Time.Date.AddHours(StartTime);
_stopTime = Server.Time.Date.AddHours(StopTime);
_lastTrade = Server.Time.AddDays(-1);
}
protected override void OnTick()
{
var hour1 = MarketData.GetBars(TimeFrame.Hour);
var day = Server.Time.DayOfWeek;
_1hrsi1 = Indicators.RelativeStrengthIndex(hour1.ClosePrices, 24);
_hstoch1 = Indicators.StochasticOscillator(hour1, 24, 3, 24, MovingAverageType.Simple);
_hstoch2 = Indicators.StochasticOscillator(hour1, 3, 3, 3, 3, MovingAverageType.Simple);
if (Trade.IsExecuting)
return;
var currentHours = Server.Time.TimeOfDay.TotalHours;
bool tradeTime = StartTime < StopTime ? currentHours > StartTime && currentHours < StopTime : currentHours < StopTime || currentHours > StartTime;
if (!tradeTime)
return;
if (_1hrsi1.Result.LastValue > 55)
if (_hstoch1.PercentK.LastValue > 55)
if (_hstoch2.PercentK.LastValue > 70)
if (_lastTrade.DayOfYear != Server.Time.DayOfYear)
if (day == DayOfWeek.Monday || day == DayOfWeek.Tuesday || day == DayOfWeek.Wednesday || day == DayOfWeek.Thursday)
if (Positions.Count == 0)
_lastTrade = Server.Time;
ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "bot", StopLoss, TakeProfit);
Error CS1501: No overload for the 'StochasticOscillator' method accepts 6 arguments
Replies
samuel.jus.cornelio
19 Feb 2021, 13:29
RE: RE:
Shares4us said:
do not know the indicator but the parametercount does not match!!!!
_hstoch1 = Indicators.StochasticOscillator(hour1, 24, 3, 24, MovingAverageType.Simple); // not enough or _hstoch2 = Indicators.StochasticOscillator(hour1, 3, 3, 3, 3, MovingAverageType.Simple); // one to manyjust fix it and you'll be OK
THANK YOU SO MUCH. now it's working perfectly
@samuel.jus.cornelio

Shares4us
18 Feb 2021, 07:38
RE:
do not know the indicator but the parametercount does not match!!!!
just fix it and you'll be OK
@Shares4us