Quick Answer
You wrote a custom indicator for cTrader, pressed Build, and the compiler says that your class does not implement an inherited abstract member. The usual form of the message is 'MyIndicator' does not implement inherited abstract member 'Indicator.Calculate(int)' (check the exact text in your build output). The error code is CS0534.
The cause is in the way custom indicators work. According to the cTrader documentation, every custom indicator derives from Indicator, and its Calculate() method is the foundation of the indicator: the documentation shows it as public override void Calculate(int index) and says that it should never be omitted. If your class has no method that matches this signature, the compiler reports CS0534. The fix is to add the method exactly as the base class declares it: public, override, return type void, one int parameter.
From the author: I build cBots and indicators in cTrader Automate and convert strategies from Pine Script and MQL5 to C#. The usual path to this error is a port from MQL5: the logic of
OnCalculatewas moved into a method with a different name or a different list of parameters, and nothing in C# says that the cTrader entry point is now missing.
Key Facts
| What you see | Usual cause | Fix |
|---|---|---|
| CS0534 on the indicator class | No Calculate method | Add public override void Calculate(int index) |
| CS0534 and a Calculate exists | The signature does not match (no parameter, wrong type) | Use one int parameter |
| CS0534 and an override exists | public or override is missing, so it is not an override | Add both |
| CS0115 instead of CS0534 | override is there, but nothing matches in the base class | See CS0115 |
| CS0534 after porting from MQL5 | OnCalculate was renamed or copied as is | Move the logic into Calculate(int index) |
| Builds, but the output is empty | Calculate runs, nothing is written to the output | Assign Result[index] |
What the Error Means
An abstract member is a method that the base class declares but does not write. Every class that inherits from it must write its own version. If it does not, the compiler stops with CS0534 and names the member that is missing. For a cTrader indicator, the cTrader documentation shows the skeleton like this: the attribute [Indicator(...)], a class that inherits from Indicator, an [Output] property of type IndicatorDataSeries, a protected override void Initialize() and a public override void Calculate(int index).
The documentation describes Calculate() as called for each index of historical data and then on each incoming tick. That is why the method has an index parameter: it is the bar for which the value is calculated.
The Broken Indicator
This indicator has the logic, but no method with the right signature:
using cAlgo.API;
namespace cAlgo.Indicators
{
[Indicator(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class MidPrice : Indicator
{
[Output("Mid")]
public IndicatorDataSeries Result { get; set; }
// CS0534: no override of Calculate(int)
public void Calculate()
{
Result[0] = (Bars.HighPrices[0] + Bars.LowPrices[0]) / 2.0;
}
}
}
Calculate() here has no override and no parameter. It is only an unrelated method that has the same name, so the compiler still finds the abstract Calculate(int) without an implementation.
Cause 1: No Calculate Method
The simplest case: the class has Initialize or a few helpers, and no Calculate. Add it:
public override void Calculate(int index)
{
Result[index] = (Bars.HighPrices[index] + Bars.LowPrices[index]) / 2.0;
}
Cause 2: The Signature Does Not Match
Each of these is a different method, not an implementation:
public override void Calculate() // no parameter
public override void Calculate(double index) // wrong type
public override int Calculate(int index) // wrong return type
The first two give CS0115 ("no suitable method found to override"), because the override keyword points at nothing. Without override, you get CS0534 for the missing member. In both cases the fix is the same: copy the signature from the documentation, public override void Calculate(int index).
Cause 3: public or override Is Missing
void Calculate(int index) { ... } // not public, not override
public void Calculate(int index) { ... } // no override
Both compile as ordinary methods, but they do not replace the abstract one. Write both keywords: public override.
Cause 4: A Port From MQL5
In an MQL5 indicator, the entry point is OnCalculate with a long list of arrays and prev_calculated. In cTrader there is one Calculate(int index), called per bar, so the loop over prev_calculated disappears:
| MQL5 | cTrader C# |
|---|---|
| OnCalculate(rates_total, prev_calculated, ...) | Calculate(int index) |
| for(i = start; i < rates_total; i++) | not needed, index is given |
| high[i], low[i] | Bars.HighPrices[index], Bars.LowPrices[index] |
| Buffer[i] = value | Result[index] = value |
| OnInit() | Initialize() |
If you look at the matching problem on the MetaTrader side, see OnCalculate function not found in an MQL5 indicator.
The Fixed Indicator
using cAlgo.API;
namespace cAlgo.Indicators
{
[Indicator(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class MidPrice : Indicator
{
[Output("Mid")]
public IndicatorDataSeries Result { get; set; }
protected override void Initialize()
{
}
public override void Calculate(int index)
{
Result[index] = (Bars.HighPrices[index] + Bars.LowPrices[index]) / 2.0;
}
}
}
Build it, add it to a chart on a demo account, and compare the line with the middle of the high and low of a few candles. The value for a bar should be the average of its high and low.
After It Builds: Watch the Index
Calculate is called for every bar, including the first one. A formula that reads Result[index - 1] fails at index == 0 (see cBot index out of range for the same kind of mistake). Guard the first bars:
public override void Calculate(int index)
{
if (index < 1)
return;
Result[index] = (Bars.HighPrices[index] + Bars.LowPrices[index]) / 2.0;
}
Also keep in mind that the documentation says Calculate() can be called many times per second on a busy market. Keep its work short.
Similar Errors
| Error | Message | What it means |
|---|---|---|
| CS0534 | Does not implement inherited abstract member | A required method is missing |
| CS0115 | No suitable method found to override | override without a matching base method |
| CS0161 | Not all code paths return a value | A method with a return type misses a return |
| CS0246 | The type or namespace name could not be found | A using or a type name is missing |
| CS1061 | Does not contain a definition | The object is found, the member is not |
Checklist: What to Check When You See CS0534
- Read the member name in the message: it tells you what is missing.
- Check the class base:
: Indicatorfor an indicator. - Write the full signature:
public override void Calculate(int index). - Check
publicandoverrideare both there. - Check the type of the parameter is
int. - Assign the output in
Calculate:Result[index] = .... - Guard
index - 1at the first bars. - Build, then test on a chart of a demo account.
Common Mistakes
- Writing
Calculate()with no parameter. - Forgetting
overrideorpublic. - Moving a whole MQL5
OnCalculateloop intoCalculate. - Reading
Result[index - 1]at the first bar. - Leaving the output empty, so that the indicator shows nothing.
- Doing heavy work in
Calculateon every tick.
FAQ
Related Guides
- cTrader C# error CS0115: an override that does not match the base method.
- cTrader C# error CS0117: a type that has no member with that name.
- cTrader C# error CS0161: a method that does not return on every path.
- cTrader C# error CS0246: a type name the compiler does not know.
- cTrader C# error CS1061: the object is found, the member is not.
- cTrader cBot crash: index was out of range: a runtime error after the code builds.
- Convert an MT5 indicator to an EA: the MetaTrader side of the same logic.
- Pine Script to cTrader C# cBot: the full conversion process.
- What to check in a trading bot before going live: a pre-live checklist for stops, lot size, spread and trade results.
- cTrader error CT0002: assembly must contain algo type: class libraries,
AlgoBuildand a missing algo class. - cTrader error CS0535: does not implement interface member: a class that misses an interface member.
Fix Compile Errors Without Guessing
If a cBot or an indicator does not build, paste the code and the error message into the CodeFlowOS Error Fixer. It suggests a minimal fix, explains each error and shows what changed. A fix uses 1 credit, with up to 3 attempts included, and the compiler check is optional. Outputs are not guaranteed, and code that compiles can still have wrong logic, so always review the result. CodeFlowOS also converts strategies between Pine Script, MQL5 and cTrader C#: try the converter page.
This article is educational. It does not describe trading performance and is not financial advice. Always build the code in cTrader Automate and test it on a demo account before using it on a live account.