Description
Market Sessions Indicator 🌍📊
Elevate your trading experience with the Market Sessions Indicator, an essential tool for traders who want to gain an edge in the market. Designed to work seamlessly with any type of chart, including the unique Renko charts, this indicator offers unparalleled insights into the global market sessions. Here’s why you should make it a part of your trading toolkit:
Key Features:
Comprehensive Session Tracking 🕒
- Visualize the Sydney, Asia, London, and New York trading sessions with distinct colors and customizable timeframes.
- Stay informed about the active market sessions at a glance, enabling you to make better-informed trading decisions.
Customization at Your Fingertips 🎨
- Tailor each session’s appearance to your preferences with options to adjust colors, line styles, and thickness.
- Enable or disable sessions based on your trading strategy and focus.
Renko Chart Compatibility 📈
- One of the few indicators that seamlessly integrates with Renko charts, providing you with the flexibility to use your preferred chart type without losing vital market session information.
Historical Session Display 📅
- Look back at the past three days (or more, as configured) to analyze historical session data and identify patterns.
- Gain insights into how different sessions have impacted the market previously, aiding in strategy development.
Real-Time Updates 🔄
- Automatically updates to reflect the current market sessions, ensuring you always have the latest information.
- Dynamic adjustments based on user time zone settings for accurate session timings.
Why Choose Market Sessions Indicator?
- Boost Trading Efficiency 🚀: By highlighting key market sessions, you can focus your trading efforts during the most volatile and liquid times of the day.
- Enhanced Decision-Making 💡: Clear visual representations of session overlaps and transitions provide critical context, helping you anticipate market moves.
- Versatility and Precision 🎯: Whether you use minute-based charts or the innovative Renko charts, this indicator adapts to your trading style and needs.
Download the Market Sessions Indicator today and take control of your trading with the power of precise session analysis. Transform your trading strategy with this versatile and customizable tool, designed to give you a clearer view of the global markets.
Get it now and start trading smarter! 📥✨
Screenshots:
Renko
Heikin Ashi
Range
The author decided to hide the source code.
Zed.Mad
Joined on 16.05.2024
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Trading Sessions V1.algo
- Rating: 5
- Installs: 871
- Modified: 03/08/2024 09:25
Comments
I just make it :
using System;
using System.Collections.Generic;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.GMTStandardTime, AccessRights = AccessRights.None)]
public class MarketSessionBox : Indicator
{
[Parameter("Sydney Session Active", DefaultValue = true, Group = "Market Sessions|Sydney Session")]
public bool SydneySessionActive { get; set; }
[Parameter(DefaultValue = "21:00", Group = "Market Sessions|Sydney Session")]
public string Sydney { get; set; }
[Parameter(DefaultValue = 8, Group = "Market Sessions|Sydney Session")]
public int SydneyHour { get; set; }
[Parameter("Sydney Color", DefaultValue = "LightBlue", Group = "Market Sessions|Sydney Session")]
public Color SydneyFillColor { get; set; }
[Parameter("Sydney Fill zone", DefaultValue = false, Group = "Market Sessions|Sydney Session")]
public bool SydneyOpacity { get; set; }
[Parameter("Sydney Box Line Type", DefaultValue = LineStyle.Dots, Group = "Market Sessions|Sydney Session")]
public LineStyle SydneyBoxLineType { get; set; }
[Parameter("Sydney Box Line Thickness", DefaultValue = 1, Group = "Market Sessions|Sydney Session")]
public int SydneyThickness { get; set; }
[Parameter("Asia Session Active", DefaultValue = true, Group = "Market Sessions|Asia Session")]
public bool AsiaSessionActive { get; set; }
[Parameter(DefaultValue = "00:00", Group = "Market Sessions|Asia Session")]
public string Asia { get; set; }
[Parameter(DefaultValue = 8, Group = "Market Sessions|Asia Session")]
public int AsiaHour { get; set; }
[Parameter("Asia Color", DefaultValue = "LightYellow", Group = "Market Sessions|Asia Session")]
public Color AsiaFillColor { get; set; }
[Parameter("Asia Fill zone", DefaultValue = false, Group = "Market Sessions|Asia Session")]
public bool AsiaOpacity { get; set; }
[Parameter("Asia Box Line Type", DefaultValue = LineStyle.Dots, Group = "Market Sessions|Asia Session")]
public LineStyle AsiaBoxLineType { get; set; }
[Parameter("Asia Box Line Thickness", DefaultValue = 1, Group = "Market Sessions|Asia Session")]
public int AsiaThickness { get; set; }
[Parameter("London Session Active", DefaultValue = true, Group = "Market Sessions|London Session")]
public bool LondonSessionActive { get; set; }
[Parameter(DefaultValue = "08:00", Group = "Market Sessions|London Session")]
public string London { get; set; }
[Parameter(DefaultValue = 9, Group = "Market Sessions|London Session")]
public int LondonHour { get; set; }
[Parameter("London Fill Color", DefaultValue = "LightGreen", Group = "Market Sessions|London Session")]
public Color LondonFillColor { get; set; }
[Parameter("London Fill", DefaultValue = false, Group = "Market Sessions|London Session")]
public bool LondonOpacity { get; set; }
[Parameter("London Box Line Type", DefaultValue = LineStyle.Dots, Group = "Market Sessions|London Session")]
public LineStyle LondonBoxLineType { get; set; }
[Parameter("London Box Line Thickness", DefaultValue = 1, Group = "Market Sessions|London Session")]
public int LondonThickness { get; set; }
[Parameter("New York Session Active", DefaultValue = true, Group = "Market Sessions|New York Session")]
public bool NewYorkSessionActive { get; set; }
[Parameter(DefaultValue = "14:00", Group = "Market Sessions|New York Session")]
public string NewYork { get; set; }
[Parameter(DefaultValue = 8, Group = "Market Sessions|New York Session")]
public int NewYorkHour { get; set; }
[Parameter("New York Color", DefaultValue = "LightCoral", Group = "Market Sessions|New York Session")]
public Color NewYorkFillColor { get; set; }
[Parameter("New York Filled zone", DefaultValue = false, Group = "Market Sessions|New York Session")]
public bool NewYorkOpacity { get; set; }
[Parameter("New York Box Line Type", DefaultValue = LineStyle.Dots, Group = "Market Sessions|New York Session")]
public LineStyle NewYorkBoxLineType { get; set; }
[Parameter("New York Box Line Thickness", DefaultValue = 1, Group = "Market Sessions|New York Session")]
public int NewYorkThickness { get; set; }
[Parameter(DefaultValue = 250)]
public int Opacity { get; set; }
// store last Session Start and Session End
public DateTime syStart;
public DateTime syEnd;
public DateTime asStart;
public DateTime asEnd;
public DateTime ldStart;
public DateTime ldEnd;
public DateTime usStart;
public DateTime usEnd;
protected override void Initialize()
{
// Initialize and create nested indicators
}
public override void Calculate(int index)
{
var dateTime = Bars.OpenTimes[index];
List<Box> boxs = Sbox(index);
for (int i = 0; i < boxs.Count; i++)
{
var box = boxs[i];
double[] high_low = BoxHighLow(index, box);
DrawBox(box.label, box.left, box.right, high_low[0], high_low[1], box.clr, box.filled, box.lineStyle, box.thickness, box.name);
}
}
// box calcuate logic
public List<Box> Sbox(int index)
{
List<Box> boxs = new List<Box>();
DateTime current = Bars.OpenTimes[index];
string syStartHour = Sydney.Split('-')[0].Split(':')[0];
string syStartMinute = Sydney.Split('-')[0].Split(':')[1];
string asStartHour = Asia.Split('-')[0].Split(':')[0];
string asStartMinute = Asia.Split('-')[0].Split(':')[1];
string euroStartHour = London.Split('-')[0].Split(':')[0];
string euroStartMinute = London.Split('-')[0].Split(':')[1];
string usStartHour = NewYork.Split('-')[0].Split(':')[0];
string usStartMinute = NewYork.Split('-')[0].Split(':')[1];
if (current.Hour == Int32.Parse(syStartHour) && current.Minute == Int32.Parse(syStartMinute) && SydneySessionActive)
{
syStart = current;
syEnd = current.DayOfWeek == DayOfWeek.Friday ? current.AddHours(SydneyHour + 48) : current.AddHours(SydneyHour);
}
if (current.Hour == Int32.Parse(asStartHour) && current.Minute == Int32.Parse(asStartMinute) && AsiaSessionActive)
{
asStart = current;
asEnd = current.AddHours(AsiaHour);
}
if (current.Hour == Int32.Parse(euroStartHour) && current.Minute == Int32.Parse(euroStartMinute) && LondonSessionActive)
{
ldStart = current;
ldEnd = current.AddHours(LondonHour);
}
if (current.Hour == Int32.Parse(usStartHour) && current.Minute == Int32.Parse(usStartMinute) && NewYorkSessionActive)
{
usStart = current;
usEnd = current.AddHours(NewYorkHour);
}
if (current >= syStart && current <= syEnd && SydneySessionActive)
{
boxs.Add(new Box(syStart.ToString(), syStart, syEnd, Color.FromArgb(Opacity, SydneyFillColor), SydneyOpacity, SydneyBoxLineType, SydneyThickness, "Sydney\n"));
}
if (current >= asStart && current <= asEnd && AsiaSessionActive)
{
boxs.Add(new Box(asStart.ToString(), asStart, asEnd, Color.FromArgb(Opacity, AsiaFillColor), AsiaOpacity, AsiaBoxLineType, AsiaThickness, "Asia\n"));
}
if (current >= ldStart && current <= ldEnd && LondonSessionActive)
{
boxs.Add(new Box(ldStart.ToString(), ldStart, ldEnd, Color.FromArgb(Opacity, LondonFillColor), LondonOpacity, LondonBoxLineType, LondonThickness, "London\n"));
}
if (current >= usStart && current <= usEnd && NewYorkSessionActive)
{
boxs.Add(new Box(usStart.ToString(), usStart, usEnd, Color.FromArgb(Opacity, NewYorkFillColor), NewYorkOpacity, NewYorkBoxLineType, NewYorkThickness, "NewYork\n"));
}
return boxs;
}
// calculate session High Low
private double[] BoxHighLow(int index, Box box)
{
DateTime left = box.left;
double[] high_low = new double[2]
{
Bars.HighPrices[index],
Bars.LowPrices[index]
};
while (Bars.OpenTimes[index] >= left)
{
high_low[0] = Math.Max(high_low[0], Bars.HighPrices[index]);
high_low[1] = Math.Min(high_low[1], Bars.LowPrices[index]);
index--;
}
return high_low;
}
// draw session box
private void DrawBox(String label, DateTime left, DateTime right, Double high, Double low, Color clr, bool isfilled, LineStyle lineStyle, int thickness, string name)
{
var text = Chart.DrawText(label + name, name, left, high, clr);
text.VerticalAlignment = VerticalAlignment.Top;
Chart.DrawRectangle(label, left, high, right, low, clr, thickness, lineStyle).IsFilled = isfilled;
}
// box data struct
public struct Box
{
public string label;
public DateTime left;
public DateTime right;
public Color clr;
public bool filled;
public LineStyle lineStyle;
public int thickness;
public string name;
public Box(string label, DateTime left, DateTime right, Color clr, bool filled, LineStyle lineStyle, int thickness, string name)
{
this.label = label;
this.left = left;
this.right = right;
this.clr = clr;
this.filled = filled;
this.lineStyle = lineStyle;
this.thickness = thickness;
this.name = name;
}
}
}
}
Nice Indicator !
I see 2 errors :
- Impossible to load all period : Probleme on the
- The last sydney load doesn't work
- error on sydney fil : add at line 155 : rect.IsFilled = opacity;
the log print : 07/08/2024 03:37:47.018 | Crashed in Calculate with ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: y1. Actual value was: NaN.
for info : utc +2
Nice day
I would love to have some feedback. It's working properly? Need improvements? Let me know, guys.
Thant you for this indicator!
I now use it to mark the first hour zone (high & low)
can you add an option to replace the box by drawing lines on high & low for every session? its good for keep this levels to the next hours/day.
sugesstion: current session solid line, prev' session dots line…