Description
市場の開始時間のグリッドを表示します。
線の色を変えたい場合はこの一覧にある色の名前を入力してください。
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class MarketOpeningTimeGrids : Indicator
{
[Parameter("Europe Summer Time", DefaultValue = false)]
public bool EuropeSummerTime { get; set; }
[Parameter("NY Summer Time", DefaultValue = true)]
public bool NYSummerTime { get; set; }
[Parameter("日本色", DefaultValue = "Indigo")]
public string JapanColor { get; set; }
[Parameter("欧州色", DefaultValue = "Navy")]
public string EuropeColor { get; set; }
[Parameter("ニューヨーク色", DefaultValue = "DarkRed")]
public string NYColor { get; set; }
public int JapanTime;
public int EuropeTime;
public int NYTime;
public bool timeFrameUnder30min;
protected override void Initialize()
{
JapanTime = 9;
if (EuropeSummerTime)
{
EuropeTime = 16;
}
else
{
EuropeTime = 17;
}
NYTime = 22;
if (Chart.TimeFrame == TimeFrame.Minute || Chart.TimeFrame == TimeFrame.Minute2 || Chart.TimeFrame == TimeFrame.Minute3 || Chart.TimeFrame == TimeFrame.Minute4 || Chart.TimeFrame == TimeFrame.Minute5 || Chart.TimeFrame == TimeFrame.Minute6 || Chart.TimeFrame == TimeFrame.Minute7 || Chart.TimeFrame == TimeFrame.Minute8 || Chart.TimeFrame == TimeFrame.Minute9 || Chart.TimeFrame == TimeFrame.Minute10 || Chart.TimeFrame == TimeFrame.Minute15 || Chart.TimeFrame == TimeFrame.Minute20 || Chart.TimeFrame == TimeFrame.Minute30)
{
timeFrameUnder30min = true;
}
else
{
timeFrameUnder30min = false;
}
}
public override void Calculate(int index)
{
var bar = Bars.LastBar;
if (bar.OpenTime.ToLocalTime().Hour == JapanTime && bar.OpenTime.ToLocalTime().Minute == 0)
{
Chart.DrawVerticalLine("grids" + bar.OpenTime.ToString(), bar.OpenTime, JapanColor, 1, LineStyle.Dots);
}
else if (bar.OpenTime.ToLocalTime().Hour == EuropeTime && bar.OpenTime.ToLocalTime().Minute == 0)
{
Chart.DrawVerticalLine("grids" + bar.OpenTime.ToString(), bar.OpenTime, EuropeColor, 1, LineStyle.Dots);
}
if (NYSummerTime && timeFrameUnder30min)
{
if (bar.OpenTime.ToLocalTime().Hour == NYTime && bar.OpenTime.ToLocalTime().Minute == 30)
{
Chart.DrawVerticalLine("grids" + bar.OpenTime.ToString(), bar.OpenTime, NYColor, 1, LineStyle.Dots);
}
}
else
{
if (bar.OpenTime.ToLocalTime().Hour == NYTime && bar.OpenTime.ToLocalTime().Minute == 0)
{
Chart.DrawVerticalLine("grids" + bar.OpenTime.ToString(), bar.OpenTime, NYColor, 1, LineStyle.Dots);
}
}
}
}
}
summer
Joined on 10.08.2020
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: MarketOpeningTimeGrids.algo
- Rating: 5
- Installs: 1798
- Modified: 13/10/2021 09:55
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
No comments found.