Hello dear friend I am the designer of the Position Manager indicator Is it possible for you to message me on Telegram? I want to help you solve the problem My Telegram ID is: @AgloCreators
using System; using System.Collections.Generic; using System.Linq; using System.Text; using cAlgo.API; using cAlgo.API.Collections; using cAlgo.API.Indicators; using cAlgo.API.Internals; using System.Globalization; namespace cAlgo { [Indicator(AccessRights = AccessRights.FullAccess, IsOverlay = true, TimeZone = TimeZones.UTC)] public class TradingSessions : Indicator { [Parameter("Version:", DefaultValue = "1.0.1")] public string Version { get; set; }
[Parameter("Show for how many days", Group = "Sessions", DefaultValue = 15, MinValue = 0)] public int Back_days { get; set; } [Parameter("Filled Zones", DefaultValue = true, Group = "Sessions")] public bool Filled_Zones { get; set; } [Parameter("Show Labels", DefaultValue = true, Group = "Sessions")] public bool Show_Labels { get; set; } [Parameter("Infinitie range", DefaultValue = Infinite_Range.None, Group = "Sessions")] public Infinite_Range InfiniteRange { get; set; } public enum Infinite_Range { Up, Down, Both, None }
[Parameter("Show Session 1", DefaultValue = true, Group = "Session 1")] public bool S1_Show { get; set; } [Parameter("Session Label", DefaultValue = "Sydney", Group = "Session 1")] public string S1_Label { get; set; } [Parameter("Start time", DefaultValue = "21:00", Group = "Session 1")] public string S1_open { get; set; } [Parameter("End time", DefaultValue = "06:00", Group = "Session 1")] public string S1_close { get; set; } [Parameter("Color", Group = "Session 1", DefaultValue = "#20BEBF00")] public Color S1_Color { get; set; } [Parameter("Line Style", Group = "Session 1", DefaultValue = LineStyle.DotsRare)] public LineStyle S1_LineStyle { get; set; }
[Parameter("Show Session 2", DefaultValue = true, Group = "Session 2")] public bool S2_Show { get; set; } [Parameter("Session Label", DefaultValue = "Tokyo", Group = "Session 2")] public string S2_Label { get; set; } [Parameter("Start time", DefaultValue = "00:00", Group = "Session 2")] public string S2_open { get; set; } [Parameter("End time", DefaultValue = "09:00", Group = "Session 2")] public string S2_close { get; set; } [Parameter("Color", Group = "Session 2", DefaultValue = "#2001AF50")] public Color S2_Color { get; set; } [Parameter("Line Style", Group = "Session 2", DefaultValue = LineStyle.DotsRare)] public LineStyle S2_LineStyle { get; set; }
[Parameter("Show Session 3", DefaultValue = true, Group = "Session 3")] public bool S3_Show { get; set; } [Parameter("Session Label", DefaultValue = "London", Group = "Session 3")] public string S3_Label { get; set; } [Parameter("Start time", DefaultValue = "07:00", Group = "Session 3")] public string S3_open { get; set; } [Parameter("End time", DefaultValue = "16:00", Group = "Session 3")] public string S3_close { get; set; } [Parameter("Color", Group = "Session 3", DefaultValue = "#2033C1F3")] public Color S3_Color { get; set; } [Parameter("Line Style", Group = "Session 3", DefaultValue = LineStyle.DotsRare)] public LineStyle S3_LineStyle { get; set; }
[Parameter("Show Session 4", DefaultValue = true, Group = "Session 4")] public bool S4_Show { get; set; } [Parameter("Session Label", DefaultValue = "New York", Group = "Session 4")] public string S4_Label { get; set; } [Parameter("Start time", DefaultValue = "13:00", Group = "Session 4")] public string S4_open { get; set; } [Parameter("End time", DefaultValue = "22:00", Group = "Session 4")] public string S4_close { get; set; } [Parameter("Color", Group = "Session 4", DefaultValue = "#20FF3334")] public Color S4_Color { get; set; } [Parameter("Line Style", Group = "Session 4", DefaultValue = LineStyle.DotsRare)] public LineStyle S4_LineStyle { get; set; }
[Parameter("Show Session 5", DefaultValue = false, Group = "Session 5")] public bool S5_Show { get; set; } [Parameter("Session Label", DefaultValue = "", Group = "Session 5")] public string S5_Label { get; set; } [Parameter("Start time", DefaultValue = "00:00", Group = "Session 5")] public string S5_open { get; set; } [Parameter("End time", DefaultValue = "09:00", Group = "Session 5")] public string S5_close { get; set; } [Parameter("Color", Group = "Session 5", DefaultValue = "#75939695")] public Color S5_Color { get; set; } [Parameter("Line Style", Group = "Session 5", DefaultValue = LineStyle.DotsRare)] public LineStyle S5_LineStyle { get; set; }
public List<Session> _sessions = new();
protected override void Initialize() { if (Bars.TimeFrame > TimeFrame.Hour4) return;
if (S1_Show && S1_Label != "") _sessions.Add(new Session { name = S1_Label, Open = TimeSpan.Parse(S1_open, CultureInfo.InvariantCulture), Close = TimeSpan.Parse(S1_close), Color = S1_Color, LineStyle = S1_LineStyle }); if (S2_Show && S1_Label != "") _sessions.Add(new Session { name = S2_Label, Open = TimeSpan.Parse(S2_open, CultureInfo.InvariantCulture), Close = TimeSpan.Parse(S2_close), Color = S2_Color, LineStyle = S2_LineStyle }); if (S3_Show && S1_Label != "") _sessions.Add(new Session { name = S3_Label, Open = TimeSpan.Parse(S3_open, CultureInfo.InvariantCulture), Close = TimeSpan.Parse(S3_close), Color = S3_Color, LineStyle = S3_LineStyle }); if (S4_Show && S1_Label != "") _sessions.Add(new Session { name = S4_Label, Open = TimeSpan.Parse(S4_open, CultureInfo.InvariantCulture), Close = TimeSpan.Parse(S4_close), Color = S4_Color, LineStyle = S4_LineStyle }); if (S5_Show && S1_Label != "") _sessions.Add(new Session { name = S5_Label, Open = TimeSpan.Parse(S5_open, CultureInfo.InvariantCulture), Close = TimeSpan.Parse(S5_close), Color = S5_Color, LineStyle = S5_LineStyle });
foreach (var session in _sessions) { Draw_rect(session.name, session.Open, session.Close, session.Color, session.LineStyle); } var bars_m1 = MarketData.GetBars(TimeFrame.Minute, Symbol.Name); bars_m1.BarOpened += bars_m1_BarOpened;
var Current_bars = MarketData.GetBars(Bars.TimeFrame, Symbol.Name); Current_bars.BarOpened += Current_bars_BarOpened; ; }
public class Session { public string name { get; set; } public TimeSpan Open { get; set; } public TimeSpan Close { get; set; } public Color Color { get; set; } public LineStyle LineStyle { get; set; } } }
I don't think this was ever working. When the indicator is unloaded and destroyed, all references created by the indicator will do as well, same for the indicator's log. If you want to check this, write in an external file.
Best regards,
Panagiotis
Ok, now there is no way for the indicator to clear the interactive objects it created when it is deleted.
I am not sure what you mean, can you elaborate?
When my indicator is on the chart. Adds objects to the chart, such as rectangles and trend lines These objects are interactive. "IsInteractive = true;" When I remove the indicator from the chart, those objects remain in the chart! If their interactive feature is false, they will be deleted automatically, but as I said, I will turn on their interactive feature. I want to delete all the objects added to the chart when the indicator is deleted
I don't think this was ever working. When the indicator is unloaded and destroyed, all references created by the indicator will do as well, same for the indicator's log. If you want to check this, write in an external file.
Best regards,
Panagiotis
Ok, now there is no way for the indicator to clear the interactive objects it created when it is deleted.
Dear friend, unfortunately, I could not call it correctly and with the error: Crashed in Initialize with NullReferenceException: Object reference not set to an instance of an object.
You seem to be under the illusion that firemyst is one of your employees. I suggest you adopt a better bedside manner. Thereafter, you'll be pleasantly surprised at the number of folk that that will be willing to help out with any issues you have. Until then - business as usual.
FWIW - this was the extended approach that firemyst was alluding to:
foreach (var indicatorArea in Chart.IndicatorAreas)
{
foreach (var indicator in indicatorArea.Objects)
{
Print($"Indicator => Area: {indicatorArea.GetType().Name} Name: {indicator.Name}");
}
}
Whilst it is frustrating to not be presented with the answer that you WANT, sometimes you just have to be grateful that folk have taken the time to point you in the right direction.
thank you for your help But this code doesn't show anything. Because indicatorArea.Objects.Count =>> 0 And the internal for command is not executed at all
Unfortunately, I am not fluent in English and I use Google translator for help. Maybe I can't ask my question correctly!!
Dear friend, do you want to teach me how to split the nucleus of an atom?
This is a simple question! If you know the solution, please guide me
How to split the nucleus of an atom: there's plenty of "how to's" on Google and YouTube already on how to do it.
Guiding you on this issue - I already started. Second post in this thread is how you would start going about doing it through C# code. If you're not trying by writing any code, I'm not writing code for you. Best way to learn is to do it on your own.
If you're just looking at the chart and wondering where they are on the chart, then look for the indicator name on the chart:
If the name of the indicator isn't on your chart, then put it there by choosing to display "Indicator Titles":
I wanted to find out through C# what oscillators are placed on the chart, but I couldn't find a solution. And I think there is no way
And I respect your wrong way of thinking.
Good luck.
AlgoCreators
20 Nov 2024, 19:48
Hello dear friend
I am the designer of the Position Manager indicator
Is it possible for you to message me on Telegram? I want to help you solve the problem
My Telegram ID is: @AgloCreators
@AlgoCreators