Please check this code i cant draw vertical line
Please check this code i cant draw vertical line
28 Jul 2022, 09:53
Please check this code. Vertical line not show and problem is date time fomating i think please help fix this problem.
var src = DateTime.Now;
var mnt1 = src.Minute;
var mnt2 = src.Minute - 1;
var mnt3 = src.Minute - 2;
var mnt4 = src.Minute - 3;
var mnt5 = src.Minute - 4;
var mnt6 = src.Minute - 5;
var mnt7 = src.Minute - 6;
var hm1 = new DateTime(src.Day, src.Month, src.Year, src.Hour, mnt1, 0);
var hm2 = new DateTime(src.Year, src.Month, src.Day, src.Hour, mnt2, 0);
var hm3 = new DateTime(src.Year, src.Month, src.Day, src.Hour, mnt3, 0);
var hm4 = new DateTime(src.Year, src.Month, src.Day, src.Hour, mnt4, 0);
var hm5 = new DateTime(src.Year, src.Month, src.Day, src.Hour, mnt5, 0);
var hm6 = new DateTime(src.Year, src.Month, src.Day, src.Hour, mnt6, 0);
var hm7 = new DateTime(src.Year, src.Month, src.Day, src.Hour, mnt7, 0);
var line1 = Chart.DrawVerticalLine("1", hm1, Color.Red);
var line2 = Chart.DrawVerticalLine("2", hm2, Color.Red);
var line3 = Chart.DrawVerticalLine("3", hm3, Color.Red);
var line4 = Chart.DrawVerticalLine("4", hm4, Color.Red);
var line5 = Chart.DrawVerticalLine("5", hm5, Color.Red);
var line6 = Chart.DrawVerticalLine("6", hm6, Color.Red);
var line7 = Chart.DrawVerticalLine("7", hm7, Color.Red);
line1.IsInteractive = true;
line2.IsInteractive = true;
line3.IsInteractive = true;
line4.IsInteractive = true;
line5.IsInteractive = true;
line6.IsInteractive = true;
line7.IsInteractive = true;
Replies
paolo.panicali
28 Jul 2022, 13:06
For the Minute separator on a tick chart I answered to you on the other thread
@paolo.panicali
MongolTrader
29 Jul 2022, 05:03
( Updated at: 21 Dec 2023, 09:22 )
RE: Try this code, it works for me with timeframe set to 1 minute it updates every minute....
paolo.panicali said:
//Answer to MongolTrader since: 12 Feb 2015 28 Jul 2022, 09:53
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class MongolTrader : Indicator
{
public override void Calculate(int index)
{
var src = Bars.OpenTimes[index];
var line1 = Chart.DrawVerticalLine("1", src.AddMinutes(-1), Color.Red, 2, LineStyle.DotsRare);
var line2 = Chart.DrawVerticalLine("2", src.AddMinutes(-2), Color.Blue, 2, LineStyle.DotsRare);
var line3 = Chart.DrawVerticalLine("3", src.AddMinutes(-3), Color.Blue, 2, LineStyle.DotsRare);
var line4 = Chart.DrawVerticalLine("4", src.AddMinutes(-4), Color.Blue, 2, LineStyle.DotsRare);
var line5 = Chart.DrawVerticalLine("5", src.AddMinutes(-5), Color.Blue, 2, LineStyle.DotsRare);
var line6 = Chart.DrawVerticalLine("6", src.AddMinutes(-6), Color.Blue, 2, LineStyle.DotsRare);
var line7 = Chart.DrawVerticalLine("7", src.AddMinutes(-7), Color.Blue, 2, LineStyle.DotsRare);
}
}
}
Is that what you wanted? Bye
Thank you very much bro. May i have friend with telegram or any other social fb instagram etc... Let me know ID if ok
@MongolTrader
paolo.panicali
31 Jul 2022, 19:57
Ctrader telegram channel
Hi I joined ctrader official telegram channel. Bye
@paolo.panicali
paolo.panicali
28 Jul 2022, 12:51
Try this code, it works for me with timeframe set to 1 minute it updates every minute....
//Answer to MongolTrader since: 12 Feb 2015 28 Jul 2022, 09:53
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class MongolTrader : Indicator
{
public override void Calculate(int index)
{
var src = Bars.OpenTimes[index];
var line1 = Chart.DrawVerticalLine("1", src.AddMinutes(-1), Color.Red, 2, LineStyle.DotsRare);
var line2 = Chart.DrawVerticalLine("2", src.AddMinutes(-2), Color.Blue, 2, LineStyle.DotsRare);
var line3 = Chart.DrawVerticalLine("3", src.AddMinutes(-3), Color.Blue, 2, LineStyle.DotsRare);
var line4 = Chart.DrawVerticalLine("4", src.AddMinutes(-4), Color.Blue, 2, LineStyle.DotsRare);
var line5 = Chart.DrawVerticalLine("5", src.AddMinutes(-5), Color.Blue, 2, LineStyle.DotsRare);
var line6 = Chart.DrawVerticalLine("6", src.AddMinutes(-6), Color.Blue, 2, LineStyle.DotsRare);
var line7 = Chart.DrawVerticalLine("7", src.AddMinutes(-7), Color.Blue, 2, LineStyle.DotsRare);
}
}
}
Is that what you wanted? Bye
@paolo.panicali