Button Trading Example on CTrader 4.2

Created at 25 May 2022, 16:39
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
M4

m4trader4

Joined 19.09.2021

Button Trading Example on CTrader 4.2
25 May 2022, 16:39


Dear Ahmad

Could you please provide a Button example with button += subscribe and Chart.MouseDown += Chart_MouseDown;

I have onclick (Chart.MouseDown += Chart_MouseDown) to get the OHLC of bar and on button click place order (PlaceStopOrderAsync) buy on High or sell on low.

The same cBot is running on 2 or same timeframe, when a trade operation (Buy/Sell) is performed through Button Buy or Button Sell, trade performing cBot freezes after placing order.

Thanks

Ahmed


@m4trader4
Replies

m4trader4
25 May 2022, 16:44

RE:

m4trader4 said:

Dear Ahmad

Could you please provide a Button example with button += subscribe and Chart.MouseDown += Chart_MouseDown;

I have onclick (Chart.MouseDown += Chart_MouseDown) to get the OHLC of bar and on button click place order (PlaceStopOrderAsync) buy on High or sell on low.

The same cBot is running on 2 or same timeframe, when a trade operation (Buy/Sell) is performed through Button Buy or Button Sell, trade performing cBot freezes after placing order.

Thanks

Ahmed

 

Chart.MouseDown += Chart_MouseDown -> get the bar index  

private void Chart_MouseDown(ChartMouseEventArgs obj)
        {

            if (obj.BarIndex < Bars.Count && GlobalLock == false)
            {
                Print("On Chart Price: " + obj.YValue + "=BarIndex=" + obj.BarIndex + "=TimeValue=" + obj.TimeValue);

                GlobalbI = Convert.ToInt32(obj.BarIndex);

                GlobalC1O = Bars.OpenPrices[GlobalbI];
                GlobalC1H = Bars.HighPrices[GlobalbI];
                GlobalC1L = Bars.LowPrices[GlobalbI];
                GlobalC1C = Bars.ClosePrices[GlobalbI];
                GlobalC1V = Bars.TickVolumes[GlobalbI];

                CandleCalc(GlobalbI, GlobalC1O, GlobalC1H, GlobalC1L, GlobalC1C);

            }



        }

 


@m4trader4

amusleh
26 May 2022, 09:53

Hi,

We are investigating this issue, thanks for reporting.


@amusleh

m4trader4
28 May 2022, 05:28

RE:

Dear Ahmad

When is the resolution expected

 

 


@m4trader4

amusleh
30 May 2022, 09:24

Hi,

We are still investigating and trying to reproduce this issue.


@amusleh

m4trader4
31 May 2022, 13:54

RE:

Let me know what is required from my end to reproduce the issue? all the cBots are not working in 4.2 this has been a show stopper for me

 


@m4trader4

amusleh
31 May 2022, 15:39

Hi,

We were able to reproduce this issue and it will be fixed on next version which will be released in next couple of days.

Thanks for reporting.


@amusleh