Someone please fix this indicator
Someone please fix this indicator
01 Aug 2023, 15:26
Hi. If someone can please fix the errors for this custom indicator, I will be incredibly grateful.
The source code:
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo.Indicators
{
[Indicator(TimeZone = TimeZones.UTC, IsOverlay = false, AccessRights = AccessRights.None)]
[Levels(-5, -3, -2, -1, -0.75, -0.5, -0.25, 0, 0.25, 0.5,
0.75, 1, 2, 3, 5)]
public class VelocityIndicator : Indicator
{
#region cIndicators Parammeters
[Parameter("Number Of Candle", DefaultValue = 5, MinValue = 1)]
public int NumberOfCandle { get; set; }
[Parameter("Moving Average", DefaultValue = MovingAverageType.Exponential)]
public MovingAverageType MovingAverageType { get; set; }
[Parameter("MA Period", DefaultValue = 14, MinValue = 2)]
public int Period { get; set; }
[Output("High Acceleration", Color = Colors.Green, Thickness = 1)]
public IndicatorDataSeries HighAccelerationSeries { get; set; }
[Output("Low Acceleration", Color = Colors.Red, Thickness = 1)]
public IndicatorDataSeries LowAccelerationSeries { get; set; }
[Output("Moving Average", Color = Colors.Blue, Thickness = 2)]
public IndicatorDataSeries MovingAverageSeries { get; set; }
#endregion
MovingAverage _movingAverage;
double _elapsedTime;
protected override void Initialize()
{
_movingAverage = Indicators.MovingAverage(HighAccelerationSeries, Period, MovingAverageType);
long elapsedTicks = (long)Math.Ceiling((NumberOfCandle + 0.5) * MarketSeries.TimeFrame.ToTimeSpan().Ticks);
TimeSpan elapsedSpan = new TimeSpan(elapsedTicks);
_elapsedTime = elapsedSpan.TotalSeconds;
}
/// <summary>
/// S = S0 + V0t +(at^2)/2 a = (2*(S-S0))/t^2.
/// v = v0 +at
/// </summary>
/// <param name="index"></param>
public override void Calculate(int index)
{
double high = MarketSeries.High[index];
double previewHigh = MarketSeries.High[index - NumberOfCandle];
double actualPriceOrHigh = (MarketSeries.Bars() - 1) == index ? Symbol.Mid() : high;
double low = MarketSeries.Low[index];
double previewLow = MarketSeries.Low[index - NumberOfCandle];
double actualPriceOrLow = (MarketSeries.Bars() - 1) == index ? Symbol.Mid() : low;
double highAcceleration = (2 * (high - previewHigh) / Math.Pow(_elapsedTime, 2)) * Math.Pow(10, 2 * Symbol.Digits);
double lowAcceleration = (2 * (low - previewLow) / Math.Pow(_elapsedTime, 2)) * Math.Pow(10, 2 * Symbol.Digits);
HighAccelerationSeries[index] = highAcceleration;
LowAccelerationSeries[index] = lowAcceleration;
MovingAverageSeries[index] = _movingAverage.Result[index];
// Print("{0} {1} {2} {3} {4}",highAcceleration, lowAcceleration, elapsedTime, MarketSeries.Bars()-1, index);
}
}
}
I Managed to fix some of them (hopefully correctly), But I still get 1 error. The code:
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo.Indicators
{
[Indicator(TimeZone = TimeZones.UTC, IsOverlay = false, AccessRights = AccessRights.None)]
[Levels(-5, -3, -2, -1, -0.75, -0.5, -0.25, 0, 0.25, 0.5, 0.75, 1, 2, 3, 5)]
public class VelocityIndicator : Indicator
{
#region Indicator Parameters
[Parameter("Number Of Candle", DefaultValue = 5, MinValue = 1)]
public int NumberOfCandle { get; set; }
[Parameter("Moving Average", DefaultValue = MovingAverageType.Exponential)]
public MovingAverageType MovingAverageType { get; set; }
[Parameter("MA Period", DefaultValue = 14, MinValue = 2)]
public int Period { get; set; }
[Output("High Acceleration", LineColor = "Green", Thickness = 1)]
public IndicatorDataSeries HighAccelerationSeries { get; set; }
[Output("Low Acceleration", LineColor = "Red", Thickness = 1)]
public IndicatorDataSeries LowAccelerationSeries { get; set; }
[Output("Moving Average", LineColor = "Blue", Thickness = 2)]
public IndicatorDataSeries MovingAverageSeries { get; set; }
#endregion
private MovingAverage _movingAverage;
private double _elapsedTime;
protected override void Initialize()
{
_movingAverage = Indicators.MovingAverage(Bars.ClosePrices, Period, MovingAverageType);
// Calculate the elapsed time based on the number of candles and their timeframe
_elapsedTime = NumberOfCandle * Bars.TimeFrame.ToTimeSpan()().TotalSeconds;
}
public override void Calculate(int index)
{
// Check if there are enough bars to calculate acceleration
if (index < NumberOfCandle)
return;
double high = MarketSeries.High[index];
double previewHigh = MarketSeries.High[index - NumberOfCandle];
double actualPriceOrHigh = index == MarketSeries.Close.Count - 1 ? MarketSeries.Close.LastValue : high;
double low = MarketSeries.Low[index];
double previewLow = MarketSeries.Low[index - NumberOfCandle];
double actualPriceOrLow = index == MarketSeries.Close.Count - 1 ? MarketSeries.Close.LastValue : low;
double highAcceleration = (2 * (high - previewHigh) / Math.Pow(_elapsedTime, 2)) * Math.Pow(10, 2 * Symbol.Digits);
double lowAcceleration = (2 * (low - previewLow) / Math.Pow(_elapsedTime, 2)) * Math.Pow(10, 2 * Symbol.Digits);
HighAccelerationSeries[index] = highAcceleration;
LowAccelerationSeries[index] = lowAcceleration;
MovingAverageSeries[index] = _movingAverage.Result[index];
}
}
}
Error CS1061: 'Time Frame' does not contain a definition for 'ToTimeSpan' and no accessible extension method 'ToTimeSpan' accepting a first argument of type 'TimeFrame' could be found (are you missing a using directive or an assembly reference?)
Replies
cTrader_Robot
02 Aug 2023, 12:41
( Updated at: 02 Aug 2023, 12:49 )
RE: Someone please fix this indicator
PanagiotisChar said:
Hi there,
Where did you get this code?
Need help? Join us on Telegram
Hi. Someone uploaded this cBot again: https://ctrader.com/algos/cbots/show/3150
I want to fix this cBot. It is originally from a person who uploaded it here in 2013. This person just disappeared after 2014. I tried to find him on Facebook to help me fix it, but there is no response.
The problem is it uses two custom indicators. FibbonacciBands and Velocidade (velocityIndicator). These two indicators have errors and warnings. The robot won't work as it should because these two custom indicators must be fixed.
These are the indicators the cBot uses;
VelocityIndicator https://ctrader.com/algos/indicators/show/906
FibonacciBands (the source code is hidden now. It wasn't before) https://ctrader.com/algos/indicators/show/190
If any of you guys who see this post can fix the errors and some warnings would be great, because as I see it is a really good robot. Even with errors I managed to runu the backtest and it performs great.
Here are all 3 source codes (robot, fibonaccibands, velocityindicator)
Robot:
//#reference: ..\Indicators\FibonacciBands.algo
//#reference: ..\Indicators\Velocidade.algo
// -------------------------------------------------------------------------------
//
// This is a Template used as a guideline to build your own Robot.
//
// -------------------------------------------------------------------------------
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Requests;
using cAlgo.Indicators;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Globalization;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC)]
public class SR_Fibo : Robot
{
[Parameter(DefaultValue = 100000)]
public int Volume { get; set; }
[Parameter(DefaultValue = 21)]
public int AtrPeriod { get; set; }
[Parameter(DefaultValue = 55)]
public int EmaPeriod { get; set; }
[Parameter(DefaultValue = 10)]
public int VelPeriod { get; set; }
List<double> fibo;
int idx;
Velocidade tendencia;
FibonacciBands fbands;
double stop, gain, price;
PendingOrder ordemc, ordemv;
Position posicao;
private void Seta_variaveis(TradeType oper)
{
Carregar_fibo();
if (oper == TradeType.Buy)
price =Precos(fibo, Symbol.Ask, oper);
else
price = Precos(fibo, Symbol.Bid, oper);
stop = Stopcalc(oper, fibo);
gain = Gaincalc(oper, fibo);
}
protected override void OnPendingOrderCreated(PendingOrder newPendingOrder)
{
if (newPendingOrder.TradeType == TradeType.Sell)
ordemv = newPendingOrder;
else
ordemc = newPendingOrder;
}
protected override void OnBar()
{
Carregar_fibo();
Trade.DeletePendingOrder(ordemv);
Trade.DeletePendingOrder(ordemc);
if (tendencia.velocidade.LastValue > 0 && Functions.IsRising(tendencia.velocidade))
Abreposicoes(TradeType.Buy);
if (tendencia.velocidade.LastValue < 0 && Functions.IsFalling(tendencia.velocidade))
Abreposicoes(TradeType.Sell);
}
protected override void OnStart()
{
tendencia = Indicators.GetIndicator<Velocidade>(MarketSeries.Close, VelPeriod);
fbands = Indicators.GetIndicator<FibonacciBands>(EmaPeriod, AtrPeriod);
fibo = new List<double>();
Carregar_fibo();
OrganizarVetores();
Abreposicoes(TradeType.Buy);
Abreposicoes(TradeType.Sell);
Print("OK!!!");
}
protected override void OnTick()
{
}
private void OrganizarVetores()
{
fibo.Sort();
fibo.Reverse();
}
private void Carregar_fibo()
{
fibo.Clear();
fibo.Add(fbands.UpperBand4.LastValue);
fibo.Add(fbands.UpperBand3.LastValue);
fibo.Add(fbands.UpperBand2.LastValue);
fibo.Add(fbands.UpperBand1.LastValue);
fibo.Add(fbands.LowerBand1.LastValue);
fibo.Add(fbands.LowerBand2.LastValue);
fibo.Add(fbands.LowerBand3.LastValue);
fibo.Add(fbands.LowerBand4.LastValue);
}
private void Abreposicoes(TradeType oper)
{
Seta_variaveis(oper);
if (oper == TradeType.Buy)
Trade.CreateBuyLimitOrder(Symbol, Volume, price, stop, gain, null);
if (oper == TradeType.Sell)
{
Trade.CreateSellLimitOrder(Symbol, Volume, price, stop, gain, null);
}
}
private double Stopcalc(TradeType oper, List<double> sr)
{
OrganizarVetores();
if (oper == TradeType.Sell)
sr.Sort();
if (idx < sr.Count - 1 && Math.Abs(sr[idx] - Symbol.Bid) / Symbol.PipSize > 5)
return sr[idx + 1];
else if (oper == TradeType.Buy)
return sr[idx] - 20 * Symbol.PipSize;
else if (oper == TradeType.Sell)
return sr[idx] + 20 * Symbol.PipSize;
return 0;
}
private double Gaincalc(TradeType oper, List<double> sr)
{
OrganizarVetores();
if (oper == TradeType.Sell)
sr.Sort();
return sr[idx - 1];
}
private double Precos(List<double> sr, double price, TradeType oper)
{
OrganizarVetores();
if (oper == TradeType.Buy)
{
for (var i = 1; i < sr.Count() - 1; i++)
{
if (tendencia.velocidade.LastValue > 0 && price - sr[i] > 10 * Symbol.PipSize)
if (sr[i] < price)
{
idx = i;
return sr[i];
break;
}
if (tendencia.velocidade.LastValue < 0 && price - sr[i] > 10 * Symbol.PipSize)
if (sr[i] < price)
{
idx = i + 1;
return sr[i + 1];
break;
}
}
}
if (oper == TradeType.Sell)
{
sr.Sort();
for (var i = 1; i < sr.Count() - 1; i++)
{
if (tendencia.velocidade.LastValue < 0 && sr[i] - price > 10 * Symbol.PipSize)
{
if (sr[i] > price)
{
idx = i;
return sr[i];
break;
}
}
if (tendencia.velocidade.LastValue > 0 && sr[i] - price > 10 * Symbol.PipSize)
if (sr[i] > price)
{
idx = i + 1;
return sr[i + 1];
break;
}
}
}
return 0;
}
protected override void OnPositionOpened(Position posicaoaberta)
{
posicao = posicaoaberta;
Print("Nova posição aberta\n");
}
protected override void OnPositionClosed(Position posicaoaberta)
{
posicao = null;
}
protected override void OnStop()
{
Trade.DeletePendingOrder(ordemv);
Trade.DeletePendingOrder(ordemc);
}
}
}
FibonacciBands indicator:
//#reference: ..\Indicators\AverageTrueRange.algo
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true)]
public class FibonacciBandsOriginal : Indicator
{
private AverageTrueRange _averageTrueRange;
private ExponentialMovingAverage _exponentialMovingAverage;
[Parameter(DefaultValue = 55)]
public int PeriodEma { get; set; }
[Parameter(DefaultValue = 21)]
public int PeriodAtr { get; set; }
[Output("Upper Band 1", Color = Colors.DarkCyan)]
public IndicatorDataSeries UpperBand1 { get; set; }
[Output("Upper Band 2", Color = Colors.DarkCyan)]
public IndicatorDataSeries UpperBand2 { get; set; }
[Output("Upper Band 3", Color = Colors.DarkCyan)]
public IndicatorDataSeries UpperBand3 { get; set; }
[Output("Upper Band 4", Color = Colors.DarkCyan)]
public IndicatorDataSeries UpperBand4 { get; set; }
[Output("Lower Band 1", Color = Colors.DarkGreen)]
public IndicatorDataSeries LowerBand1 { get; set; }
[Output("Lower Band 2", Color = Colors.DarkGreen)]
public IndicatorDataSeries LowerBand2 { get; set; }
[Output("Lower Band 3", Color = Colors.DarkGreen)]
public IndicatorDataSeries LowerBand3 { get; set; }
[Output("Lower Band 4", Color = Colors.DarkGreen)]
public IndicatorDataSeries LowerBand4 { get; set; }
[Output("EMA", Color = Colors.Blue)]
public IndicatorDataSeries Ema { get; set; }
protected override void Initialize()
{
_averageTrueRange = Indicators.GetIndicator<AverageTrueRange>(PeriodAtr);
_exponentialMovingAverage = Indicators.ExponentialMovingAverage(MarketSeries.Close, PeriodEma);
}
public override void Calculate(int index)
{
double ema = _exponentialMovingAverage.Result[index];
double atr = _averageTrueRange.Result[index];
UpperBand1[index] = ema + 1.62 * atr;
UpperBand2[index] = ema + 2.62 * atr;
UpperBand3[index] = ema + 4.23 * atr;
UpperBand4[index] = ema + 1 * atr;
LowerBand1[index] = ema - 1.62 * atr;
LowerBand2[index] = ema - 2.62 * atr;
LowerBand3[index] = ema - 4.23 * atr;
LowerBand4[index] = ema - 1 * atr;
Ema[index] = ema;
}
}
}
VelocityIndicator:
//The MIT License (MIT)
//Copyright (c) 2014 abdallah HACID, https://www.facebook.com/ab.hacid
//Permission is hereby granted, free of charge, to any person obtaining a copy of this software
//and associated documentation files (the "Software"), to deal in the Software without restriction,
//including without limitation the rights to use, copy, modify, merge, publish, distribute,
//sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
//is furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all copies or
//substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
//BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
//DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// Project Hosting for Open Source Software on Github : https://github.com/abhacid/cAlgoBot
// -------------------------------------------------------------------------------------------------
//
// Leonardo Hermoso, modifié par https://www.facebook.com/ab.hacid
//
// leonardo.hermoso arroba hotmail.com
// If you are going to modify this file please make a copy using the "Duplicate" command.
//
// -------------------------------------------------------------------------------------------------
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo.Indicators
{
[Indicator(TimeZone = TimeZones.UTC, IsOverlay = false, AccessRights = AccessRights.None)]
[Levels(-5, -3, -2, -1, -0.75, -0.5, -0.25, 0, 0.25, 0.5,
0.75, 1, 2, 3, 5)]
public class VelocityIndicator : Indicator
{
#region cIndicators Parammeters
[Parameter("Number Of Candle", DefaultValue = 5, MinValue = 1)]
public int NumberOfCandle { get; set; }
[Parameter("Moving Average", DefaultValue = MovingAverageType.Exponential)]
public MovingAverageType MovingAverageType { get; set; }
[Parameter("MA Period", DefaultValue = 14, MinValue = 2)]
public int Period { get; set; }
[Output("High Acceleration", Color = Colors.Green, Thickness = 1)]
public IndicatorDataSeries HighAccelerationSeries { get; set; }
[Output("Low Acceleration", Color = Colors.Red, Thickness = 1)]
public IndicatorDataSeries LowAccelerationSeries { get; set; }
[Output("Moving Average", Color = Colors.Blue, Thickness = 2)]
public IndicatorDataSeries MovingAverageSeries { get; set; }
#endregion
MovingAverage _movingAverage;
double _elapsedTime;
protected override void Initialize()
{
_movingAverage = Indicators.MovingAverage(HighAccelerationSeries, Period, MovingAverageType);
long elapsedTicks = (long)Math.Ceiling((NumberOfCandle + 0.5) * MarketSeries.TimeFrame.ToTimeSpan().Ticks);
TimeSpan elapsedSpan = new TimeSpan(elapsedTicks);
_elapsedTime = elapsedSpan.TotalSeconds;
}
/// <summary>
/// S = S0 + V0t +(at^2)/2 a = (2*(S-S0))/t^2.
/// v = v0 +at
/// </summary>
/// <param name="index"></param>
public override void Calculate(int index)
{
double high = MarketSeries.High[index];
double previewHigh = MarketSeries.High[index - NumberOfCandle];
double actualPriceOrHigh = (MarketSeries.Bars() - 1) == index ? Symbol.Mid() : high;
double low = MarketSeries.Low[index];
double previewLow = MarketSeries.Low[index - NumberOfCandle];
double actualPriceOrLow = (MarketSeries.Bars() - 1) == index ? Symbol.Mid() : low;
double highAcceleration = (2 * (high - previewHigh) / Math.Pow(_elapsedTime, 2)) * Math.Pow(10, 2 * Symbol.Digits);
double lowAcceleration = (2 * (low - previewLow) / Math.Pow(_elapsedTime, 2)) * Math.Pow(10, 2 * Symbol.Digits);
HighAccelerationSeries[index] = highAcceleration;
LowAccelerationSeries[index] = lowAcceleration;
MovingAverageSeries[index] = _movingAverage.Result[index];
// Print("{0} {1} {2} {3} {4}",highAcceleration, lowAcceleration, elapsedTime, MarketSeries.Bars()-1, index);
}
}
}
and the same indicator but the name is Velocidade:
//The MIT License (MIT)
//Copyright (c) 2014 abdallah HACID, https://www.facebook.com/ab.hacid
//Permission is hereby granted, free of charge, to any person obtaining a copy of this software
//and associated documentation files (the "Software"), to deal in the Software without restriction,
//including without limitation the rights to use, copy, modify, merge, publish, distribute,
//sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
//is furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all copies or
//substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
//BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
//DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// Project Hosting for Open Source Software on Github : https://github.com/abhacid/cAlgoBot
// -------------------------------------------------------------------------------------------------
//
// Leonardo Hermoso, modifié par https://www.facebook.com/ab.hacid
//
// leonardo.hermoso arroba hotmail.com
// If you are going to modify this file please make a copy using the "Duplicate" command.
//
// -------------------------------------------------------------------------------------------------
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Lib;
namespace cAlgo.Indicators
{
[Indicator(TimeZone = TimeZones.UTC, IsOverlay = false, AccessRights = AccessRights.None)]
[Levels(-5, -3, -2, -1, -0.75, -0.5, -0.25, 0, 0.25, 0.5,
0.75, 1, 2, 3, 5)]
public class VelocityIndicator : Indicator
{
#region cIndicators Parammeters
[Parameter("Number Of Candle", DefaultValue = 5, MinValue = 1)]
public int NumberOfCandle { get; set; }
[Parameter("Moving Average", DefaultValue = MovingAverageType.Exponential)]
public MovingAverageType MovingAverageType { get; set; }
[Parameter("MA Period", DefaultValue = 14, MinValue = 2)]
public int Period { get; set; }
[Output("High Acceleration", Color = Colors.Green, Thickness = 1)]
public IndicatorDataSeries HighAccelerationSeries { get; set; }
[Output("Low Acceleration", Color = Colors.Red, Thickness = 1)]
public IndicatorDataSeries LowAccelerationSeries { get; set; }
[Output("Moving Average", Color = Colors.Blue, Thickness = 2)]
public IndicatorDataSeries MovingAverageSeries { get; set; }
#endregion
MovingAverage _movingAverage;
double _elapsedTime;
protected override void Initialize()
{
_movingAverage = Indicators.MovingAverage(HighAccelerationSeries, Period, MovingAverageType);
long elapsedTicks = (long)Math.Ceiling((NumberOfCandle + 0.5) * MarketSeries.TimeFrame.ToTimeSpan().Ticks);
TimeSpan elapsedSpan = new TimeSpan(elapsedTicks);
_elapsedTime = elapsedSpan.TotalSeconds;
}
/// <summary>
/// S = S0 + V0t +(at^2)/2 a = (2*(S-S0))/t^2.
/// v = v0 +at
/// </summary>
/// <param name="index"></param>
public override void Calculate(int index)
{
double high = MarketSeries.High[index];
double previewHigh = MarketSeries.High[index - NumberOfCandle];
double actualPriceOrHigh = (MarketSeries.Bars() - 1) == index ? Symbol.Mid() : high;
double low = MarketSeries.Low[index];
double previewLow = MarketSeries.Low[index - NumberOfCandle];
double actualPriceOrLow = (MarketSeries.Bars() - 1) == index ? Symbol.Mid() : low;
double highAcceleration = (2 * (high - previewHigh) / Math.Pow(_elapsedTime, 2)) * Math.Pow(10, 2 * Symbol.Digits);
double lowAcceleration = (2 * (low - previewLow) / Math.Pow(_elapsedTime, 2)) * Math.Pow(10, 2 * Symbol.Digits);
HighAccelerationSeries[index] = highAcceleration;
LowAccelerationSeries[index] = lowAcceleration;
MovingAverageSeries[index] = _movingAverage.Result[index];
// Print("{0} {1} {2} {3} {4}",highAcceleration, lowAcceleration, elapsedTime, MarketSeries.Bars()-1, index);
}
}
}
@cTrader_Robot
pick
02 Aug 2023, 14:00
The name of that function seems pretty straightforward - it would just be converting a TimeFrame to a TimeSpan.
Just by clicking onto that velocity indicator link, you can find their github. This is the file you require:
https://github.com/abhacid/cAlgoBot/blob/master/Sources/Library/cAlgoLib/TimeFrameExtensions.cs
@pick
PanagiotisChar
02 Aug 2023, 05:34
Hi there,
Where did you get this code?
Aieden Technologies
Need help? Join us on Telegram
@PanagiotisChar