NexusFi: Find Your Edge


Home Menu

 





Slope to be shown on Overlay= False


Discussion in NinjaTrader

Updated
    1. trending_up 595 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread

Slope to be shown on Overlay= False

  #1 (permalink)
 yeskannan 
memphis, TN usa
 
Experience: Beginner
Platform: Ninja Trader
Trading: ES
Posts: 18 since Feb 2017
Thanks Given: 5
Thanks Received: 1

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

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Increase in trading performance by 75%
The Elite Circle
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
16 thanks
My NQ Trading Journal
14 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
  #2 (permalink)
 TigerStripes   is a Vendor
 
Posts: 109 since Mar 2021
Thanks Given: 33
Thanks Received: 56


yeskannan View Post
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

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);

Reply With Quote
  #3 (permalink)
 yeskannan 
memphis, TN usa
 
Experience: Beginner
Platform: Ninja Trader
Trading: ES
Posts: 18 since Feb 2017
Thanks Given: 5
Thanks Received: 1


Thanks for your reply TigerStripes!

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.

How to achieve this?

Thanks again.

Started this thread Reply With Quote
  #4 (permalink)
 TigerStripes   is a Vendor
 
Posts: 109 since Mar 2021
Thanks Given: 33
Thanks Received: 56


yeskannan View Post
Thanks for your reply TigerStripes!

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.

How to achieve this?

Thanks again.

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.

Reply With Quote
  #5 (permalink)
 yeskannan 
memphis, TN usa
 
Experience: Beginner
Platform: Ninja Trader
Trading: ES
Posts: 18 since Feb 2017
Thanks Given: 5
Thanks Received: 1

TigerStripes..

I will try that idea definitely!

Thanks a lot !

Started this thread Reply With Quote
  #6 (permalink)
 yeskannan 
memphis, TN usa
 
Experience: Beginner
Platform: Ninja Trader
Trading: ES
Posts: 18 since Feb 2017
Thanks Given: 5
Thanks Received: 1

TigerStriipes

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.

p1.Set = Math.Round(System.Math.Atan(Slope(HMA(10),3,0)[0])*180/Math.PI, 2);
p2.Set = Math.Round(System.Math.Atan(Slope(HMA(25),3,0)[0])*180/Math.PI, 2);

Plot0.Set(p1[0]);
Plot2.Set(p2[0]);
}

#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
}

Started this thread Reply With Quote
  #7 (permalink)
 TigerStripes   is a Vendor
 
Posts: 109 since Mar 2021
Thanks Given: 33
Thanks Received: 56

starters it is using NT7 as file scructure if it is compiled outside of NT8 it will not compile properly.

if it is then I am not sure where to take it since I do not know it well enough to code directly in NT7.

Reply With Quote




Last Updated on April 15, 2023


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts