Inactive Status
Inactive Status
17 Nov 2024, 09:53
Hi everybody,
Over the weekends cTrader shows “Inactive (Starts in ….)” with a countdown to the market opening on Monday.
As I understand it, this means none of the major markets are currently open.
Is there a way to pick this up as a boolean in a cBot / Plugin? I'd like my code to behave differently when this status is “Inactive”.
Many thanks,
Mat
Replies
PanagiotisCharalampous
18 Nov 2024, 06:34
RE: Inactive Status
firemyst said:
An example of an even easier method, which I use, is:
if (Symbol.MarketHours.IsOpened()) { // market is open, do what you want }else { //market is closed for the symbol. Do what you want }
Market hours are different to market sessions. Market hours are set by the broker. Market sessions are global.
@PanagiotisCharalampous
firemyst
18 Nov 2024, 09:27
RE: RE: Inactive Status
PanagiotisCharalampous said:
firemyst said:
An example of an even easier method, which I use, is:
if (Symbol.MarketHours.IsOpened()) { // market is open, do what you want }else { //market is closed for the symbol. Do what you want }
Market hours are different to market sessions. Market hours are set by the broker. Market sessions are global.
Fair point. But the OP said when the market was “open” and didn't specifically mention “market sessions” (although the OP did say “inactive” just as they said “open”).
So since it was vague to me, I provided another alternative just in case that's what the OP meant.
@firemyst
ctid5996231
18 Nov 2024, 09:31
RE: RE: RE: Inactive Status
firemyst said:
PanagiotisCharalampous said:
firemyst said:
An example of an even easier method, which I use, is:
if (Symbol.MarketHours.IsOpened()) { // market is open, do what you want }else { //market is closed for the symbol. Do what you want }
Market hours are different to market sessions. Market hours are set by the broker. Market sessions are global.
Fair point. But the OP said when the market was “open” and didn't specifically mention “market sessions” (although the OP did say “inactive” just as they said “open”).
So since it was vague to me, I provided another alternative just in case that's what the OP meant.
Although Panagiotis gave me the answer I was looking for, your response is also very useful and very much much appreciated, thank you :)
@ctid5996231
PanagiotisCharalampous
17 Nov 2024, 16:29
Hi there,
You can use MarketSessions to achieve this. Check below
https://help.ctrader.com/ctrader-algo/guides/trading-sessions/
Best regards,
Panagiotis
@PanagiotisCharalampous