The study begin 6 bars after  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
shivax
Posts: 90
Joined: 02 Sep 2013
Has thanked: 37 times

The study begin 6 bars after

Postby shivax » 27 Jul 2014

IN THE EXAMPLE OF "MULTICHART.NET programming guide v.10.pdf" page 35 using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;

namespace PowerLanguage.Indicator{
public class Prova__: IndicatorObject {
public Prova__(object _ctx):base(_ctx){}
private IPlotObject plot1;

private Function.ProvaCurrentBar3 Contabar;

protected override void Create() {
// create variable objects, function objects, plot objects etc.
plot1 = AddPlot(new PlotAttributes("", EPlotShapes.Line, Color.Red));

Contabar = new Function.ProvaCurrentBar3(this);
}
protected override void StartCalc() {
// assign inputs

}
protected override void CalcBar(){

plot1.Set(Contabar.Value);

}
}
}

using System;
using System.Drawing;
using System.Linq; namespace PowerLanguage
{
namespace Function
{
public sealed class ProvaCurrentBar : FunctionSimple<System.Int32>
{
public ProvaCurrentBar(CStudyControl _master) : base(_master) { }
public ProvaCurrentBar(CStudyControl _master, int _ds) : base(_master, _ds) { }

private int m_current_bar ;
protected override int CalcBar(){

return ++m_current_bar;
}
protected override void StartCalc(){
m_current_bar = 0;
}
}
}
} See pics below

the program starts counting from the bar 6 on ...( In the previous examples the calculation was correct)
why? thanks
Attachments
screenshot_206.png
(155.81 KiB) Downloaded 713 times
Last edited by shivax on 29 Jul 2014, edited 1 time in total.

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

Re: The study begin 6 bars after

Postby Henry MultiСharts » 28 Jul 2014

Hello shivax,

Please refer to BarsBack in 4.5 Functions and Special Variables

shivax
Posts: 90
Joined: 02 Sep 2013
Has thanked: 37 times

Re: The study begin 6 bars after

Postby shivax » 28 Jul 2014

i read that....but I did not find examples of how to configure it :(

i find it :

https://www.multicharts.com/trading-sof ... axBarsBack
but does not show how to declare

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: The study begin 6 bars after

Postby JoshM » 29 Jul 2014


shivax
Posts: 90
Joined: 02 Sep 2013
Has thanked: 37 times

Re: The study begin 6 bars after

Postby shivax » 29 Jul 2014

I set MAXBARSBACK=1 but risult is the same :(
Attachments
Immagine1.png
(69.7 KiB) Downloaded 708 times

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

Re: The study begin 6 bars after  [SOLVED]

Postby Henry MultiСharts » 29 Jul 2014

shivax, you have set the maxbarsback for signals, while you are using an indicator.
You need to go to Format->Study->Format->Properties->Max number of bars study will reference:User specified or refer to the link provided by the JoshM to learn how to set it from the code.


Return to “MultiCharts .NET”