Replies

TommyFFX
07 Nov 2024, 22:32

RE: How to switch to open chart

TommyFFX said: 

The only solution I Found is to Detach the chart I want to see and Attach it back..
Then I have the option to switch between ChartFrames in code..

but this seems a bit strange..

I'm using a combobox to switch between ChartFrames..

 



        public void OnSymbolComboBox_SelectionChanged(ComboBoxSelectedItemChangedEventArgs e)

        {

                var symbol = string.IsNullOrEmpty(e.SelectedItem) ? null : tms.Symbols.GetSymbol(e.SelectedItem);

                if (symbol != null)

                {

                    var frames = FindAllChartFramesBySymbol(symbol);

                    var chartFrame = frames.FirstOrDefault();

                    if (chartFrame != null)

                    {

                        chartFrame.Detach();

                        chartFrame.Attach();

                    }

                }

        }

        public IEnumerable<ChartFrame> FindAllChartFrames()

        {

            return ChartManager.OfType<ChartFrame>();

        }

        public IEnumerable<ChartFrame> FindAllChartFramesBySymbol(Symbol symbol)

        {

            return FindAllChartFrames().Where(frame => frame.Chart.Symbol == symbol);

        }

 



Up


@TommyFFX

TommyFFX
05 Nov 2024, 00:52

The only solution I Found is to Detach the chart I want to see and Attach it back..
Then I have the option to switch between ChartFrames in code..

but this seems a bit strange..

I'm using a combobox to switch between ChartFrames..

 



        public void OnSymbolComboBox_SelectionChanged(ComboBoxSelectedItemChangedEventArgs e)

        {

                var symbol = string.IsNullOrEmpty(e.SelectedItem) ? null : tms.Symbols.GetSymbol(e.SelectedItem);

                if (symbol != null)

                {

                    var frames = FindAllChartFramesBySymbol(symbol);

                    var chartFrame = frames.FirstOrDefault();

                    if (chartFrame != null)

                    {

                        chartFrame.Detach();

                        chartFrame.Attach();

                    }

                }

        }

        public IEnumerable<ChartFrame> FindAllChartFrames()

        {

            return ChartManager.OfType<ChartFrame>();

        }

        public IEnumerable<ChartFrame> FindAllChartFramesBySymbol(Symbol symbol)

        {

            return FindAllChartFrames().Where(frame => frame.Chart.Symbol == symbol);

        }

 


@TommyFFX

TommyFFX
31 Oct 2024, 10:04 ( Updated at: 31 Oct 2024, 12:22 )

RE: RE: Move current time/bar of the chart in code

Even templates won't remember the positon..
I guess we are always fixed to the extreme right side right ?
And only have a manual ability to repeatedly adjust it..
Otherwise 
Any solutions are welcome

Thanks
TommyFFX





TommyFFX said: 

PanagiotisCharalampous said: 

Hi there,

There is no ScrollXto in your code. Can you share the full source code please?

Best regards,

Panagiotis


using cAlgo.API;

using cAlgo.API.Internals;

using System;

using System.IO;


 

namespace cAlgo.Plugins

{

