ChatGPT cBot Issues

Created at 07 Jan 2024, 20:24
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
DA

danerius

Joined 07.01.2024

ChatGPT cBot Issues
07 Jan 2024, 20:24


04/01/2024 02:00:00.000 | CBot instance [DanRobot, BTCUSD, Re40] started. 04/01/2024 02:00:00.000 | Indicator instance [DoubleRenko, BTCUSD, Re40] loaded. 04/01/2024 02:00:00.000 | Indicator instance [Average True Range, BTCUSD, Re40] loaded. 04/01/2024 02:00:00.000 | CBot instance [DanRobot, BTCUSD, Re40] crashed with error #F00E2180. using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.Indicators; using System; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class DanRobot : Robot { [Parameter("Quantity (Lots)", DefaultValue = 1, MinValue = 0.01, Step = 0.01)] public double Quantity { get; set; } // Additional parameters for DoubleRenko public DoubleRenko doubleRenko; public const string label = "DoubleRenko Trend cBot"; // Log method here private void Log(string message) { Print($"[{Time}] {message}"); } protected override void OnStart() { // Initialize DoubleRenko Log($"Initializing DoubleRenko with parameters: 12, 1.0, 1.0, 1000, MovingAverageType.Exponential"); doubleRenko = Indicators.GetIndicator<DoubleRenko>(12, 1.0, 1.0, 1000, MovingAverageType.Exponential); Log("DoubleRenko initialized."); } protected override void OnBar() { try { Log("OnBar started"); if (doubleRenko.CurrentBrick.Count < 2) { Log("Not enough data for CurrentBrick"); return; } double currentBrick = doubleRenko.CurrentBrick.Last(0); double previousBrick = doubleRenko.CurrentBrick.Last(1); Log($"CurrentBrick: {currentBrick}, PreviousBrick: {previousBrick}"); if (double.IsNaN(currentBrick) || double.IsNaN(previousBrick)) { Log("NaN value encountered in CurrentBrick"); return; } // Check for existing positions var longPosition = Positions.Find(label, SymbolName, TradeType.Buy); var shortPosition = Positions.Find(label, SymbolName, TradeType.Sell); // Trend detection and trading logic if (currentBrick > previousBrick && longPosition == null) { if (shortPosition != null) ClosePosition(shortPosition); ExecuteMarketOrder(TradeType.Buy, SymbolName, VolumeInUnits, label); } else if (currentBrick < previousBrick && shortPosition == null) { if (longPosition != null) ClosePosition(longPosition); ExecuteMarketOrder(TradeType.Sell, SymbolName, VolumeInUnits, label); } Log("OnBar completed without errors"); } catch (Exception ex) { Log($"Error in OnBar: {ex.Message}"); } } public double VolumeInUnits { get { return Symbol.QuantityToVolumeInUnits(Quantity); } } } }


@danerius
Replies

PanagiotisCharalampous
08 Jan 2024, 06:59

Dear darenius,

If you need assistance with your cBot, you would need to provide at least the following information

  • What is the cBot supposed to do?
  • What does it do instead?
  • What is the exact problem you are trying to solve?

Best regards,

Panagiotis


@PanagiotisCharalampous

danerius
08 Jan 2024, 17:44 ( Updated at: 09 Jan 2024, 06:34 )

RE: ChatGPT cBot Issues

PanagiotisCharalampous said: 

Dear darenius,

If you need assistance with your cBot, you would need to provide at least the following information

  • What is the cBot supposed to do?
  • What does it do instead?
  • What is the exact problem you are trying to solve?

Best regards,

Panagiotis

Hello Panagiotis and thanks for getting back to me

Ive been working too long on trying to fix the cBot, my brain was fried and I completely missed providing more information. Sorry about that. And pardon the messy look of the code. I used the “code” function, hope you can read it anyways.

- The major issue is that its not performing any Buys or Sells. Im not even sure if its the code or my settings for the demo account. The Log messages reads:

