The Plot class is the lower level method to OnBarUpdate which lets you directly manipulate the graphics used to draw stuff on the chart. So in this example I used it to draw a box to put the degree values in, which wouldn't normally be possible just using the NinjaScript Draw functions.
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Slope function output
Collapse
X
-
Originally posted by Burga1 View Post
The Plot class is the lower level method to OnBarUpdate which lets you directly manipulate the graphics used to draw stuff on the chart. So in this example I used it to draw a box to put the degree values in, which wouldn't normally be possible just using the NinjaScript Draw functions.
-
Hi again Gumphrie,
OK I think I figured out how to construct the indicator...I just have a couple of questions about your code please. In the code you wrote "do something" where I assume code is inserted after the degree angle has been determined, correct?
Also you have "populated in OnBarUpdate" for the "EMASeries" variable, I assume that the values for "EMASeries" is to be calculated there...?
Comment
-
Gumphrie,
I like your MaSlopeBox...just what I was looking for. Could you please provide a quick response as to how I would tweak it to plot the actual "degrees" values, say for the SMA WYS, instead of the price SMA itself. If I can plot the degrees DataSeries, then I can use the values in subsequent logic. Thanks for yor help.
Don44
Comment
-
I'd really like to be able to use this indicator, but it doesn't seem to do anything.
No value is every shown in the data box and plot is always empty.
Am I doing something wrong?
It looks like the last version was quite a while ago so perhaps it needs a few tweaks to work with 6.5.
Comment
-
6.5 version
Find attached, NT changed their implementation of the Slope() function with 6.5.Attached Files
Comment
-
Thank you very much. This is SO useful.
I'm still getting the hang of it, but I'm wondering if there is a way to display the slope in the Databox? Currently it shows the moving average value, rather than the slope.
Currently the only indication of slope is a small box in the bottom right corner and it seems many indicators (BarTimer, CandleStickPattern, etc) like to use this exact spot which can make the result difficult to see. I'd like to use this indicator for multiple EMAs at once , but the degrees display overlaps itself...
Last edited by Elliott Wave; 04-13-2008, 10:13 PM.
Comment
-
I changed this so you can use multiple instances without having the data boxes covering each other up.
Just change the boxnumber parameter.
This may conflict with previous versions due to the public enums, if so simply open the .cs file in notepad and comment that code and it should work.Last edited by Elliott Wave; 04-16-2008, 01:13 AM.
Comment
-
Originally posted by Gumphrie View PostFind attached, NT changed their implementation of the Slope() function with 6.5.
Feel free to optimize anything that could be done better. My main goal was to allow multiple instances, increase the number of MA types supported, enhance readability with higher resolutions, and prevent the data box from conflicting with every other indicator that likes to use that same spot on the chart.
Comment
-
This is a really interesting indicator, many thanks to Gumphrie & Elliot Wave for putting it together, presumably it's being used to try and determine if market is range bound or trending (maybe with a couple of different MAs e.g. fast and slow)?
Has anyone nailed down anything more than that (period,type, slope etc) or have some initial values to look at?
Comment
-
I'm still experimenting, but I think you have the idea. Basically its to avoid trading false signals when the market is directionless.
At the moment I'm using 5 different periods. I like to use EMAs and the WDS slope as its independent of the chart view. A way to use it that often identifies good trades is that when all 5 periods are negative (a long downtrend), then the shortest three turn positive I will go long (a confirmed reversal). Another example is to go short when all 5 period are negative (definitely not a false trend), and then cover when the shortest period turn positive above 80 degrees (a sharp reversal).
Another benefit would be as a quick way to get out of bad trades. For example if you are short and the 5 period EMA slope suddenly goes to +70 degrees, it might be time to bail... Looking at historically bad trades in my strategy, this could be a good filter to keep the losses as small as possible, rather than waiting for slower reacting conditions to exit the trade.
There's countless ways this could be used, but until the slope output is accessible externally to the strategy wizard and as the input of other indicators, its not as powerful as it could be.
If the degrees calculation is made into a plot, it could also be used in the market analyzer.
I'm still scratching my head on how to do it though. I'll have to look at a few more examples and work on it tonight.Last edited by Elliott Wave; 04-17-2008, 02:32 PM.
Comment
-
These all seem like good ideas. You're right - if the degree output could be used within strategies then it could have a number of potential uses as an indicator. I'd love to help, but that's way above my programming level at the moment.
Are you aware of some of the TRO indicators Josh ported over? TRO_PMSM_Trend would give you an alternative way of showing trend direction of multiple MAs that you could reference in a strategy. http://www.ninjatrader-support.com/v...ead.php?t=2671
However, having the degree of the slope could be much more powerful.
Comment
-
Paul, thats something I'd eventually like to make a parameter that can be changed but at the moment, you'll have to edit the code.
I made the font a bit bigger than the original because I'm using a high resolution.
In the code under variables this line sets the default font:
private System.Drawing.Font textFont = new Font("Arial", 12);
To change the colors of the font from lime and red, use the search and replace function and search for
Color.Red and Color.LimeGreen and replace all instances with whatever colors your prefer.
-----
Originally posted by altrader View PostThese all seem like good ideas. You're right - if the degree output could be used within strategies then it could have a number of potential uses as an indicator. I'd love to help, but that's way above my programming level at the moment.
Are you aware of some of the TRO indicators Josh ported over? TRO_PMSM_Trend would give you an alternative way of showing trend direction of multiple MAs that you could reference in a strategy. http://www.ninjatrader-support.com/v...ead.php?t=2671
I'm really excited for NT7 when hopefully the "InputSeries" parameter is supported from the indicator dialog on the charts. Currently it appears you have to plot an indicator as part of a strategy to be able to set the input of the indicator to the output of other indicators.
Being able to measure the slope of any indicator value would be really useful.Last edited by Elliott Wave; 04-17-2008, 04:07 PM.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Kaledus, Today, 01:29 PM
|
0 responses
3 views
0 likes
|
Last Post
by Kaledus
Today, 01:29 PM
|
||
Started by PaulMohn, Today, 12:36 PM
|
1 response
16 views
0 likes
|
Last Post Today, 01:23 PM | ||
Started by yertle, Yesterday, 08:38 AM
|
8 responses
37 views
0 likes
|
Last Post
by ryjoga
Today, 01:22 PM
|
||
Started by rdtdale, Today, 01:02 PM
|
1 response
6 views
0 likes
|
Last Post Today, 01:13 PM | ||
Started by alifarahani, Today, 09:40 AM
|
3 responses
19 views
0 likes
|
Last Post Today, 12:47 PM |
Comment