Indicator.Calculate
method · Indicator · cAlgo.API
DesktopCLICloud
Calculate the value(s) of indicator for the given index.
Definition
public abstract void Calculate(int index)
api.Calculate(index: int) -> None
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
index | int | int | The index of calculated value. |
Examples
public partial class MedianPriceIndicator : Indicator
{
public override void Calculate(int index)
{
Result[index] = (Bars.HighPrices[index] + Bars.LowPrices[index]) / 2;
}
}
def calculate(self, index):
api.Result[index] = (api.Bars.HighPrices[index] + api.Bars.LowPrices[index]) / 2
{
"AccessRights": "None",
"IsOverlay": true,
"LineOutputs": [
{
"Name": "Result",
"DisplayName": "Main"
}
]
}