How to use Session high and Session low

Questions about MultiCharts .NET and user contributed studies.
Runner
Posts: 1
Joined: 20 Feb 2018

How to use Session high and Session low

Postby Runner » 30 Nov 2018

I see there are examples how to use Session high and low for easy language. Are there any examples to use Session High and Session Low in Multicharts .net. ?

Thanks in advance.

User avatar
Svetlana MultiCharts
Posts: 296
Joined: 19 Oct 2017
Has thanked: 1 time
Been thanked: 74 times

Re: How to use Session high and Session low

Postby Svetlana MultiCharts » 11 Feb 2020

Hello, Runner,

In PowerLanguage, there are prebuilt functions — HighS and LowS.

There are no such functions in MultiCharts .NET, however you can build an indicator that works similar to those functions.

Code: Select all

using System; using System.Drawing; using System.Linq; using PowerLanguage.Function; namespace PowerLanguage.Indicator { [SameAsSymbol(true)] public class Session_High_Low: IndicatorObject { public Session_High_Low(object _ctx) : base(_ctx) { } public double high_p = 0; public double low_p = 0; public double high_p_PLE = 0; public double low_p_PLE = 0; private IPlotObject plot1; private IPlotObject plot2; protected override void Create() { plot1 = AddPlot(new PlotAttributes("", EPlotShapes.Line, Color.Red)); plot2 = AddPlot(new PlotAttributes("", EPlotShapes.Line, Color.Blue)); } protected override void StartCalc() { high_p = Bars.HighValue; low_p = Bars.LowValue; high_p_PLE = Bars.HighValue; low_p_PLE = Bars.LowValue; } protected override void CalcBar() { if ((Bars.Status == EBarState.Close)) { if (low_p >= Bars.LowValue) { low_p = Bars.LowValue; } if (high_p <= Bars.HighValue) { high_p = Bars.HighValue; } if (Bars.LastBarInSession == true) { high_p_PLE = high_p; low_p_PLE = low_p; low_p = Bars.LowValue; high_p = Bars.HighValue; } } plot1.Set(high_p_PLE); plot2.Set(low_p_PLE); } } }
image.png
(70.05 KiB) Not downloaded yet


Return to “MultiCharts .NET”