PanagiotisCharalampous's avatar
PanagiotisCharalampous
26 follower(s) 0 following 1006 subscription(s)
Replies

PanagiotisCharalampous
15 Jan 2024, 13:43

RE: Error when opening cTrader

ctid3999979 said: 

Hi

I'm getting the following error when opening cTrader. I have to Force Quit and go back to my Windows VM. I have tried reinstalling it.

Using Sonoma 14.2.1 (23C71) on M2 Max.

Hi there,

Can you please install the latest update and let us know if it resolves the issue?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Jan 2024, 13:01

Hi there,

All price data provided by cTrader brokers is free.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Jan 2024, 13:00

RE: RE: RE: RE: MarketData.GetBars hangs forever

Intetics said: 

PanagiotisCharalampous said: 

Intetics said: 

PanagiotisCharalampous said: 

Hi there,

Thanks for the information, we will investigate it

Best regards,

Panagiotis

HI PanagiotisCharalampous,

Did you guys manage to reproduce the issue?

Regards

Hi there,

Yes and we are working on a solution.

Best regards,

Panagiotis

Thanks @PanagiotisCharalampous. Is there a temporary solution/hack I could use locally while you're guys finishish a proper fix? It's just a showstopper that stops the whole work I'm doing. 

Unfortunately there isn't. It seems that some data of the specific broker is corrupted and needs to be fixed


@PanagiotisCharalampous

PanagiotisCharalampous
15 Jan 2024, 12:57

RE: String to double conversion

AndreaPereira said: 

Hi Panagiotis,

I trade gold in lots. For example 0.22 units. Thanks for the help.

 

 

Hi Andrea,

It seems you are converting your Quantity from quantity to volume in units. Hence the input is translated to lots, not to units. What symbol are you trading and what is the lot size?

Best regards,

Panagiotis

 

Hi Andrea,

What is the lot size of your broker e.g. for IC Markets is 100 units per lot. So if you type 0.22, it will trade 22 Oz of gold.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Jan 2024, 08:22

RE: advance protection

Hamidrz.babaeifar said: 

Hi

I installed the version pf MacBook c trader but the advance protection option is not exist on it and there is no even the bottom of advance option. I will be appreciated for helping me.

best regards.

Hi there,

This is not available at the moment, it will be added in an upcoming release.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Jan 2024, 08:13

RE: RE: String to double conversion

AndreaPereira said: 

Good morning, thanks, I will try to do as you say. 

14-01---ok I managed it but it gives me a problem. I put a textBox that takes a string and saves it in the Quantity variable. The latter is linked to the Button_Click_Buy function. In the execution phase I enter a value in the textbox, for example 0.10, I click the button and it opens the position without the decimal part so 10.00.
Another example: I enter 0.01 and set the variable to 1.00. What did I do wrong? Thank's my friend.

 [Parameter("Quantity (Lots)", Group = "Volume", DefaultValue = 0.20, MinValue = 0.01, Step = 0.01)]
 public double Quantity { get; set; }
 --
 --
 --
 private void TextBox_TextChanged(TextChangedEventArgs obj)
     {
         Quantity = Convert.ToDouble(obj.TextBox.Text);
     }

 

public void Button_Click_Buy(ButtonClickEventArgs obj)
    {
        var volumeInUnits = Symbol.QuantityToVolumeInUnits(Quantity);
        ExecuteMarketOrder(TradeType.Buy, SymbolName, volumeInUnits, "zero");
    }

 

PanagiotisCharalampous said: 

Hi Andrea,

You can use Convert.ToDouble() method.

Best regards,

Panagiotis

 

Hi Andrea,

It seems you are converting your Quantity from quantity to volume in units. Hence the input is translated to lots, not to units. What symbol are you trading and what is the lot size?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Jan 2024, 08:09

Hi there,

You can only do this if the strategy provider allows you to view his history.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Jan 2024, 08:06

Hi Waxy,

Can you share the cBot's code and log after the crash as well?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Jan 2024, 07:58

RE: RE: RE: RE: Open positions per Bar - OnTick

ryan.a.blake said: 

PanagiotisCharalampous said: 

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

Thanks Panagiotis,

Could you share an example code for this? 

I have added OnBar() but multiple trades are still opening. Have I placed everything correctly? 

    private SampleEMA _ema1 { get; set; }
        private SampleEMA _ema2 { get; set; }
         private SampleEMA _ema3 { get; set; }
        private RelativeStrengthIndex _rsi { get; set; }

private bool _canBuy;
 private bool _canSell;

        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);
      
        }            
                
protected override void OnBar()
               
               {
            _canSell = true;       
               }
               
         protected override void OnTick()
        {
        Print("OnTick");
        
     
           if (IncludeBreakEven == true)
                GoToBreakEven();
               

            var Ema1 = _ema1.Result.Last(0);
            var Ema2 = _ema2.Result.Last(0);
            var rising = _ema1.Result.IsRising();
            var falling = _ema2.Result.IsFalling();
            var rising2 = _ema2.Result.IsRising();
            var falling2 = _ema1.Result.IsFalling();
                    
             if (Ema1 < Ema2 && rising && rising2 && Symbol.Bid == Bars.OpenPrices.Last(0) + (pips * Symbol.PipSize))
              
            {
                _canBuy = false;
            }
                            
                     {
                      CloseBuy();
                      }
                      
                      
             
             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);
                }
                
                
                if(_canSell == true)
                 
                {
            if (Positions.Count(x => x.TradeType == TradeType.Sell && x.Label == InstanceName) >= 2)
            {
            _canSell = false;
             
               
                }
             
               }
               {
                    CloseSell();
                }
               
               }
                        
 
               
        private void CloseSell()
        {
        var Ema1 = _ema1.Result.Last(0);
            var Ema2 = _ema2.Result.Last(0); 
            foreach (var position in Positions)
                if (Ema1 < Ema2 && position.TradeType == TradeType.Sell)
                
                {
                    ClosePosition(position);
                }
        }


   private void CloseBuy()
        {
             var Ema1 = _ema1.Result.Last(0);
            var Ema2 = _ema2.Result.Last(0);
            foreach (var position in Positions)
                if (Ema1 > Ema2 && position.TradeType == TradeType.Buy)
                {
                    ClosePosition(position);
                }
        }

Hi Ryan,

The flag needs to be set to false immediately after the order is executed. You seem to set it to false at random positions. Unfortunately I do not have the time to write the entire strategy for you. If you are not able to code this yourself, you can request for professional assistance.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Jan 2024, 07:52

Hi there,

This is not possible at the moment however the team is considering this.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Jan 2024, 07:41

RE: RE: MarketData.GetBars hangs forever

Intetics said: 

PanagiotisCharalampous said: 

Hi there,

Thanks for the information, we will investigate it

Best regards,

Panagiotis

HI PanagiotisCharalampous,

Did you guys manage to reproduce the issue?

Regards

Hi there,

Yes and we are working on a solution.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
13 Jan 2024, 08:03

Hi there,

cTrader Copy works using an equity to equity model. Therefore the volume will be proportional to your strategy provider's volume. You cannot chance the volume yourself.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
13 Jan 2024, 08:00

Hi there,

Please send us some troubleshooting info and quote the link to this discussion by pasting a link to this discussion inside the text box before you submit it.

Best Regards,

Panagiotis 


 


@PanagiotisCharalampous

PanagiotisCharalampous
13 Jan 2024, 07:58

Hi Andrea,

You can use Convert.ToDouble() method.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
13 Jan 2024, 07:56

RE: RE: Button event

AndreaPereira said: 

I solved it with cbot and not with the indicator. However, I'm curious to see your solution. If you want I'll attach the code and tell me what you think.

 

Hi Andrea,

You cannot execute orders through indicators. It needs to be a cBot.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
12 Jan 2024, 13:02

Hi again,

It seems your broker does not offer this service. Please contact your broker instead.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
12 Jan 2024, 12:51

RE: Same problem

dan.kelly654 said: 

Hello,

I've been having the same problem for the last few days:

What was the fix?

Thanks

Hi there,

Can you please send us troubleshooting information as requested above?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
12 Jan 2024, 12:48

RE: RE: ctrader desktop vs ctrader tablet

valepi said: 

PanagiotisCharalampous said: 

Hi there,

Can you please advise your broker and share some screenshots?

Best regards,

Panagiotis

 

Hi valepi,

Thanks but you haven't shared your broker


@PanagiotisCharalampous

PanagiotisCharalampous
12 Jan 2024, 12:47

RE: RE: How to use custome indicator in CBOt?

lfdomingo143 said: 

PanagiotisCharalampous said: 

Hi there, 

Please explain what exact help to you need. Nobody will do the job for you but we are happy to help you do it yourself

Best regards,

Panagiotis

Hello!

Thank you for your reply.
I need to figure out how can I use/reference my code to custom indicators specifically KeltnerChannel ATR (average true range) instead of Keltner Channels (Simple) readily available indicator.

Hi again,

Check the video below, it should be helpful


@PanagiotisCharalampous

PanagiotisCharalampous
12 Jan 2024, 12:44

Hi Andrea,

Can you share your complete cBot code?

Best regards,

Panagiotis


@PanagiotisCharalampous