Errors in all 60th lines.
Errors in all 60th lines.
22 Mar 2021, 14:13
Error in my CAlgo
I have a problem with the latest version of calgo too. But of a different kind. Robots and indicators that I have been working on during this period (only they) gave an "} expected" error with the cursor on the 60th line. (I don't know if this is an accurate translation, in Russian it sounds like "ожидалась }") I attach screenshots.
I rebooted my computer and reinstalled CAlgo. I rebooted my computer and reinstalled CAlgo. Also I was retyping lines around 60th. It did not help. The code for one of these files is below.
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class ATRMTF_time_History : Indicator
{
[Parameter("Period", DefaultValue = 30)]
public int Period { get; set; }
[Parameter("Timeframe", DefaultValue = "Ticks10")]
public TimeFrame TF { get; set; }
[Parameter(DefaultValue = 200)]
public int LoadHistory_for_ind { get; set; }
[Parameter("Загрузка ист. в индикаторе", DefaultValue = false)]
public bool LoadIndHist { get; set; }
[Output("Main")]
public IndicatorDataSeries Result { get; set; }
private AverageTrueRange atr;
private MarketSeries series;
private Bars Bars3;
public int loaded = 0;
protected override void Initialize()
{
if (LoadIndHist)
{
if (loaded == 0)
{
Print("Start");
Bars3 = MarketData.GetBars(TF, Symbol.Name);
// Print("2");
Print("{0} bar on the chart. Loading 2.000.000 bars", Bars3.Count);
//Print("3");
while (Bars3.Count < LoadHistory_for_ind)
{
// Print("3");
var loadedCount = Bars3.LoadMoreHistory();
//Print("3");
//Print("Loaded {0} bars", loadedCount);
//Print("Total bars {0}", Bars2.Count);
if (loadedCount == 0)
break;
}
Print("Finished, total bars {0}", Bars3.Count);
Print("2");
loaded = 1;
}
}
series = MarketData.GetSeries(TF);
atr = Indicators.AverageTrueRange(series, Period, MovingAverageType.Exponential);
}
public override void Calculate(int index)
{
var index1 = series.OpenTime.GetIndexByTime(MarketSeries.OpenTime[index]);
// Print(index1, " ", Result[index - 1], " ", atr.Result[index1]);
if (Result[index - 1] != atr.Result[index1])
Result[index] = atr.Result[index1];
else
Result[index] = Result[index - 1];
// (int)Math.Round(minJamp * Symbol.PipSize / Math.Pow(0.1, Symbol.Digits));
}
}
}
Computer is protected with dr.Web
Replies
travkinsm1
25 Mar 2021, 14:13
Stupid mistake. Indeed, in the indicator, to which all these files are linked in one way or another, the error is in line 60.
@travkinsm1
amusleh
22 Mar 2021, 14:26 ( Updated at: 22 Mar 2021, 15:23 )
I was able to build your posted indicator code on my system without any issue on Spotware cTrader beta.
Please create a new indicator, copy the code of your old indicator, and try to re-build.
I recommend you to use Visual Studio, it will mark the error for you.
@amusleh