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
I will Develop your Indicator or Strategy for FREE
Collapse
This topic is closed.
X
X
-
Originally posted by TPCMAN View Post
-
Originally posted by Jazz88 View PostHello there,
I'm looking for a coder who can help me with Ninjascript. I want Market Analyzer to prompt me when the price hits Bollinger Band limits. I will take a bid for the job.
Thanks,
Jasmine
I created an Indicator for you called BollingerPriceRelation. What it does is plots a value that indicates how close price is to the upper or lower bollinger bands as a percentage. So if price is at the upper band the value of the BollingerPriceRelation indicator will be 100. If price is at the lower band the value will be -100. If price is halfway between the middle band and the upper band the value will be 50 and so on.
What's cool about doing it this way is it gives you a lot of flexibility. Examples:
1. You can be alerted to price action that hits the upper band only, the lower band only, or either band.
2. You can specify an arbitrary distance to the bollinger band. That is you could be alerted when price is 75% of the way to the upper band, or when it hits the upper band (100%), or when it goes beyond the upper band (e.g. 110%)
Note: The indicator currently plots the relationship of the CLOSE price of the bar to the Bollinger bands
You can then add this indicator to your Market Analyzer and add an Alert condition. You can watch this video for how to do this: NinjaTrader 7 | Intro to the Market Analyzer by OptimusTradingGroup
Comment
-
Thanks. That's frustrating. Guess it's like trading--there's always that unknown factor Anyway didn't mean to undercut anyone and hope it proves useful.
Comment
-
Cumulative volume as % of average
I've been looking for an indicator (oscillator) that shows the current cumulative session volume as a % of the average for the current time. This would serve as an "internal" indicator of trading sentiment, activity and sheds some light on prospective volatility. For example, if pre-market volume is higher than normal, this may suggest a higher potential for larger moves in the session.
I've found this information to be useful prior to market open and into the first couple of hours of the session. Half-hour intervals is what I've tracked in the past. It's been helpful to glance at session volume and know whether it's high or low compared to the "norm."
The Details:
Volume would begin accumulating at the beginning of the day's session, e.g. 8pmET for TF.
The "average" would be the average, over a period of x days, of the cumulative volume at a given time interval. (It wouldn't be practical or particularly relevant to calculate this for anything below a 30 minute chart.)
Indicator Parameters:
Session start time
Session end time
Number of days over which to calculate average *
* For example, to determine the 60-day average for the 30min interval ending at 9:00am, volume would have to be totaled for each 30min bar from 8:30pm the prior day, through the 30min bar ending at 9:00am present day. This would be repeated for the past 60 trading days, then divided by 60. Then updated for the next 30min bar.
I realize this could require some major number crunching and might be better suited for a separate database. Too complicated? Please advise!Last edited by levesque; 08-23-2012, 02:10 PM.
Comment
-
Originally posted by levesque View PostI've been looking for an indicator (oscillator) that shows the current cumulative session volume as a % of the average for the current time. This would serve as an "internal" indicator of trading sentiment, activity and sheds some light on prospective volatility. For example, if pre-market volume is higher than normal, this may suggest a higher potential for larger moves in the session.
I've found this information to be useful prior to market open and into the first couple of hours of the session. Half-hour intervals is what I've tracked in the past. It's been helpful to glance at session volume and know whether it's high or low compared to the "norm."
The Details:
Volume would begin accumulating at the beginning of the day's session, e.g. 8pmET for TF.
The "average" would be the average, over a period of x days, of the cumulative volume at a given time interval. (It wouldn't be practical or particularly relevant to calculate this for anything below a 30 minute chart.)
Indicator Parameters:
Session start time
Session end time
Number of days over which to calculate average *
* For example, to determine the 60-day average for the 30min interval ending at 9:00am, volume would have to be totaled for each 30min bar from 8:30pm the prior day, through the 30min bar ending at 9:00am present day. This would be repeated for the past 60 trading days, then divided by 60. Then updated for the next 30min bar.
I realize this could require some major number crunching and might be better suited for a separate database. Too complicated? Please advise!
The reason I am doing this is that specific days of a week have specific volumes. On Thursday and Friday there will be news releases around 8:30 and the pre-session volume tends to be higher than on the other days of the week. So I do not want to compare the volume of Thursdays and Mondays.
The indicator plots each bar as a percentage of the average volume for that bar, for example if you look at the 30 min bar closing at 2:00 PM, the indicator will compare the volume to all preceding 2:00 PM bars on Thursdays only. The bar will be plotted in different colors for below average, average and above average volume. You can set the thresholds for those values.
Another pain is the change from summertime to wintertime, if you want to access the data from an exchange which is not in your time zone. This has been taken into account (to make sure you get the 2:00 PM bars in exchange time and not anything else).
The indicator will also plot the cumulated volume as a percentage of the Thursday-averaged cumulated volume of the same bar of the session.
The indicator can be downloaded here:
The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies
For downloading indicators, membership is required. I am a member (no business relationsship with Big Mike) who has posted around 100 indicators, but I am not the only one to post. You can also send me a private message to obtain the indicator.
The chart below shows that the Asian session has seen above average volume (green bars), but that the excitement did not carry over into the European session (white bars), and that the volume during the US session was below average (mainly white and red bars). Over the day the cumulated volume as shown for the last bar of the session was 84% compared to the volume of the prior 26 Thursdays (half a year).Last edited by Harry; 08-23-2012, 02:47 PM.
Comment
-
Adding an exponential smoothing to DM
The default DM indicator in Ninja Trader does not contain an exponential smoothing for Positive Directional Movement and Minus Directional Movement, thus shows a significant lag in it.
the default code in Ninja is this:
Code:namespace NinjaTrader.Indicator { /// <summary> /// Directional Movement (DM). This is the same indicator as the ADX, with the addition of the two directional movement indicators +DI and -DI. +DI and -DI measure upward and downward momentum. A buy signal is generated when +DI crosses -DI to the upside. A sell signal is generated when -DI crosses +DI to the downside. /// </summary> [Description("This is the same indicator as the ADX, with the addition of the two directional movement indicators +DI and -DI. +DI and -DI measure upward and downward momentum. A buy signal is generated when +DI crosses -DI to the upside. A sell signal is generated when -DI crosses +DI to the downside.")] public class DM : Indicator { #region Variables private int period = 14; private DataSeries dmPlus; private DataSeries dmMinus; private DataSeries sumDmPlus; private DataSeries sumDmMinus; private DataSeries sumTr; private DataSeries tr; #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(new Pen(Color.DarkGreen, 3), "ADX")); Add(new Plot(Color.Blue, "+DI")); Add(new Plot(Color.Red, "-DI")); Add(new Line(Color.DarkViolet, 25, "Lower")); Add(new Line(Color.YellowGreen, 75, "Upper")); dmPlus = new DataSeries(this); dmMinus = new DataSeries(this); sumDmPlus = new DataSeries(this); sumDmMinus = new DataSeries(this); sumTr = new DataSeries(this); tr = new DataSeries(this); } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { double trueRange = High[0] - Low[0]; if (CurrentBar == 0) { tr.Set(trueRange); dmPlus.Set(0); dmMinus.Set(0); sumTr.Set(tr[0]); sumDmPlus.Set(dmPlus[0]); sumDmMinus.Set(dmMinus[0]); Value.Set(50); } else { tr.Set(Math.Max(Math.Abs(Low[0] - Close[1]), Math.Max(trueRange, Math.Abs(High[0] - Close[1])))); dmPlus.Set(High[0] - High[1] > Low[1] - Low[0] ? Math.Max(High[0] - High[1], 0) : 0); dmMinus.Set(Low[1] - Low[0] > High[0] - High[1] ? Math.Max(Low[1] - Low[0], 0) : 0); if (CurrentBar < Period) { sumTr.Set(sumTr[1] + tr[0]); sumDmPlus.Set(sumDmPlus[1] + dmPlus[0]); sumDmMinus.Set(sumDmMinus[1] + dmMinus[0]); } else { sumTr.Set(sumTr[1] - sumTr[1] / Period + tr[0]); sumDmPlus.Set(sumDmPlus[1] - sumDmPlus[1] / Period + dmPlus[0]); sumDmMinus.Set(sumDmMinus[1] - sumDmMinus[1] / Period + dmMinus[0]); } double diPlus = 100 * (sumTr[0] == 0 ? 0 : sumDmPlus[0] / sumTr[0]); double diMinus = 100 * (sumTr[0] == 0 ? 0 : sumDmMinus[0] / sumTr[0]); double diff = Math.Abs(diPlus - diMinus); double sum = diPlus + diMinus; Value.Set(sum == 0 ? 50 : ((Period - 1) * Value[1] + 100 * diff / sum) / Period); DiPlus.Set(diPlus); DiMinus.Set(diMinus); } } } }
Code:namespace NinjaTrader.Indicator { /// <summary> /// DM with Exponentially smoothed Positive Directional Movement and Minus Directional Movement /// </summary> [Description("DM with Exponentially smoothed Positive Directional Movement and Minus Directional Movement")] public class MyDM : Indicator { #region Variables private int period = 14; private DataSeries dmPlus; private DataSeries dmMinus; private DataSeries sumDmPlus; private DataSeries sumDmMinus; private DataSeries sumTr; private DataSeries tr; #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(new Pen(Color.DarkGreen, 3), "ADX")); Add(new Plot(Color.Blue, "+DI")); Add(new Plot(Color.Red, "-DI")); Add(new Line(Color.DarkViolet, 25, "Lower")); Add(new Line(Color.YellowGreen, 75, "Upper")); dmPlus = new DataSeries(this); dmMinus = new DataSeries(this); sumDmPlus = new DataSeries(this); sumDmMinus = new DataSeries(this); sumTr = new DataSeries(this); tr = new DataSeries(this); } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { double trueRange = High[0] - Low[0]; if (CurrentBar == 0) { tr.Set(trueRange); dmPlus.Set(0); dmMinus.Set(0); sumTr.Set(0.001); sumDmPlus.Set(dmPlus[0]); sumDmMinus.Set(dmMinus[0]); Value.Set(50); } else { tr.Set(Math.Max(Math.Abs(Low[0] - Close[1]), Math.Max(trueRange, Math.Abs(High[0] - Close[1])))); dmPlus.Set(High[0] - High[1] > Low[1] - Low[0] ? Math.Max(High[0] - High[1], 0) : 0); dmMinus.Set(Low[1] - Low[0] > High[0] - High[1] ? Math.Max(Low[1] - Low[0], 0) : 0); sumTr.Set(sumTr[1]+(1/14)*(tr[0]-sumTr[1])); sumDmPlus.Set(sumDmPlus[1]+(1/14)*(dmPlus[0]-sumDmPlus[1])); sumDmMinus.Set(sumDmMinus[1]+(1/14)*(dmMinus[0]-sumDmMinus[1])); double diPlus = 100 * (sumTr[0] == 0 ? 0 : sumDmPlus[0] / sumTr[0]); double diMinus = 100 * (sumTr[0] == 0 ? 0 : sumDmMinus[0] / sumTr[0]); double diff = Math.Abs(diPlus - diMinus); double sum = diPlus + diMinus; Value.Set(sum == 0 ? 50 : 100*(diff/sum)); DiPlus.Set(diPlus); DiMinus.Set(diMinus); } } } }
But it seems that it does not work, the new indicator gives a constant value at 50, which means sum==0.
Many thanks if you can figure out the mistake, or give an example how to do an exponential smooth.
Wolfcuring
Comment
-
The default NinjaTrader indicator DM, smoothes both directional movement and true range exponentially by using Wilder's average (which transforms the period N into a smoothing constant of 1/N as opposed of modern exponential averages which use a smoothing constant of 2/(N+1)).
The DM is correctly implemented, already has exponential smoothing as required, and I do not understand what you try to achieve. or or
Please explain.
Originally posted by wolfcuring View PostThe default DM indicator in Ninja Trader does not contain an exponential smoothing for Positive Directional Movement and Minus Directional Movement, thus shows a significant lag in it.
Many thanks if you can figure out the mistake, or give an example how to do an exponential smooth.
Wolfcuring
Comment
-
Cumulative volume as % of average
Originally posted by Harry View PostI have coded an indicator which does what you look for.
...
The indicator will also plot the cumulated volume as a percentage of the Thursday-averaged cumulated volume of the same bar of the session.
...
Comparing weekdays to themselves makes a lot of sense but seemed insurmountable. Evidently not!
Looks perfect - am trying it out today.
Many thanks,
JB
Comment
-
Originally posted by levesque View PostHarry, thank you for jumping in with this. I had looked on bigmiketrading (am also a member) but was searching for "cumulative volume."
Comparing weekdays to themselves makes a lot of sense but seemed insurmountable. Evidently not!
Looks perfect - am trying it out today.
Many thanks,
JB
Comment
-
Originally posted by Harry View PostThe default NinjaTrader indicator DM, smoothes both directional movement and true range exponentially by using Wilder's average (which transforms the period N into a smoothing constant of 1/N as opposed of modern exponential averages which use a smoothing constant of 2/(N+1)).
The DM is correctly implemented, already has exponential smoothing as required, and I do not understand what you try to achieve. or or
Comment
-
Hi,
I have a couple of requests if you would be willing and interested....
1) I know this is not an indicator, but I'm looking for a script that shows the drawing tools as a separate toolbar that can be positioned on the left, right or bottom of the chart window. This would be helpful so that I don't have to keep going through drop downs or awkward hot keys to reach my drawing tools.
2) An indicator tool that shows the volume range profile histogram for sections of a chart.
Thanks!
Comment
-
Originally posted by ShrewdBiz View Post2) An indicator tool that shows the volume range profile histogram for sections of a chart.
Thanks!
Comment
-
Originally posted by ShrewdBiz View PostHi,
I have a couple of requests if you would be willing and interested....
1) I know this is not an indicator, but I'm looking for a script that shows the drawing tools as a separate toolbar that can be positioned on the left, right or bottom of the chart window. This would be helpful so that I don't have to keep going through drop downs or awkward hot keys to reach my drawing tools.
2) An indicator tool that shows the volume range profile histogram for sections of a chart.
Thanks!
I'm low maintenance and realize this is free, so not expecting same commitments as if I'm paying for an indicator. Hope you'll still consider my request. If not, cheers anyway!
Comment
-
Originally posted by CodeButterfly View PostDo you mean to create micro-composite volume profile? That is, you want to be able to draw a rectangle and show the volume profile for the bars included in that rectangle? Or something else? Does "volume range profile" mean something different than "volume profile"?
And no, "volume range profile" doesn't mean something different from "volume profile". I accidentally added an extra word as I looked over at a chart I had open.Last edited by ShrewdBiz; 08-28-2012, 11:45 AM.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Jonker, 04-27-2024, 01:19 PM
|
3 responses
22 views
0 likes
|
Last Post Today, 05:45 PM | ||
Started by businessman1929, 04-29-2024, 01:28 PM
|
2 responses
21 views
0 likes
|
Last Post Today, 05:38 PM | ||
Started by bltdavid, 03-27-2023, 05:32 AM
|
18 responses
346 views
0 likes
|
Last Post
by ETFVoyageur
Today, 05:28 PM
|
||
Started by NM_eFe, Today, 05:15 PM
|
0 responses
4 views
0 likes
|
Last Post
by NM_eFe
Today, 05:15 PM
|
||
Started by vitaly_p, Today, 05:09 PM
|
0 responses
4 views
0 likes
|
Last Post
by vitaly_p
Today, 05:09 PM
|
Comment