04/01/2024 02:00:00.000 | CBot instance [DanRobot, BTCUSD, Re40] started. 
04/01/2024 02:00:00.000 | Indicator instance [DoubleRenko, BTCUSD, Re40] loaded. 
04/01/2024 02:00:00.000 | Indicator instance [Average True Range, BTCUSD, Re40] loaded. 
04/01/2024 02:00:00.000 | CBot instance [DanRobot, BTCUSD, Re40] crashed with error #F00E2180.

Lets start there and see if we can find a way to make the cBot work. Thanks /Bo


@danerius

PanagiotisCharalampous
09 Jan 2024, 06:45

RE: RE: ChatGPT cBot Issues

danerius said: 

PanagiotisCharalampous said: 

Dear darenius,

If you need assistance with your cBot, you would need to provide at least the following information

  • What is the cBot supposed to do?
  • What does it do instead?
  • What is the exact problem you are trying to solve?

Best regards,

Panagiotis

Hello Panagiotis and thanks for getting back to me

Ive been working too long on trying to fix the cBot, my brain was fried and I completely missed providing more information. Sorry about that. And pardon the messy look of the code. I used the “code” function, hope you can read it anyways.

- The major issue is that its not performing any Buys or Sells. Im not even sure if its the code or my settings for the demo account. The Log messages reads:

04/01/2024 02:00:00.000 | CBot instance [DanRobot, BTCUSD, Re40] started. 
04/01/2024 02:00:00.000 | Indicator instance [DoubleRenko, BTCUSD, Re40] loaded. 
04/01/2024 02:00:00.000 | Indicator instance [Average True Range, BTCUSD, Re40] loaded. 
04/01/2024 02:00:00.000 | CBot instance [DanRobot, BTCUSD, Re40] crashed with error #F00E2180.

Lets start there and see if we can find a way to make the cBot work. Thanks /Bo

Hi danerius,

I still do not have the code in a readable format. Can you please fix the format so that we can copy/paste and build it?

Best regards,

Panagiotis


@PanagiotisCharalampous

danerius
09 Jan 2024, 14:06

RE: RE: RE: ChatGPT cBot Issues

PanagiotisCharalampous said: 

danerius said: 

PanagiotisCharalampous said: 

Dear darenius,

If you need assistance with your cBot, you would need to provide at least the following information

  • What is the cBot supposed to do?
  • What does it do instead?
  • What is the exact problem you are trying to solve?

Best regards,

Panagiotis

Hello Panagiotis and thanks for getting back to me

Ive been working too long on trying to fix the cBot, my brain was fried and I completely missed providing more information. Sorry about that. And pardon the messy look of the code. I used the “code” function, hope you can read it anyways.

- The major issue is that its not performing any Buys or Sells. Im not even sure if its the code or my settings for the demo account. The Log messages reads:

04/01/2024 02:00:00.000 | CBot instance [DanRobot, BTCUSD, Re40] started. 
04/01/2024 02:00:00.000 | Indicator instance [DoubleRenko, BTCUSD, Re40] loaded. 
04/01/2024 02:00:00.000 | Indicator instance [Average True Range, BTCUSD, Re40] loaded. 
04/01/2024 02:00:00.000 | CBot instance [DanRobot, BTCUSD, Re40] crashed with error #F00E2180.

Lets start there and see if we can find a way to make the cBot work. Thanks /Bo

Hi danerius,

I still do not have the code in a readable format. Can you please fix the format so that we can copy/paste and build it?

Best regards,

Panagiotis

Hi. Sure. Here it is….


using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System;

