Replies

PanagiotisCharalampous
12 Jan 2024, 07:17

Hi there,

The correct property to modify is GroupName

Best regards,

Panagiotis


@PanagiotisCharalampous

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

PanagiotisCharalampous
12 Jan 2024, 07:08

Also try to reset your backtesting cache and let us know if this helps. Delete this folder and restart cTrader

C:\Users\%username%\AppData\Roaming\Spotware\Cache


@PanagiotisCharalampous

PanagiotisCharalampous
12 Jan 2024, 07:04

Hi Andrea,

You would need to provide a better explanation regarding how exactly you want to proceed. What exact information are you looking for?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
12 Jan 2024, 07:00

Hi there,

Thank you for reporting this issue. 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.

Best regards,

Panagiotis
 


@PanagiotisCharalampous

PanagiotisCharalampous
12 Jan 2024, 06:59

RE: RE: Open positions per Bar - OnTick

ryan.a.blake said: 

PanagiotisCharalampous said: 

Hi Ryan,

You can use a flag to achieve this e.g. bool CanTrade. Set it to false when a trade is taken and then set it back to true when a new bar is opened.

Best regards,

Panagiotis

 

Thanks Panagiotis,

I have attempted the code below, but believe I am missing something as it places multiple trades per bar, but trader per bar after bar is opened. I attempted to limit positions with Positions.Count, but that stops it being placed per bar. 

 

Have I missed something?

 

Thanks for your help.

 

private bool _canTrade;
private int barCountSinceLastPosition;
        protected override void OnStart()
        {
            _ema1 = Indicators.GetIndicator<SampleEMA>(Source1, Period1);
            _ema2 = Indicators.GetIndicator<SampleEMA>(Source2, Period2);
             _ema3 = Indicators.GetIndicator<SampleEMA>(Source3, Period3);
            _rsi = Indicators.RelativeStrengthIndex(Source3, Period3);
           
           Bars.BarOpened += Bar_Opened;
         }
        
           void Bar_Opened(BarOpenedEventArgs args)
                   {
                      _canTrade = false;
            
                   }
        
         protected override void OnTick()
        {   
           if (IncludeBreakEven == true)
                GoToBreakEven();
               
            var Ema1 = _ema1.Result.Last(0);
            var Ema2 = _ema2.Result.Last(0);
            var Ema1i = _ema1.Result.Last(2);
            var Ema2i = _ema2.Result.Last(2);
            var Ema3 = _ema3.Result.LastValue;
            var rising = _ema1.Result.IsRising();
            var falling = _ema2.Result.IsFalling();
            var rising2 = _ema2.Result.IsRising();
            var falling2 = _ema1.Result.IsFalling();
                          
             if (Ema1 > Ema2 && falling && falling2 && Symbol.Bid == Bars.OpenPrices.Last(0) - (pips * Symbol.PipSize))
            {
                
                   if (Positions.Count(x => x.TradeType == TradeType.Sell && x.Label == InstanceName) == 0)
                
                         {
                               double volume = Symbol.QuantityToVolumeInUnits(lotsize);
                               ExecuteMarketOrder(TradeType.Sell, SymbolName, volume, InstanceName, SL, TP);
                
                           }
                               {
                                  _canTrade = true;
                               }
                                    if(_canTrade)
                                    {
                                        if (Ema1 > Ema2 && falling && falling2 && Symbol.Bid == Bars.OpenPrices.Last(0) - (pips * Symbol.PipSize))
                                         {
                                             double volume = Symbol.QuantityToVolumeInUnits(lotsize);
                                             ExecuteMarketOrder(TradeType.Sell, SymbolName, volume, InstanceName, SL, TP);
                                         }
                                   }
                              }
                          {
                    CloseSell();
                     } 
                    
               }

Hi Ryan,

_canTrade needs to be set to false in OnTick() and to true in OnBar()

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
11 Jan 2024, 07:07

RE: RE: RE: Draw issue

razor_00 said: 

PanagiotisCharalampous said: 

GOLDEN.DRAGONS said: 

I got the same issue recently. When I would try to use any objects like Trend Line or Fibonacci Fan and etc. it will get out of mouse control when market is ticking but when a symbol stopped or disabled I can draw properly.
Using cTrader 4.8.28 on Errante

Hi there,

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.

Best regards,

I made a simple indicator that will cause this issue to occur 100% of the times. The line causing the issue is DrawText or drawing anything every tick, if I am drawing something or drawing on the chart window, the object will lose focus as soon as Calculate is invoked on the indicator.

Code below:

