Replies

jumel.donatien
01 Oct 2024, 17:38

Good morning, I have exactly the same problem since version 5.0.32. Thanks to the cTrader team for resolving this issue.. I can't use my custom indicators anymore..


@jumel.donatien

jumel.donatien
30 Jul 2024, 20:45

RE: RE: RE: Issue with Code Building under Visual Studio since lastest version of cTrader 4.8.30 (Instance issue)

PanagiotisCharalampous said: 

protraderde said: 

Hi,


I am having the same issue with 4.9.1 version. I know you released 5.0 (20). I did not test the situation in 5.0.

Is there workaround at least for the moment? I am asking because it is more comfortable to code in Visual Studio 2022

All the best

 

PanagiotisCharalampous said: 

Hi there,

The team is aware of this issue and will be fixed in the next release of cTrader Desktop.

Best regards,

Panagiotis

 

Unfortunately we do not have a workaround. You would need to use the latest version.

I confirm that it works with 5.0 version ! thank you the team for this update.


@jumel.donatien

jumel.donatien
23 Mar 2024, 08:01

I totally agree with this! When 2 graphs are linked, the drawings must be found at the same time on these 2 graphs.
And I will also say that the entire drawing system needs to be reviewed, add predefined personalized drawings like in prorealtime, add the Z-index to be able to draw behind the candles, add drawings of arrows, triangles, points, squares, etc.
Thank you, and I'm sure the developers of this excellent platform will do the right thing!


@jumel.donatien

jumel.donatien
30 Jan 2024, 07:23

RE: Issue with Code Building under Visual Studio since lastest version of cTrader 4.8.30 (Instance issue)

PanagiotisCharalampous said: 

Hi there,

The team is aware of this issue and will be fixed in the next release of cTrader Desktop.

Best regards,

Panagiotis

Perfect.
Thank you very much for your answer. I'm sure it will be fixed!
In the meantime, I will modify my codes directly with the cTrader editor.


@jumel.donatien

jumel.donatien
21 Jun 2021, 21:19

RE: RE: RE:

That's great! Thank you.

One last question: is it possible to open a new chart by clicking on this button from a windowsform?

I tried with "SendKeys.SendWait (" ^ (N) ");" like simulating a shortcut key: but it only works when the main ctrader window is active, but not when the Windows form is open.

Thanks to you, I am now able to call actions by clicking on a button like drawing text as you showed me, but unable to open a new graph or activate the main ctrader window from the form Windows.

Do you have a solution for this? Thank you


@jumel.donatien

jumel.donatien
20 Jun 2021, 23:20

RE:

Hi amusleh,

I have another question: When I launch the robot, the form opens and if I want to change the action of the Buy Button (for example) to draw text on chart, it doesn't work.. I think, it's because when the form is launched, the chart is not activated..

Do you have a solution?

Here is the code changed in MainForm.cs:

private void BtnBuy_Click(object sender, System.EventArgs e)
        {
            _robot.ExecuteMarketOrder(TradeType.Buy, _robot.SymbolName, _robot.Symbol.VolumeInUnitsMin);

            _robot.ChartObjects.DrawText("Sample Text", "Sample Text", StaticPosition.Center);
        }

Thank you in advance!


@jumel.donatien

jumel.donatien
20 Jun 2021, 10:34

RE:

It works!!

Great! Thank you so much! 


@jumel.donatien

jumel.donatien
20 Jun 2021, 09:44 ( Updated at: 20 Jun 2021, 09:45 )

RE:

Hi amusleh and thank you for your help!

In order to understand your "tutorial", I downloaded your sample code, added the extracted folder on my robots folder, but it doesn't appear on my robots list in cTrader.. 

Where is the .algo file? or how could I create it to test your robot?

Thank you for your help.


@jumel.donatien

jumel.donatien
29 May 2021, 00:37 ( Updated at: 21 Dec 2023, 09:22 )

RE: RE:

Ok Guys, I fixed the code by myself! ;)

See the correct code bellow. It allows you to find the Stochastic PercentK and PercentD for each symbol in the array.

