Topics
28 Feb 2023, 14:22
 42
 4162
 23
Replies

Capt.Z-Fort.Builder
30 Sep 2024, 13:13

Hello, 

Today the cTrader official version upgraded to 5.0.36, and my indicator encountered an error, after debugging it shows that the issue comes from the running step being disordered, as below screen chop:

Please help and advise, thanks…

using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using cAlgo.API;
using cAlgo.API.Internals;


namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class CurrencyStrengthProject : Indicator
    {
        private Bars BarsD1;
        private bool b_Cal=true;

        protected override void Initialize()
        {
            System.Diagnostics.Debugger.Launch();

            if (LoadDailyBar()) { Print("This line should be printed before Calculate() start: Initialize() - End"); }
        }

        public override void Calculate(int index)
        {
            if (b_Cal) { Print("Calculate() started"); b_Cal=false; }   	//Run only once
        }

        private bool LoadDailyBar()             							//Load DailyBar
        {
            BarsD1 = MarketData.GetBars(TimeFrame.Daily, Bars.SymbolName);	//Exceptions occurs here, it jumps to Calculate() from here...
            Print("This line should be printed before Calculate() start: " + BarsD1.SymbolName + " - " + BarsD1.Count );
            return true;
        }

    }

}

@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
30 May 2024, 17:49 ( Updated at: 31 May 2024, 05:27 )

RE: Drawing Object can't be locked programatically

PanagiotisCharalampous said: 

Hi there, 

Unfortunately we were not able to reproduce this problem. Can you please record a video demonstrating this happening?

Best regards,

Panagiotis

Here is the video I took, it's not professional looking, please volume up your speaker as my mic works poorly.

Basically, the code should (un)lock the object when it is selected. It works fine on the rectangle and others, but not on Drawing objects.  

The drawing objects just disappeared, and not possible to be found or seen on the chart anymore.  However, it is still listed in the Object Manager window.

Hopefully, this explains. 

Thanks for any advice or possible fixes.


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
26 May 2024, 10:44

RE: Where is my code problem on cTrader Customise Window Close and ReOpen

PanagiotisCharalampous said: 

Hi there,

If you close the window, then it does not exist anymore, you would need to reinitialize it. Once a window is closed, the same object instance can't be used to reopen the window.

Best regards,

Panagiotis

Thanks Panagiotis,
ChatGPT helped me optimised the code as below, and it works well now:
 

using cAlgo.API;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, ScalePrecision = 1, AccessRights = AccessRights.None)]
    public class TestWindow2 : Indicator
    {
        private Window wn_CWvFlt;
        private Canvas cv_canvas;
        private Button bt_Cncl;

        protected override void Initialize()
        {
            CreateWindow();
            Chart.KeyDown += Chart_KeyDown;
        }

        public override void Calculate(int index) { }

        private void CreateWindow()
        {
            wn_CWvFlt = new Window { Title = "Currency Wave...", Topmost = true };
            cv_canvas = new Canvas { Height = 600, Width = 800, Margin = "0 0 0 0", BackgroundColor = Color.FromHex("22000000"), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center };
            bt_Cncl = new Button { Text = "Hide", Top = 500, Left = 200 };

            cv_canvas.AddChild(bt_Cncl);
            wn_CWvFlt.Child = cv_canvas;
            bt_Cncl.Click += bt_Cncl_Click;
        }

        private void Chart_KeyDown(ChartKeyboardEventArgs obj)
        {
            if (obj.AltKey)
            {
                if (obj.Key.Equals(Key.M))
                {
                    if (wn_CWvFlt == null || !wn_CWvFlt.IsVisible)
                    {
                        CreateWindow();
                        wn_CWvFlt.Show();
                    }
                }
                else if (obj.Key.Equals(Key.N))
                {
                    wn_CWvFlt?.Hide();
                }
                else if (obj.Key.Equals(Key.B))
                {
                    wn_CWvFlt?.Close();
                    wn_CWvFlt = null;
                }
            }
        }

        private void bt_Cncl_Click(ButtonClickEventArgs obj) { wn_CWvFlt?.Hide(); }
    }
}

@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
16 May 2024, 20:56 ( Updated at: 16 May 2024, 20:58 )

As I know this function has been added to 5.0.19 πŸ‘πŸ‘πŸ‘πŸ‘


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
13 Dec 2023, 13:57 ( Updated at: 21 Dec 2023, 09:23 )

RE: Full screen mode leaves a white line at the edge of extended monitor

Try clicking β€˜fullscreen’ F11 from a size restored window,  if I click F11 ahead of the maximised window, the whiteline will be there. Good luck!

Sarpul said: 

I am having the same problem. Using ctrader fullscreen (f11) will show a large white/grey bar on the other screens:

 


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
07 Dec 2023, 13:44

πŸ‘


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
27 Aug 2023, 19:09 ( Updated at: 28 Aug 2023, 04:42 )

https://ctrader.com/algos/indicators/show/3120

This indicator can let you Alt+X to (un)lock objects like: ArrowLine, TrendLine, Rectangle, Icon, Text.

