Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I am trying to draw a plot of a slope of either HMA or EHMA with overlay = false.
Using the formula
Slope=Math.Round(System.Math.Atan(Slope(HMA(115),4, 1))*180/Math.PI, 2);
Just finding it difficult to get this properly.
Any help would be highly appreciated!
Thanks
Can you help answer these questions from other members on NexusFi?
Try to Index the value if it is attached to a cuirrent value of an indie,
example
I cannot say w/o context: Is Slope is a type of variable?
I try indexable value of Slope or the equation of the HMA to see that it is being updated on the current bars value to store in Slope.
example
if the slope is a double
Slope[0]=Math.Round(System.Math.Atan(Slope(HMA(115),4, 1))*180/Math.PI, 2);
and possible that the entrie is,but unlikely
Slope=Math.Round(System.Math.Atan(Slope(HMA(115),4, 1))*180/Math.PI, 2)[0];
and also that the HMA itself is continually updated each bar then has to be looked at its current value.
Slope=Math.Round(System.Math.Atan(Slope(HMA(115),4, 1)[0])*180/Math.PI, 2);
As you point out , I am trying to plot the curve of the calculated slope ( double) of the HMA as it changes at every bar. but the plot.set gives me a compile error .
-----> Cannot apply indexing with [] to an expression of type 'double'
Also I want to see what was the slope[0] , Slope[1] and Slope[3] etc., like a series.
best to change the variable to a Series<double> and hen you can store a value in Slope and use indexing to compare or check what it's value was on a certain bar.
I wrote this but I still get the same error. What am I doing wrong?
Code:
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
private DataSeries p1;
private DataSeries p2;
#endregion
/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Plot2"));
Overlay = false;
p1 = new DataSeries(this);
p2 = new DataSeries(this);
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Plot0
{
get { return Values[0]; }
}
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Plot2
{
get { return Values[1]; }
}
[Description("")]
[GridCategory("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}