How to prohibit opening positions during some time periods (e.g., from 9:20 to 9:45)?

Created at 10 Oct 2015, 04:57
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!
IR

ironmine

Joined 29.09.2015

How to prohibit opening positions during some time periods (e.g., from 9:20 to 9:45)?
10 Oct 2015, 04:57


Can somebody please tell me how to make certain time periods prohibited for entering into positions?


@ironmine
Replies

Spotware
13 Oct 2015, 01:28

Dear Trader,

We are not sure we understand what do you mean. Could you please explain us in more detail what you are trying to do?


@Spotware

ironmine
14 Oct 2015, 02:52

RE:

Spotware said:

Dear Trader,

We are not sure we understand what do you mean. Could you please explain us in more detail what you are trying to do?

Well, I analyzed the backtesting results and the "entry by hours" show me that the trades opened during certain hours generate losses, not gains. So, I want to add a code that will prevent a cBot from making any entries during these hours. Can you please help me with the code? Or give me a link where it is already explained. Thank you.


@ironmine

Spotware
14 Oct 2015, 03:21

Dear Trader,

If you don’t want your cBot to open a position in a certain interval you could write an if-statement to prevent it from happening.

The following code snippet illustrates an example where the if statement checks if the minute of the hour is the 11th. if the condition is true then it prints "hello" in the log.

if (Time.Minute == 11)
{
    Print("Hello");
}

Additionally, we would like to inform you that we do not provide coding assistance services. We more than glad to assist you with specific questions about cAlgo.API. You also can contact one of our Partners or post a job in Development Jobs section for further coding assistance.


@Spotware

ironmine
14 Oct 2015, 03:24

RE:

Spotware said:

Dear Trader,

If you don’t want your cBot to open a position in a certain interval you could write an if-statement to prevent it from happening.

The following code snippet illustrates an example where the if statement checks if the minute of the hour is the 11th. if the condition is true then it prints "hello" in the log.

if (Time.Minute == 11)
{
    Print("Hello");
}

Additionally, we would like to inform you that we do not provide coding assistance services. We more than glad to assist you with specific questions about cAlgo.API. You also can contact one of our Partners or post a job in Development Jobs section for further coding assistance.

Thank you


@ironmine