Hope it could be helpful.


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
28 Jul 2023, 17:22

Here is a method provided by a fellow (@TheLegitT) in the cTrader official group, though I didn't test, I believe it will work as suppose to be:

 private TimeSpan GetCurrentTimeSpan()
 {
     var TimeFrameName = Chart.TimeFrame.ToString();

     if (!int.TryParse(Regex.Replace(TimeFrameName, "[^0-9]", ""), out int prefix)) prefix = 1;

     if (TimeFrameName.Contains("Minute"))
         return TimeSpan.FromMinutes(prefix);
     else if (TimeFrameName.Contains("Hour"))
         return TimeSpan.FromHours(prefix);
     else if (TimeFrameName.Contains("Day") || TimeFrameName.Contains("Daily"))
         return TimeSpan.FromDays(prefix);
     else if (TimeFrameName == "Weekly")
         return TimeSpan.FromDays(7);
     else if (TimeFrameName == "Monthly")
         return TimeSpan.FromDays(31);
     else
         return TimeSpan.Zero;
 }

Usage:
 var CurrentTimeSpan = GetCurrentTimeSpan();

 if (CurrentTimeSpan == TimeSpan.Zero) // No supported TimeFrame available on Chart
 {

 }

 // TimeSpan is acquired properly

@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
03 Jul 2023, 21:14 ( Updated at: 21 Dec 2023, 09:23 )

Sorted by creating a bool scanningComplete where at the beginning of the code and to enter the code is true, at the end of the code is false.

While, it brings another interesting issue, below screen chops are debugging in VS:
At the end of Initialize() the Bars Count is more than 7K of Bars number, but in the Calculate(), when it scans each history bar, the Bars.Count() is far less than 7K. This makes the bool ScanningComplete check many times (2K+) until it reaches 7K+ the same number as in Initialize()...

Sorted, just make a new private integer to record the Bars.Count-2, and then use it in the bool ScanningComplete check (of HistoryBar scanning).  

It runs only once and perfectly fits my request now...   
Job done!


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
02 Jul 2023, 03:00 ( Updated at: 21 Dec 2023, 09:23 )

OK, I find an alternative way:

Ctrl + D to open the object manager, key in the keyword of the object's name, then Ctrl + A to select the relevant objects only.

P.S. However, the keywords 'USD' and 'JPY' don't work in the search bar, if the chart is in 'USDJPY'.  All other currencies' names work well. It's bizarre...


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
26 Jun 2023, 23:25 ( Updated at: 26 Jun 2023, 23:28 )

RE:

Thank you very much for your clarification. It totally makes sense. 

β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β˜…
β˜…β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β˜…

Spotware said:

Dear trader,

Our team has investigated this issue further and it seems that the feature is working as designed. The events are triggered only for interactive objects. If you want to the event to be triggered for an object added by the cBot, you need to set the IsInteractive property to true.

Best regards,

cTrader Team

 


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
15 May 2023, 16:03

The human world is already unfair for most ordinary people, I vote NO extending the tiered system to the money world!!


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
15 May 2023, 16:03

The human world is already unfair for most ordinary people, I vote NO extending the tiered system to the money world!!


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
22 Mar 2023, 13:49 ( Updated at: 21 Dec 2023, 09:23 )

RE:

Due to these new rules of listing strategies, there are investors saying they have trouble effectively selecting strategies as their candidate investment. As they can't see those good quality traders as they only trade limited times in a week or month. The new rules are doing actually harm to copy investors.  I hope cTrader and Spotware officially respond to our concerns and worries, as soon as you can.


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
21 Jan 2023, 22:37

This issue has been fixed in cTrader Desktop 4.5.7

 


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
28 Nov 2022, 13:55 ( Updated at: 21 Dec 2023, 09:23 )

RE:

Here is the only message I got from the log: 

My system installed another media player PotPlayer, I hope this won't matter the c# to playsound.

Thanks, if any advice.

PanagiotisChar said:

Hi there,

Yes and they work fine. Do you get any exceptions in the log?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

 


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
26 Nov 2022, 14:57 ( Updated at: 21 Dec 2023, 09:23 )

Someone suggests that in Object Manger, the indicators can be hidden, but we just want to hide the indicator panel, not the indicator itself.  We still need a control checkbox, to hide the indicator panel. Thanks.


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
24 Nov 2022, 20:53 ( Updated at: 21 Dec 2023, 09:23 )

Thanks, Panagiotis, let's wait for the new update and fix this issue.


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
24 Nov 2022, 18:47

RE:

The issue had been identified now: add '#' ahead of color numbers at indicator Output setting, like below

[Output("USD", LineColor = "#DDFF0005"...

I can't imagine that a colour code error will bring trouble to Bars loading, and no error message when compiling.  The error message when running was totally not pointing to the actual place.


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
24 Nov 2022, 18:36

RE:

The issue had been identified, Use hashtags and it works. Ie. "#DDFF0005" instead of "DDFF0005"

The code was made a long time ago, it seems that ver 4.5.1 is more rigorous in coding.  Thanks.


@Capt.Z-Fort.Builder