hi, i need to use Inside Bar function ...
i see indicator Inside_Bar but not is function
i must to create this function or is already available
Thanks
Inside Bar Function
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Inside Bar Function
Hello turbofib,
There is no built-in "Inside_Bar" function. That is possible to create your own function that will perform the required calculations.
There is no built-in "Inside_Bar" function. That is possible to create your own function that will perform the required calculations.
Re: Inside Bar Function
i create this function :
when i call it from other function...i must to create
Or is there a way more simple to call the function insidebar(See Bars.Close BArs.Volume .....I do not have to instantiate an object of class)
Thanks
Code: Select all
namespace PowerLanguage
{
namespace Function
{
public sealed class InsideBar : FunctionSeries<System.Boolean>
{
public InsideBar(CStudyControl _master) : base(_master) { }
public InsideBar(CStudyControl _master, int _ds) : base(_master, _ds) { }
public Int32 n { get; set; }
protected override System.Boolean CalcBar()
{
if ((Bars.High[n-1]<=Bars.High[n]) && (Bars.Low[n-1]>=Bars.Low[n])) return(true);
else return(false);
}
}
}
}
Code: Select all
private Function.InsideBar _InsideBar;
_InsideBar = new Function.InsideBar(this);
Thanks
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Inside Bar Function
You could create an extension method. See here for a MultiCharts .NET example of that.Or is there a way more simple to call the function insidebar(See Bars.Close BArs.Volume .....I do not have to instantiate an object of class)
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Inside Bar Function
turbofib, you need to create an instance of the function like in your post #3.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Inside Bar Function
See the example below for how to use an extension method for detecting an inside bar. This does not require instantiating an function object class, but you can just call the `Bars.InsideBar()` method.Or is there a way more simple to call the function insidebar(See Bars.Close BArs.Volume .....I do not have to instantiate an object of class)
Code: Select all
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator
{
public class ForumExample_InsideBar : IndicatorObject
{
public ForumExample_InsideBar(object _ctx) : base(_ctx) { }
protected override void CalcBar()
{
if (Bars.Status == EBarState.Close)
Output.WriteLine("{0} - Is this an inside bar? {1}",
Bars.Time[0].ToString("d-M-y HH:mm:ss"),
Bars.InsideBar());
}
}
}
namespace PowerLanguage
{
public static class MyExtensions
{
public static bool InsideBar(this ISeriesSymbolData bar)
{
if ((bar.High[0] <= bar.High[1]) && (bar.Low[0] >= bar.Low[1]))
return true;
return false;
}
}
}