Customize HotKey won't work when continuously hit?

Created at 15 Jul 2022, 00:01
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!
Capt.Z-Fort.Builder's avatar

Capt.Z-Fort.Builder

Joined 03.06.2020

Customize HotKey won't work when continuously hit?
15 Jul 2022, 00:01


Hello,

I need to hit a key to let it work continuously, as sample code below. After I hit Ctrl+UP the value i do added 1. But when I hit again it doesn't add to 2. I have to mouse-click the chart and then hit it again to make it work. Please help and advise. Thanks.

using System;
using System.Linq;
using System.Globalization;
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 TestBot : Robot

    {
        private int i;

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

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

        private void Chart_KeyDown(ChartKeyboardEventArgs obj)  
        { 
            if (obj.CtrlKey)
            {
                if (obj.Key == Key.Up)
                {
                    i++;
                    Chart.DrawStaticText("ChTx", i.ToString(), VerticalAlignment.Top, HorizontalAlignment.Center, Color.FromHex("#88AABBFF"));
                }
            }
        } 



    }
}

 


@Capt.Z-Fort.Builder
Replies

PanagiotisCharalampous
15 Jul 2022, 08:07

Hi TheNiatpac,

I tried this and it works fine for me.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

Capt.Z-Fort.Builder
15 Jul 2022, 11:40

RE:

Hi Panagiotis,

Thanks for the reply. I tested it again in Spotware ver4.3.8.6352  It does work for the second hit, but not for the 3rd time. I'd expect it can work continuously for as many times as I hit. Can you please check again and advise.

And I have another bug report post Email notification not working in 4.3.8 , I've inserted the sample code there. Please help test and advice.

Thank you.

PanagiotisCharalampous said:

Hi TheNiatpac,

I tried this and it works fine for me.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 


@Capt.Z-Fort.Builder

PanagiotisCharalampous
15 Jul 2022, 11:50

Hi TheNiatpac,

Thanks for the reply. I tested it again in Spotware ver4.3.8.6352  It does work for the second hit, but not for the 3rd time. I'd expect it can work continuously for as many times as I hit. Can you please check again and advise

Works fine for multiple hits too.

And I have another bug report post Email notification not working in 4.3.8 , I've inserted the sample code there. Please help test and advice.

We will reply there.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

Capt.Z-Fort.Builder
15 Jul 2022, 11:53

RE:

OK, thanks for confirming.  It seems that problem is with my Windows system.  I might try to reinstall the system again test another day.

PanagiotisCharalampous said:

Hi TheNiatpac,

Thanks for the reply. I tested it again in Spotware ver4.3.8.6352  It does work for the second hit, but not for the 3rd time. I'd expect it can work continuously for as many times as I hit. Can you please check again and advise

Works fine for multiple hits too.

And I have another bug report post Email notification not working in 4.3.8 , I've inserted the sample code there. Please help test and advice.

We will reply there.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
15 Jul 2022, 12:09

RE: RE:

BTW, I've just tested it on my 2nd PC, the problem is still there.

Both PC systems are Windows 10 Pro.  I think I will give it up on this topic, and use an alternative way to fit my demand in the bots. Thanks.

TheNiatpac said:

OK, thanks for confirming.  It seems that problem is with my Windows system.  I might try to reinstall the system again test another day.

PanagiotisCharalampous said:

Hi TheNiatpac,

Thanks for the reply. I tested it again in Spotware ver4.3.8.6352  It does work for the second hit, but not for the 3rd time. I'd expect it can work continuously for as many times as I hit. Can you please check again and advise

Works fine for multiple hits too.

And I have another bug report post Email notification not working in 4.3.8 , I've inserted the sample code there. Please help test and advice.

We will reply there.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 

 


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
15 Jul 2022, 12:35

RE: RE: RE:

It's the last update here, I don't know what I've done. But it really works as planned, not in the ICMarket 4.1.17 version, but only works fine in Spotware 4.3.8 version, and no matter compiled in the 4.1.17 or 4.3.8 target Framework 4.x or 6.0.

Nice... Topic Closed.

TheNiatpac said:

BTW, I've just tested it on my 2nd PC, the problem is still there.

Both PC systems are Windows 10 Pro.  I think I will give it up on this topic, and use an alternative way to fit my demand in the bots. Thanks.

TheNiatpac said:

OK, thanks for confirming.  It seems that problem is with my Windows system.  I might try to reinstall the system again test another day.

PanagiotisCharalampous said:

Hi TheNiatpac,

Thanks for the reply. I tested it again in Spotware ver4.3.8.6352  It does work for the second hit, but not for the 3rd time. I'd expect it can work continuously for as many times as I hit. Can you please check again and advise

Works fine for multiple hits too.

And I have another bug report post Email notification not working in 4.3.8 , I've inserted the sample code there. Please help test and advice.

We will reply there.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 

 

 


@Capt.Z-Fort.Builder