namespace cAlgo.Robots
{
   [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
   public class DanRobot : Robot
   {
       [Parameter("Quantity (Lots)", DefaultValue = 1, MinValue = 0.01, Step = 0.01)]
       public double Quantity { get; set; }

       // Additional parameters for DoubleRenko

       public DoubleRenko doubleRenko;
       public const string label = "DoubleRenko Trend cBot";
       
       // Log method here
       private void Log(string message)
       {
           Print($"[{Time}] {message}");
       }

       protected override void OnStart()
        {
           // Initialize DoubleRenko
           Log($"Initializing DoubleRenko with parameters: 12, 1.0, 1.0, 1000, MovingAverageType.Exponential");
           doubleRenko = Indicators.GetIndicator<DoubleRenko>(12, 1.0, 1.0, 1000, MovingAverageType.Exponential);
           Log("DoubleRenko initialized.");
       }


protected override void OnBar()
{
   try
   {
       Log("OnBar started");

       if (doubleRenko.CurrentBrick.Count < 2)
       {
           Log("Not enough data for CurrentBrick");
           return;
       }

       double currentBrick = doubleRenko.CurrentBrick.Last(0);
       double previousBrick = doubleRenko.CurrentBrick.Last(1);

       Log($"CurrentBrick: {currentBrick}, PreviousBrick: {previousBrick}");

       if (double.IsNaN(currentBrick) || double.IsNaN(previousBrick))
       {
           Log("NaN value encountered in CurrentBrick");
           return;
       }

       // Check for existing positions
       var longPosition = Positions.Find(label, SymbolName, TradeType.Buy);
       var shortPosition = Positions.Find(label, SymbolName, TradeType.Sell);

       // Trend detection and trading logic
       if (currentBrick > previousBrick && longPosition == null)
       {
           if (shortPosition != null)
               ClosePosition(shortPosition);

           ExecuteMarketOrder(TradeType.Buy, SymbolName, VolumeInUnits, label);
       }
       else if (currentBrick < previousBrick && shortPosition == null)
       {
           if (longPosition != null)
               ClosePosition(longPosition);

           ExecuteMarketOrder(TradeType.Sell, SymbolName, VolumeInUnits, label);
       }

       Log("OnBar completed without errors");
   }
   catch (Exception ex)
   {
       Log($"Error in OnBar: {ex.Message}");
   }
}


       public double VolumeInUnits
       {
           get { return Symbol.QuantityToVolumeInUnits(Quantity); }
       }
   }
}
 


@danerius

PanagiotisCharalampous
10 Jan 2024, 07:34

RE: RE: RE: RE: ChatGPT cBot Issues

danerius said: 

PanagiotisCharalampous said: 

danerius said: 

PanagiotisCharalampous said: 

Dear darenius,

If you need assistance with your cBot, you would need to provide at least the following information

  • What is the cBot supposed to do?
  • What does it do instead?
  • What is the exact problem you are trying to solve?

Best regards,

Panagiotis

Hello Panagiotis and thanks for getting back to me

Ive been working too long on trying to fix the cBot, my brain was fried and I completely missed providing more information. Sorry about that. And pardon the messy look of the code. I used the “code” function, hope you can read it anyways.

- The major issue is that its not performing any Buys or Sells. Im not even sure if its the code or my settings for the demo account. The Log messages reads:

04/01/2024 02:00:00.000 | CBot instance [DanRobot, BTCUSD, Re40] started. 
04/01/2024 02:00:00.000 | Indicator instance [DoubleRenko, BTCUSD, Re40] loaded. 
04/01/2024 02:00:00.000 | Indicator instance [Average True Range, BTCUSD, Re40] loaded. 
04/01/2024 02:00:00.000 | CBot instance [DanRobot, BTCUSD, Re40] crashed with error #F00E2180.

Lets start there and see if we can find a way to make the cBot work. Thanks /Bo

Hi danerius,

I still do not have the code in a readable format. Can you please fix the format so that we can copy/paste and build it?

Best regards,

Panagiotis

Hi. Sure. Here it is….


using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System;

namespace cAlgo.Robots
{
   [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
   public class DanRobot : Robot
   {
       [Parameter("Quantity (Lots)", DefaultValue = 1, MinValue = 0.01, Step = 0.01)]
       public double Quantity { get; set; }

       // Additional parameters for DoubleRenko

       public DoubleRenko doubleRenko;
       public const string label = "DoubleRenko Trend cBot";
       
       // Log method here
       private void Log(string message)
       {
           Print($"[{Time}] {message}");
       }

       protected override void OnStart()
        {
           // Initialize DoubleRenko
           Log($"Initializing DoubleRenko with parameters: 12, 1.0, 1.0, 1000, MovingAverageType.Exponential");
           doubleRenko = Indicators.GetIndicator<DoubleRenko>(12, 1.0, 1.0, 1000, MovingAverageType.Exponential);
           Log("DoubleRenko initialized.");
       }


protected override void OnBar()
{
   try
   {
       Log("OnBar started");

       if (doubleRenko.CurrentBrick.Count < 2)
       {
           Log("Not enough data for CurrentBrick");
           return;
       }

       double currentBrick = doubleRenko.CurrentBrick.Last(0);
       double previousBrick = doubleRenko.CurrentBrick.Last(1);

       Log($"CurrentBrick: {currentBrick}, PreviousBrick: {previousBrick}");

       if (double.IsNaN(currentBrick) || double.IsNaN(previousBrick))
       {
           Log("NaN value encountered in CurrentBrick");
           return;
       }

       // Check for existing positions
       var longPosition = Positions.Find(label, SymbolName, TradeType.Buy);
       var shortPosition = Positions.Find(label, SymbolName, TradeType.Sell);

       // Trend detection and trading logic
       if (currentBrick > previousBrick && longPosition == null)
       {
           if (shortPosition != null)
               ClosePosition(shortPosition);

           ExecuteMarketOrder(TradeType.Buy, SymbolName, VolumeInUnits, label);
       }
       else if (currentBrick < previousBrick && shortPosition == null)
       {
           if (longPosition != null)
               ClosePosition(longPosition);

           ExecuteMarketOrder(TradeType.Sell, SymbolName, VolumeInUnits, label);
       }

       Log("OnBar completed without errors");
   }
   catch (Exception ex)
   {
       Log($"Error in OnBar: {ex.Message}");
   }
}


       public double VolumeInUnits
       {
           get { return Symbol.QuantityToVolumeInUnits(Quantity); }
       }
   }
}
 

Can you please advise what DoubleRenko is?

public DoubleRenko doubleRenko;

 


@PanagiotisCharalampous

danerius
10 Jan 2024, 18:18

RE: RE: RE: ChatGPT cBot Issues

Hi danerius,

I still do not have the code in a readable format. Can you please fix the format so that we can copy/paste and build it?

Best regards,

Panagiotis

Hi. I posted the code earlier but hree it is again. Thanks /Bo


using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System;

namespace cAlgo.Robots
{
   [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
   public class DanRobot : Robot
   {
       [Parameter("Quantity (Lots)", DefaultValue = 1, MinValue = 0.01, Step = 0.01)]
       public double Quantity { get; set; }

       // Additional parameters for DoubleRenko

       public DoubleRenko doubleRenko;
       public const string label = "DoubleRenko Trend cBot";
       
       // Log method here
       private void Log(string message)
       {
           Print($"[{Time}] {message}");
       }

       protected override void OnStart()
        {
           // Initialize DoubleRenko
           Log($"Initializing DoubleRenko with parameters: 12, 1.0, 1.0, 1000, MovingAverageType.Exponential");
           doubleRenko = Indicators.GetIndicator<DoubleRenko>(12, 1.0, 1.0, 1000, MovingAverageType.Exponential);
           Log("DoubleRenko initialized.");
       }


protected override void OnBar()
{
   try
   {
       Log("OnBar started");

       if (doubleRenko.CurrentBrick.Count < 2)
       {
           Log("Not enough data for CurrentBrick");
           return;
       }

       double currentBrick = doubleRenko.CurrentBrick.Last(0);
       double previousBrick = doubleRenko.CurrentBrick.Last(1);

       Log($"CurrentBrick: {currentBrick}, PreviousBrick: {previousBrick}");

       if (double.IsNaN(currentBrick) || double.IsNaN(previousBrick))
       {
           Log("NaN value encountered in CurrentBrick");
           return;
       }

       // Check for existing positions
       var longPosition = Positions.Find(label, SymbolName, TradeType.Buy);
       var shortPosition = Positions.Find(label, SymbolName, TradeType.Sell);

       // Trend detection and trading logic
       if (currentBrick > previousBrick && longPosition == null)
       {
           if (shortPosition != null)
               ClosePosition(shortPosition);

           ExecuteMarketOrder(TradeType.Buy, SymbolName, VolumeInUnits, label);
       }
       else if (currentBrick < previousBrick && shortPosition == null)
       {
           if (longPosition != null)
               ClosePosition(longPosition);

           ExecuteMarketOrder(TradeType.Sell, SymbolName, VolumeInUnits, label);
       }

       Log("OnBar completed without errors");
   }
   catch (Exception ex)
   {
       Log($"Error in OnBar: {ex.Message}");
   }
}


       public double VolumeInUnits
       {
           get { return Symbol.QuantityToVolumeInUnits(Quantity); }
       }
   }
}
 


@danerius

PanagiotisCharalampous
11 Jan 2024, 06:30

RE: RE: RE: RE: ChatGPT cBot Issues

danerius said: 

Hi danerius,

I still do not have the code in a readable format. Can you please fix the format so that we can copy/paste and build it?

Best regards,

Panagiotis

Hi. I posted the code earlier but hree it is again. Thanks /Bo


using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System;

namespace cAlgo.Robots
{
   [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
   public class DanRobot : Robot
   {
       [Parameter("Quantity (Lots)", DefaultValue = 1, MinValue = 0.01, Step = 0.01)]
       public double Quantity { get; set; }

       // Additional parameters for DoubleRenko

       public DoubleRenko doubleRenko;
       public const string label = "DoubleRenko Trend cBot";
       
       // Log method here
       private void Log(string message)
       {
           Print($"[{Time}] {message}");
       }

       protected override void OnStart()
        {
           // Initialize DoubleRenko
           Log($"Initializing DoubleRenko with parameters: 12, 1.0, 1.0, 1000, MovingAverageType.Exponential");
           doubleRenko = Indicators.GetIndicator<DoubleRenko>(12, 1.0, 1.0, 1000, MovingAverageType.Exponential);
           Log("DoubleRenko initialized.");
       }


protected override void OnBar()
{
   try
   {
       Log("OnBar started");

       if (doubleRenko.CurrentBrick.Count < 2)
       {
           Log("Not enough data for CurrentBrick");
           return;
       }

       double currentBrick = doubleRenko.CurrentBrick.Last(0);
       double previousBrick = doubleRenko.CurrentBrick.Last(1);

       Log($"CurrentBrick: {currentBrick}, PreviousBrick: {previousBrick}");

       if (double.IsNaN(currentBrick) || double.IsNaN(previousBrick))
       {
           Log("NaN value encountered in CurrentBrick");
           return;
       }

       // Check for existing positions
       var longPosition = Positions.Find(label, SymbolName, TradeType.Buy);
       var shortPosition = Positions.Find(label, SymbolName, TradeType.Sell);

       // Trend detection and trading logic
       if (currentBrick > previousBrick && longPosition == null)
       {
           if (shortPosition != null)
               ClosePosition(shortPosition);

           ExecuteMarketOrder(TradeType.Buy, SymbolName, VolumeInUnits, label);
       }
       else if (currentBrick < previousBrick && shortPosition == null)
       {
           if (longPosition != null)
               ClosePosition(longPosition);

           ExecuteMarketOrder(TradeType.Sell, SymbolName, VolumeInUnits, label);
       }

       Log("OnBar completed without errors");
   }
   catch (Exception ex)
   {
       Log($"Error in OnBar: {ex.Message}");
   }
}


       public double VolumeInUnits
       {
           get { return Symbol.QuantityToVolumeInUnits(Quantity); }
       }
   }
}
 

It seems you missed my response.

Can you please advise what DoubleRenko is?

public DoubleRenko doubleRenko;

 


@PanagiotisCharalampous

danerius
11 Jan 2024, 19:28

RE: RE: RE: RE: RE: ChatGPT cBot Issues

PanagiotisCharalampous said: 

It seems you missed my response.

Can you please advise what DoubleRenko is?

public DoubleRenko doubleRenko;

 

Apparently I did :)

DoubleRenko is a modified version of mRenkoLineBreak. Heres the code for DoubleRenko

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{    
   [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
   public class DoubleRenko : Indicator
   {
       [Parameter("ATR Periods (default 12)", DefaultValue = 12, MinValue = 2)]
       public int AtrPeriods { get; set; }

       [Parameter("ATR Exponent (default 1.0)", DefaultValue = 1.0, MinValue = 1.0, MaxValue = 2.0)]
       public double AtrExponent { get; set; }

       [Parameter("ATR Multiplier (default 1.0)", DefaultValue = 1.0)]
       public double AtrMultiplier { get; set; }

       [Parameter("Lookback Period (default 1000)", DefaultValue = 1000, MinValue = 1)]
       public int LookbackPeriod { get; set; }

       [Parameter("ATR Smoothing Type", DefaultValue = MovingAverageType.Exponential)]
       public MovingAverageType AtrSmoothingType { get; set; }

       [Output("Renko Top", LineColor = "Gray")]
       public IndicatorDataSeries RenkoTop { get; set; }

       [Output("Renko Bottom", LineColor = "Gray")]
       public IndicatorDataSeries RenkoBottom { get; set; }

       [Output("Current Brick", LineColor = "White", Thickness = 1)]
       public IndicatorDataSeries CurrentBrick { get; set; }

       public double _brickSize;
       public AverageTrueRange _atr;
       public bool _isAscending = true;
 

       protected override void Initialize()
       {
           _atr = Indicators.AverageTrueRange(AtrPeriods, AtrSmoothingType);
       }

       public override void Calculate(int index)
{
   if (index < LookbackPeriod)
   {
       RenkoTop[index] = double.NaN;
       RenkoBottom[index] = double.NaN;
       CurrentBrick[index] = double.NaN;
       return;
   }
   
   double atrValue = _atr.Result[index];
   _brickSize = AtrMultiplier * Math.Pow(atrValue, AtrExponent);

   if (index == LookbackPeriod)
   {
       RenkoTop[index] = Bars.ClosePrices[index];
       RenkoBottom[index] = Bars.ClosePrices[index] - _brickSize;
       _isAscending = Bars.ClosePrices[index] > Bars.ClosePrices[index - 1];
   }
   else
   {
       RenkoTop[index] = RenkoTop[index - 1];
       RenkoBottom[index] = RenkoBottom[index - 1];

       if (Bars.ClosePrices[index] >= RenkoTop[index] + _brickSize)
       {
           _isAscending = true;
           RenkoTop[index] = RenkoTop[index - 1] + _brickSize;
           RenkoBottom[index] = RenkoTop[index] - _brickSize;
       }
       else if (Bars.ClosePrices[index] <= RenkoBottom[index] - _brickSize)
       {
           _isAscending = false;
           RenkoBottom[index] = RenkoBottom[index - 1] - _brickSize;
           RenkoTop[index] = RenkoBottom[index] + _brickSize;
       }
   }

   CurrentBrick[index] = _isAscending ? RenkoTop[index] : RenkoBottom[index];
   }
}
}


@danerius

PanagiotisCharalampous
12 Jan 2024, 07:15

RE: RE: RE: RE: RE: RE: ChatGPT cBot Issues

danerius said: 

PanagiotisCharalampous said: 

It seems you missed my response.

Can you please advise what DoubleRenko is?

public DoubleRenko doubleRenko;

 

Apparently I did :)

DoubleRenko is a modified version of mRenkoLineBreak. Heres the code for DoubleRenko

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{    
   [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
   public class DoubleRenko : Indicator
   {
       [Parameter("ATR Periods (default 12)", DefaultValue = 12, MinValue = 2)]
       public int AtrPeriods { get; set; }

       [Parameter("ATR Exponent (default 1.0)", DefaultValue = 1.0, MinValue = 1.0, MaxValue = 2.0)]
       public double AtrExponent { get; set; }

       [Parameter("ATR Multiplier (default 1.0)", DefaultValue = 1.0)]
       public double AtrMultiplier { get; set; }

       [Parameter("Lookback Period (default 1000)", DefaultValue = 1000, MinValue = 1)]
       public int LookbackPeriod { get; set; }

       [Parameter("ATR Smoothing Type", DefaultValue = MovingAverageType.Exponential)]
       public MovingAverageType AtrSmoothingType { get; set; }

       [Output("Renko Top", LineColor = "Gray")]
       public IndicatorDataSeries RenkoTop { get; set; }

       [Output("Renko Bottom", LineColor = "Gray")]
       public IndicatorDataSeries RenkoBottom { get; set; }

       [Output("Current Brick", LineColor = "White", Thickness = 1)]
       public IndicatorDataSeries CurrentBrick { get; set; }

       public double _brickSize;
       public AverageTrueRange _atr;
       public bool _isAscending = true;
 

       protected override void Initialize()
       {
           _atr = Indicators.AverageTrueRange(AtrPeriods, AtrSmoothingType);
       }

       public override void Calculate(int index)
{
   if (index < LookbackPeriod)
   {
       RenkoTop[index] = double.NaN;
       RenkoBottom[index] = double.NaN;
       CurrentBrick[index] = double.NaN;
       return;
   }
   
   double atrValue = _atr.Result[index];
   _brickSize = AtrMultiplier * Math.Pow(atrValue, AtrExponent);

   if (index == LookbackPeriod)
   {
       RenkoTop[index] = Bars.ClosePrices[index];
       RenkoBottom[index] = Bars.ClosePrices[index] - _brickSize;
       _isAscending = Bars.ClosePrices[index] > Bars.ClosePrices[index - 1];
   }
   else
   {
       RenkoTop[index] = RenkoTop[index - 1];
       RenkoBottom[index] = RenkoBottom[index - 1];

       if (Bars.ClosePrices[index] >= RenkoTop[index] + _brickSize)
       {
           _isAscending = true;
           RenkoTop[index] = RenkoTop[index - 1] + _brickSize;
           RenkoBottom[index] = RenkoTop[index] - _brickSize;
       }
       else if (Bars.ClosePrices[index] <= RenkoBottom[index] - _brickSize)
       {
           _isAscending = false;
           RenkoBottom[index] = RenkoBottom[index - 1] - _brickSize;
           RenkoTop[index] = RenkoBottom[index] + _brickSize;
       }
   }

   CurrentBrick[index] = _isAscending ? RenkoTop[index] : RenkoBottom[index];
   }
}
}

Hi danerius,

Thanks. It works fine on my side

 Could you please send us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.

 


@PanagiotisCharalampous

danerius
17 Jan 2024, 20:13 ( Updated at: 18 Jan 2024, 14:11 )

RE: RE: RE: RE: RE: RE: RE: ChatGPT cBot Issues

 

Hi danerius,

Thanks. It works fine on my side

 Could you please send us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.

 

Hello. I sent a report via the form on cTrader this saturday. No response yet. 

Regards /danerius


@danerius

PanagiotisCharalampous
19 Jan 2024, 06:46

RE: RE: RE: RE: RE: RE: RE: RE: ChatGPT cBot Issues

danerius said: 

 

Hi danerius,

Thanks. It works fine on my side

 Could you please send us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.

 

Hello. I sent a report via the form on cTrader this saturday. No response yet. 

Regards /danerius

Hi danerius,

The team has received the troubleshooting information and they are investigating the issue.

Best regards,

Panagiotis


@PanagiotisCharalampous