using System;using System.Collections.Generic;using System.Linq;using System.Text;using cAlgo.API;using cAlgo.API.Collections;using cAlgo.API.Indicators;using cAlgo.API.Internals;namespace cAlgo{    [Indicator(AccessRights = AccessRights.None, IsOverlay = false)]    public class DrawingBug : Indicator    {        public override void Calculate(int index)        {            IndicatorArea.RemoveObject("test");            IndicatorArea.DrawText("test", "BUG!!!", Bars.Last().OpenTime, 0, Color.Red);        }    }}

Hi razor_00,

Thank you, I have forwarded this to the product team for resolution. In the meanwhile, the issue is caused by the RemoveObject method, which in this case is redundant, you don't need to remove an object in order to redraw it. If you remove that line of code, it should fix the problem.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
11 Jan 2024, 06:40

Hi there,

The service seems to be working now, can you check again?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
11 Jan 2024, 06:40

Hi there,

The service seems to be working now, can you check again?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
11 Jan 2024, 06:36

RE: Same problem

strausa said: 

Hi, I am facing with the same problem. Could you please help me. Is there any limit with the account authorizations and revokes?

 

Hi there,

It looks ok now

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
11 Jan 2024, 06:33

Hi Ryan,

You can use a flag to achieve this e.g. bool CanTrade. Set it to false when a trade is taken and then set it back to true when a new bar is opened.

Best regards,

Panagiotis


@PanagiotisCharalampous

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

PanagiotisCharalampous
11 Jan 2024, 06:26

RE: cTrader Mobile - Unwanted notificationss

ncel01 said: 

Dear Panagiotis,

I am not convinced by your arguments, however I can accept this limitation.

In any case, the app act as an intermediary to send these notifications, which could be disabled/filtered in case an option for this was available.

I really believe that every step made by Spotware to provide traders with the tools to become less dependent on the brokers, would be highly appreciated by the community.

I've been noticing that some settings that are not even brokers' business but a sole traders' choice, still need to be requested to the brokers, which is very annoying (e.g. lowering an account leverage).

Thanks for considering the above.

Hi ncel01,

I am not trying to convince you about anything, I am explaining to you how it works. If you have a different opinion, feel free to post a suggestion and the product team will consider it.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
11 Jan 2024, 06:23

RE: RE: RE: RE: cTrader "pip scale" constantly goes flukey, and nowhere near being correct

firemyst said: 

PanagiotisCharalampous said: 

 

Hi firemyst,

Our team is still investigating this issue. Can you please send us the template you are using at 00:29 of the video?

Best regards,

Panagiotis

Sent as requested to the “community” address with subject ATTN PANAGIOTIS

Hopefully it'll help the team figure out what's going on.

Hi firemyst,

Thank you. Unfortunately we were not being able to reproduce this yet. But we will keep trying.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Jan 2024, 10:10

RE: RE: cTrader "pip scale" constantly goes flukey, and nowhere near being correct

firemyst said: 

PanagiotisCharalampous said: 

Hi firemyst,

Any chance you can provide us with more clear images? I cannot see the pip scale in these images.

Best regards,

Panagiotis

Any updates on this? Have they discovered the issue? It's getting to be real annoying. 

Check out the GER40 today in multichart mode.

You can see the same numbers on the right side of both charts, but notice how one chart is screwed and says “100” pips while the other is correct and says “10” pips based on the values:

 

 

Hi firemyst,

Our team is still investigating this issue. Can you please send us the template you are using at 00:29 of the video?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Jan 2024, 10:08

RE: cTrader Mobile - Unwanted notificationss

ncel01 said: 

Hello,

Yes, like any other user I have an account with some broker, but that's not the point to me.

Main point:

Would't make sense to have an option to turn the notifications off in the app itself? After all, these are sent via cTrader app, right?

Hi ncel01,

These notifications are sent by the broker, not by the cTrader app it self. In other words, they are not sent automatically by the platform as a response to an event happening in your account. They are sent by the broker on demand, it is equivalent to the broker emailing you directly. Therefore you need to talk to your broker regarding this matter.

Best regards,

Panagiotis   


@PanagiotisCharalampous

PanagiotisCharalampous
10 Jan 2024, 07:38

Hi there,

We have sorted out the issue through email communication.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Jan 2024, 07:37

You can use Math.Round to round the result


@PanagiotisCharalampous

PanagiotisCharalampous
10 Jan 2024, 07:35

Hi there,

If you want to delete the account, please send an email to community@ctrader.com

Best regards,

Panagiotis


@PanagiotisCharalampous

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