OnBar method unusable

Created at 09 Jan 2014, 00:35
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!
RK

rkokerti

Joined 28.06.2012

OnBar method unusable
09 Jan 2014, 00:35


Dear Developer,

I use robot for open a position on 12 hours chart . I have an issue, when a new candle opens at midnight. (not always but very often)

FxPro reconcile data from 01:00 to 01:05. Of course the trading halt during this time. So normally, new candle should appear at 01:05 (use OnBar method). But sometime the new candle appears at 01:00 (midnight UTC+3). See attached picure below.

In this case OnBar method unusable.

Please investigate it, as soon as possible.

Thanks in advance!

 


@rkokerti
Replies

Spotware
09 Jan 2014, 17:17

Thank you for reporting this issue. We are aware of it and will fix it.
@Spotware

rkokerti
30 Jan 2014, 09:40

RE:

Spotware said:

Thank you for reporting this issue. We are aware of it and will fix it.

Hello,

Is there any news about the above mentioned issue? This is very frustrating! Please investigate it.

Thanks in advance!


@rkokerti

Spotware
30 Jan 2014, 14:23

We are investigating this. We apologize for the inconvenience.


@Spotware

rkokerti
01 Apr 2014, 00:46

Unfortunately this issue is still exists...


@rkokerti

Spotware
02 Apr 2014, 09:40

Now we can confirm that it is a valid behavior.
Even if trading is not possible platform can receive new prices which could produce new bar. Therefore you need to extend logic of your cBot to handle trading errors.


@Spotware

rkokerti
02 Apr 2014, 15:16

Thanks to your answer.

What is your advice, how can I extend logic of my cBot to handle trading errors?


@rkokerti

Spotware
04 Apr 2014, 11:59

RE:

rkokerti said:

Thanks to your answer.

What is your advice, how can I extend logic of my cBot to handle trading errors?

If operation failed you can retry it after some time period.


@Spotware

rkokerti
04 Apr 2014, 13:25

You mean if operation failed, I need to use OnTick method to repeat the functionality of OnBar?

Thanks in advance!


@rkokerti

Spotware
04 Apr 2014, 13:55

RE:

rkokerti said:

You mean if operation failed, I need to use OnTick method to repeat the functionality of OnBar?

Thanks in advance!

Yes, you can use OnTick method to repeat the failed trade. You can also do Thread.Sleep in OnBar method and then repeat the failed trade. 


@Spotware

rkokerti
04 Apr 2014, 14:02

Thanks to your answer. I try it.


@rkokerti

rkokerti
21 May 2014, 00:58

I tried to solve this issue, with " System.Threading.Thread.Sleep(300000);" but unfortunately it's not working for me. 

Can anyone help me?


@rkokerti

rkokerti
29 May 2014, 15:55

Dear Developers,

As you previously said "Even if trading is not possible platform can receive new prices which could produce new bar." OK I accept that, I do not understand why, but it's not important... 

Therefore, I need to open the half of the positions by manually. In this case very difficult to set the proper SL/TP levels and set the position sizing.

So, please help me to handle this problem with a sample code.

Thanks in advance!

 


@rkokerti

modarkat
29 May 2014, 16:11

RE:

rkokerti said:

Dear Developers,

As you previously said "Even if trading is not possible platform can receive new prices which could produce new bar." OK I accept that, I do not understand why, but it's not important... 

Therefore, I need to open the half of the positions by manually. In this case very difficult to set the proper SL/TP levels and set the position sizing.

So, please help me to handle this problem with a sample code.

Thanks in advance!

 

You can try the following snippet

            while (true)
            {
                ExecuteMarketOrder(TradeType.Buy, Symbol, Symbol.VolumeMin);
                if (LastResult.IsSuccessful)
                {
                    break;
                }
                else
                {
                    Thread.Sleep(1000);
                }
            }

 


@modarkat

rkokerti
30 May 2014, 00:19

Thanks Modarkat!

I tested and it works well! Thanks for your quick response!


@rkokerti