Plot time of a study's price change in scanner  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
darob
Posts: 207
Joined: 20 Nov 2014
Has thanked: 57 times
Been thanked: 32 times

Plot time of a study's price change in scanner

Postby darob » 19 Apr 2016

Hi, I'd like to plot the time of a change beside the price in a scanner so I tried replacing closing price with time so I could load the variation as well. Ain't working. The first is the original price study.

Much help appreciated!
Attachments
Time of alert.png
(93.33 KiB) Downloaded 1139 times

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Plot time of a study's price change in scanner  [SOLVED]

Postby Henry MultiСharts » 20 Apr 2016

Hello darob,

Here is a sample code for that:

Code: Select all

using System;
using System.Drawing;

namespace PowerLanguage.Indicator
{
public class price_change : IndicatorObject
{
private IPlotObjectStr Plot1;
private IPlotObjectStr Plot2;
public price_change (object ctx)
: base(ctx)
{
}

[Input]
public int ExchangeShift { get; set; }
protected override void Create()
{
Plot1 = AddPlot(new StringPlotAttributes("BarCloseTime", Color.Red));
Plot2 = AddPlot(new StringPlotAttributes("BarUpdateTime", Color.Red));
}
protected override void StartCalc()
{
}

protected override void CalcBar()
{
Plot1.Set(Bars.TimeValue.ToString());
Plot2.Set(DateTime.Now.AddHours(ExchangeShift).ToString());
}
}
}

darob
Posts: 207
Joined: 20 Nov 2014
Has thanked: 57 times
Been thanked: 32 times

Re: Plot time of a study's price change in scanner

Postby darob » 20 Apr 2016

This is great, works perfectly. Many thanks.


Return to “MultiCharts .NET”