    [Plugin(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

    public class ChartShotPluginExample : Plugin

    {

        private ChartFrame newChartFrame;

        protected override void OnStart()

        {

            Positions.Closed += OnPositionClosed;

        }

        public void OnPositionClosed(PositionClosedEventArgs args)

        {

            TakeChartShots(args.Position.Symbol);

        }

        public void TakeChartShots(Symbol symbol)

        {

            try

            {

                newChartFrame = ChartManager.AddChartFrame(symbol.Name, TimeFrame.Hour);

                newChartFrame.Detach();

                newChartFrame.ChartContainer.DetachedWindow.Width = 1920;

                newChartFrame.ChartContainer.DetachedWindow.Height = 1080;


 

                var chart = newChartFrame.Chart;

                    chart.ScrollXTo(Server.Time.AddDays(10));


 

                Timer.Start(TimeSpan.FromSeconds(5));

            }

            catch (Exception ex)

            {

                Print($"[Error] Exception in TakeChartShots: {ex.Message}");

            }

        }

        protected override void OnTimer()

        {

            if (newChartFrame != null)

            {

                ChartShot(newChartFrame.Chart);

                newChartFrame.ChartContainer.Close();

            }

        }

        protected void ChartShot(Chart chart)

        {

            var basePath = "ChartShots";

            Directory.CreateDirectory(basePath);


 

            var fileName = $"chartshot_{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.png";

            var filePath = Path.Combine(basePath, fileName);


 

            var chartshot = chart.TakeChartshot();

            if (chartshot != null)

                File.WriteAllBytes(filePath, chartshot);

            Timer.Stop();

        }

    }

}



I'm working on a large plugin Project, I minimized the code plugin to resolve my problem.
So we can not scroll to the future ?

Having some blank space on the right side like in this picture..

Thanks in advance..

Screenshot image



Can we not move this in code ?


 


@TommyFFX

TommyFFX
30 Oct 2024, 16:16 ( Updated at: 31 Oct 2024, 08:31 )

RE: Move current time/bar of the chart in code

PanagiotisCharalampous said: 

Hi there,

There is no ScrollXto in your code. Can you share the full source code please?

Best regards,

Panagiotis


using cAlgo.API;

using cAlgo.API.Internals;

using System;

using System.IO;


 

namespace cAlgo.Plugins

{

    [Plugin(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

    public class ChartShotPluginExample : Plugin

    {

        private ChartFrame newChartFrame;

        protected override void OnStart()

        {

            Positions.Closed += OnPositionClosed;

        }

        public void OnPositionClosed(PositionClosedEventArgs args)

        {

            TakeChartShots(args.Position.Symbol);

        }

        public void TakeChartShots(Symbol symbol)

        {

            try

            {

                newChartFrame = ChartManager.AddChartFrame(symbol.Name, TimeFrame.Hour);

                newChartFrame.Detach();

                newChartFrame.ChartContainer.DetachedWindow.Width = 1920;

                newChartFrame.ChartContainer.DetachedWindow.Height = 1080;


 

                var chart = newChartFrame.Chart;

                    chart.ScrollXTo(Server.Time.AddDays(10));


 

                Timer.Start(TimeSpan.FromSeconds(5));

            }

            catch (Exception ex)

            {

                Print($"[Error] Exception in TakeChartShots: {ex.Message}");

            }

        }

        protected override void OnTimer()

        {

            if (newChartFrame != null)

            {

                ChartShot(newChartFrame.Chart);

                newChartFrame.ChartContainer.Close();

            }

        }

        protected void ChartShot(Chart chart)

        {

            var basePath = "ChartShots";

            Directory.CreateDirectory(basePath);


 

            var fileName = $"chartshot_{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.png";

            var filePath = Path.Combine(basePath, fileName);


 

            var chartshot = chart.TakeChartshot();

            if (chartshot != null)

                File.WriteAllBytes(filePath, chartshot);

            Timer.Stop();

        }

    }

}



I'm working on a large plugin Project, I minimized the code plugin to resolve my problem.
So we can not scroll to the future ?

Having some blank space on the right side like in this picture..

Thanks in advance..

Screenshot image



Can we not move this in code ?



@TommyFFX

TommyFFX
22 Aug 2024, 21:42 ( Updated at: 22 Aug 2024, 22:22 )

RE: RE: RE: How to make cBot setting Take Profit when pushing button in Indicator

PanagiotisCharalampous said: 

TommyFFX said: 

PanagiotisCharalampous said: 

Hi there,

Why don't you just set the take profit from the indicator?

Best regards,

Panagiotis



Because Indicators can not open, close or modify positions/orders ..
And I need some stuff to communicate in the indicator with a cBot then.

I need a way to modify positions (TP) and close positions witch is not possible with Indicator.
I would like to have an Indicator on each symbol I Trade and use it's logic and only have 1 cBot open in the Automate section.

So each indicator can communicate for the actions it can't do like modifying or closing positions when neccessary.
 

TommyFFX

 

Since version 5.0 they can, so make your life easier and just trade through the indicator :)

Hi PanagiotisCharalampous

Thank you for your feedback. I was using previous version of broker.
At first it didn't work.. Now I figured out that an Indicator that is not created in version 5.0 doesn't work.
Then I created a new Indicator in 5.0 and it worked.
So when having old Indicators you need to paste it into new ones in 5.0 if you want it to work ..
But it would be usefull to know how to communicate with a cBot.
I'm developing management software. So like MagicKeys for instance. They have a bot and indicator..
Because I'm facing the next obstacle when timeframe is changing I lose my objects or globals, while a cBot is not..
MagicKeys has somewhere a method to communicate cause they have the indicator and the cbot..  

Best Regards
TommyFFX
 


@TommyFFX

TommyFFX
22 Aug 2024, 11:52

RE: How to make cBot setting Take Profit when pushing button in Indicator

PanagiotisCharalampous said: 

Hi there,

Why don't you just set the take profit from the indicator?

Best regards,

Panagiotis



Because Indicators can not open, close or modify positions/orders ..
And I need some stuff to communicate in the indicator with a cBot then.

I need a way to modify positions (TP) and close positions witch is not possible with Indicator.
I would like to have an Indicator on each symbol I Trade and use it's logic and only have 1 cBot open in the Automate section.

So each indicator can communicate for the actions it can't do like modifying or closing positions when neccessary.
 

TommyFFX

 


@TommyFFX

TommyFFX
08 Dec 2021, 18:11 ( Updated at: 08 Dec 2021, 18:23 )

RE: RE: Yes plz enable negative value

amusleh said:

TommyFFX said:

What's the point of Fibonacci alone without the expansion or negative values to target prices. Many regards and hopefully this will be added soon. Just switched from mt4 to cTrader and this is my first obstacle on cTrader otherwise love it, done with mt4

Hi,

You can use our Fibonacci drawing indicator if you need more features.

We are talking about negative inputs fibonacci levels for cTrader MOBILE VERSION, not possible like -27.2 and -61.8 

That's a shame cause on mt4 you can 

Using the fibonacci retracement and expansion in ONE. Like the illustration above on Desktop version you can but not mobile.

And the levels are on the left side in mobile witch is not good they should be on the right side as in the desktop version


@TommyFFX

TommyFFX
07 Dec 2021, 23:34 ( Updated at: 07 Dec 2021, 23:36 )

Yes plz enable negative value

What's the point of Fibonacci alone without the expansion or negative values to target prices. Many regards and hopefully this will be added soon. Just switched from mt4 to cTrader and this is my first obstacle on cTrader otherwise love it, done with mt4


@TommyFFX