The solution was to get the Stochastic's results in the "void Bars_BarOpened" with those two code lines (as you can see in the code bellow):

            var stoc = MarketData.GetBars(TimeFrame, obj.Bars.SymbolName);
            stochastic = Indicators.StochasticOscillator(stoc, 14, 3, 5, MovingAverageType.Simple);

Notice that the stochastic results work only if you respect the code given by PanagiotisCharalampous, code which get bars results symbol by symbol at first.

You can see on the joined picture, the results in the log cbot .

I have now to do the same with Ichimoku.. (maybe harder!)

Do not hesitate to propose another solution if you have!

Thank you!

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

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TEST : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }
        public Symbol[] MySymbols;

        private StochasticOscillator stochastic;


        protected override void OnStart()
        {
            // We get a symbol array for the following for symbols
            MySymbols = Symbols.GetSymbols("EURUSD", "GBPUSD", "USDJPY", "USDCHF");

            // We subscribe to the bar event for each symbol for the current timeframe
            foreach (var symbol in MySymbols)
            {
                var bars = MarketData.GetBars(TimeFrame, symbol.Name);
                bars.BarOpened += Bars_BarOpened;
            }
        }

        private void Bars_BarOpened(BarOpenedEventArgs obj)
        {
            var stoc = MarketData.GetBars(TimeFrame, obj.Bars.SymbolName);
            stochastic = Indicators.StochasticOscillator(stoc, 8, 3, 9, MovingAverageType.Simple);

            Print("For ", obj.Bars.SymbolName, ": K=", stochastic.PercentK.Last(1), " D=", stochastic.PercentD.Last(1));

            // When a bar opens we check the previous bar. If the bar is bullish, we send a buy order, else we send a sell order.
            if (obj.Bars.Last(1).Close > obj.Bars.Last(1).Open)
            {
                Print(obj.Bars.SymbolName, " is Bullish");
            }
            else
            {
                Print(obj.Bars.SymbolName, " is Bearish");
            }
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

Here are the results in the log:


@jumel.donatien

jumel.donatien
28 May 2021, 02:12 ( Updated at: 21 Dec 2023, 09:22 )

RE:

Thank you PanagiotisCharalampous !

Your code is a nice solution for what I want to do!

But I have a problem to add a stochastic detection on the code, and for each Symbol in the array..

I simplified my code (below) to show you what's wrong: I want to get the "PercentK" and "PercentD" from stochastic indicator correspond to each Symbol and Print it in the cbot log.

But it doesn't work.. The four results are the same (as you can see in the results from my cbot log), so I think that the bot just get PercentK and PercentD from only one symbol (here, I think that the result correpond to USDJPY on my chart)

Could you help me please? (I m beginner but I learn!)

Thank you

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

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TEST : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }
        public Symbol[] MySymbols;

        private StochasticOscillator stochastic;


        protected override void OnStart()
        {
            // We get a symbol array for the following for symbols
            MySymbols = Symbols.GetSymbols("EURUSD", "GBPUSD", "USDJPY", "USDCHF");

            // We subscribe to the bar event for each symbol for the current timeframe
            foreach (var symbol in MySymbols)
            {
                var bars = MarketData.GetBars(TimeFrame, symbol.Name);
                bars.BarOpened += Bars_BarOpened;
            }
        }

        private void Bars_BarOpened(BarOpenedEventArgs obj)
        {
            var stoc = MarketData.GetBars(TimeFrame, obj.Bars.SymbolName);
            stochastic = Indicators.StochasticOscillator(stoc, 8, 3, 9, MovingAverageType.Simple);

            Print("For ", obj.Bars.SymbolName, ": K=", stochastic.PercentK.Last(1), " D=", stochastic.PercentD.Last(1));

            // When a bar opens we check the previous bar. If the bar is bullish, we send a buy order, else we send a sell order.
            if (obj.Bars.Last(1).Close > obj.Bars.Last(1).Open)
            {
                Print(obj.Bars.SymbolName, " is Bullish");
            }
            else
            {
                Print(obj.Bars.SymbolName, " is Bearish");
            }
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

The results:


@jumel.donatien