Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
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)
Think or Swim indicator converted to Ninjatrader
Updated September 6, 2021
Top Posters
looks_one
caniwi
with 12 posts (0 thanks)
looks_two
bobwest
with 5 posts (3 thanks)
looks_3
nguyen74
with 3 posts (5 thanks)
looks_4
SamirOfSalem
with 3 posts (3 thanks)
Best Posters
looks_one
nguyen74
with 1.7 thanks per post
looks_two
hedgeplay
with 1.5 thanks per post
looks_3
SamirOfSalem
with 1 thanks per post
looks_4
bobwest
with 0.6 thanks per post
trending_up
5,933 views
thumb_up
16 thanks given
group
6 followers
forum
25 posts
attach_file
5 attachments
Think or Swim indicator converted to Ninjatrader
August 28th, 2021, 09:21 AM
Baton Rouge, LA - USA
Experience: None
Platform: NinjaTrader, RTrader
Trading: Emini ES, Crude CL
Posts: 61 since Sep 2016
Thanks Given: 24
Thanks Received: 72
Doesn't NT8 already have this called Buy Sell Volume or Buy Sell Pressure?
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
August 28th, 2021, 10:14 AM
Alberta, Canada
Posts: 14 since Aug 2021
Thanks Given: 19
Thanks Received: 5
nguyen74
Doesn't NT8 already have this called Buy Sell Volume or Buy Sell Pressure?
Kind of - but from what I see they're separate indicators, so taking up more screen "real estate" & are harder to read at a glance. The one I'm looking for would allow me to eliminate my current volume (bars) indicator, and is very easy to comprehend pressure direction at a glance with it changing the bar colour.
But then I'm new at this, maybe I'm not understanding the NT8 built in one correctly.
Tx
Bruce
August 28th, 2021, 10:27 AM
Ilsede, Germany
Experience: Advanced
Platform: NinjaTrader 8
Broker: Rithmic / CQG / Ninja Trader Brokerage
Trading: NQ
Posts: 1,525 since Sep 2011
Thanks Given: 2,067
Thanks Received: 2,316
caniwi
Kind of - but from what I see they're separate indicators, so taking up more screen "real estate" & are harder to read at a glance. The one I'm looking for would allow me to eliminate my current volume (bars) indicator, and is very easy to comprehend pressure direction at a glance with it changing the bar colour.
Besides these already mentioned indicators, you can also take a look at Ninja Trader 's built in Order Flow Cumulative Delta indicator.
This indicator allows you to change bar colors as well in order to determine pressure direction.
Hope this helps...
"If you don't design your own life plan, chances are you'll fall into someone else's plan. And guess what they have planned for you? Not much." - Jim Rohn
September 4th, 2021, 02:33 PM
Posts: 74 since Jan 2020
Thanks Given: 23
Thanks Received: 44
caniwi
If still looking, here's a quick conversion. There's an input towards the end "length1 " that doesn't seem to be used, unless I'm missing something. Anyway, have a look and see if results match ToS .
Code
namespace NinjaTrader.NinjaScript.Indicators
{
public class ToS389BuySellVolume : Indicator
{
private int spacing;
private int items2show;
public override void OnCalculateMinMax()
{
// make sure to always start fresh values to calculate new min/max values
double tmpMin = double.MaxValue;
double tmpMax = double.MinValue;
// For performance optimization, only loop through what is viewable on the chart
for (int index = ChartBars.FromIndex; index <= ChartBars.ToIndex; index++)
{
// since using Close[0] is not guaranteed to be in sync
// retrieve "Close" value at the current viewable range index
double plotValue = Volumes[0].GetValueAt(index);
// return min/max of close value
tmpMin = Math.Min(tmpMin, plotValue);
tmpMax = Math.Max(tmpMax, plotValue);
}
// Finally, set the minimum and maximum Y-Axis values to +/- 50 ticks from the primary close value
MinValue = tmpMin; // -50 * TickSize;
MaxValue = tmpMax; // +50 * TickSize;
}
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"NT8 conversion of https://usethinkscript.com/threads/volume-buy-sell-indicator-with-hot-percent-for-thinkorswim.389/";
Name = "_ToS389 Buy-Sell Volume";
Calculate = Calculate.OnPriceChange;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = false;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event.
//See Help Guide for additional information.
IsSuspendedWhileInactive = true;
Show30DayAvg = true;
ShowTodayVolume = true;
ShowPercentOf30DayAvg = true;
UnusualVolumePercent = 200;
Show30BarAvg = true;
ShowCurrentBar = true;
ShowPercentOf30BarAvg = true;
ShowSellVolumePercent = true;
Length = 20;
Length1 = 20;
HotPct = 100;
type = ToS_389_MovingAverageTypes.SMA;
position = TextPosition.TopLeft;
AddPlot(new Stroke(Brushes.Green, 5), PlotStyle.Bar, "BuyVol");
AddPlot(new Stroke(Brushes.Red, 2), PlotStyle.Bar, "SellVol");
AddPlot(new Stroke(Brushes.Gray, 2), PlotStyle.Bar, "TV");
AddPlot(new Stroke(Brushes.LightGray, 1), PlotStyle.Line, "Vol Avg");
AddPlot(new Stroke(Brushes.Cyan, 2), PlotStyle.TriangleUp, "HV" );
}
else if (State == State.Configure)
{
AddDataSeries(BarsPeriodType.Day, 1);
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress == 1) return;
//Add your custom indicator logic here.
double O = Open[0];
double H = High[0];
double C = Close[0];
double L = Low[0];
double V = Volume[0];
double buying = V*(C-L)/(H-L);
double selling = V*(H-C)/(H-L);
SellVol[0] = selling;
TV[0] = Volume[0];
BuyVol[0] = buying;
VolAvg[0] = SMA(Volume, Length)[0];
double ma = (type == ToS_389_MovingAverageTypes.SMA) ? SMA(Volume, Length)[0] : EMA(Volume, Length)[0];
Hv[0] = (100 * ((Volume[0] / ma) - 1) >= HotPct) ? ma : Double.NaN;
double volLast30DayAvg = (CurrentBars[1] <= 30) ? 0 : (Volumes[1][1] + Volumes[1][2] + Volumes[1][3] + Volumes[1][4] + Volumes[1][5] + Volumes[1][6] + Volumes[1][7] + Volumes[1][8] + Volumes[1][9] + Volumes[1][10] + Volumes[1][11] + Volumes[1][12] + Volumes[1][13] + Volumes[1][14] + Volumes[1][15] + Volumes[1][16] + Volumes[1][17] + Volumes[1][18] + Volumes[1][19] + Volumes[1][20] + Volumes[1][21] + Volumes[1][22] + Volumes[1][23] + Volumes[1][24] + Volumes[1][25] + Volumes[1][26] + Volumes[1][27] + Volumes[1][28] + Volumes[1][29] + Volumes[1][30]) / 30;
double today = (CurrentBars[1] <= 30) ? 0 : Volumes[1][0];
double percentOf30Day = Math.Round((today / volLast30DayAvg) * 100, 0);
double avg30Bars = (CurrentBar <= 30) ? 0 : (Volume[1] + Volume[2] + Volume[3] + Volume[4] + Volume[5] + Volume[6] + Volume[7] + Volume[8] + Volume[9] + Volume[10] + Volume[11] + Volume[12] + Volume[13] + Volume[14] + Volume[15] + Volume[16] + Volume[17] + Volume[18] + Volume[19] + Volume[20] + Volume[21] + Volume[22] + Volume[23] + Volume[24] + Volume[25] + Volume[26] + Volume[27] + Volume[28] + Volume[29] + Volume[30]) / 30;
double curVolume = Volume[0];
double percentOf30Bar = Math.Round((curVolume / avg30Bars) * 100, 0);
double SellVolPercent = Math.Round((selling / Volume[0]) * 100, 0);
items2show = countInputFields();
spacing = 0;
if (position == TextPosition.BottomLeft || position == TextPosition.BottomRight)
spacing = 20 * (items2show-1);
TextFixed tf;
if (Show30DayAvg) {
tf = Draw.TextFixed(this, "Avg 30 Days", String.Format("Avg 30 Days: {0:n0}", Math.Round(volLast30DayAvg, 0)), position);
tf.AreaBrush = Brushes.LightGray;
formatTextBox(tf); }
if (ShowTodayVolume) {
tf = Draw.TextFixed(this, "Today", String.Format("Today: {0:n0}", today), position);
if (percentOf30Day >= UnusualVolumePercent) tf.AreaBrush = Brushes.Green; else if (percentOf30Day >= 100) tf.AreaBrush = Brushes.Orange; else tf.AreaBrush = Brushes.LightGray;
formatTextBox(tf); }
if (ShowPercentOf30DayAvg) {
tf = Draw.TextFixed(this, "Percent of 30 Day", percentOf30Day + "%", position);
if (percentOf30Day >= UnusualVolumePercent) tf.AreaBrush = Brushes.Green; else if (percentOf30Day >= 100) tf.AreaBrush = Brushes.Orange; else tf.AreaBrush = Brushes.White;
formatTextBox(tf); }
if (ShowCurrentBar) {
tf = Draw.TextFixed(this, "Cur Bar", String.Format("Cur Bar: {0:n0}", curVolume), position);
if (percentOf30Bar >= UnusualVolumePercent) tf.AreaBrush = Brushes.Green; else if (percentOf30Bar >= 100) tf.AreaBrush = Brushes.Orange; else tf.AreaBrush = Brushes.LightGray;
formatTextBox(tf); }
if (ShowPercentOf30BarAvg) {
tf = Draw.TextFixed(this, "Percent of 30 Bar", percentOf30Bar + "%", position);
if (percentOf30Bar >= UnusualVolumePercent) tf.AreaBrush = Brushes.Green; else if (percentOf30Bar >= 100) tf.AreaBrush = Brushes.Orange; else tf.AreaBrush = Brushes.White;
formatTextBox(tf); }
if (ShowPercentOf30BarAvg) {
tf = Draw.TextFixed(this, "Cur Bar Sell %", "Cur Bar Sell %: " + SellVolPercent + "%", position);
if (SellVolPercent > 51) tf.AreaBrush = Brushes.Red; else if (SellVolPercent < 49) tf.AreaBrush = Brushes.Green; else tf.AreaBrush = Brushes.Orange;
formatTextBox(tf); }
return;
}
void formatTextBox(TextFixed tf)
{
if (tf.TextPosition == TextPosition.Center) tf.TextPosition = TextPosition.TopLeft;
tf.Font = ChartControl.Properties.LabelFont;
tf.TextBrush = ChartControl.Properties.ChartText;
tf.TextBrush = Brushes.Black;
tf.YPixelOffset = spacing;
spacing += -20;
}
int countInputFields()
{
items2show = 0 +
Convert.ToInt32(Show30BarAvg) +
Convert.ToInt32(Show30DayAvg) +
Convert.ToInt32(ShowPercentOf30BarAvg) +
Convert.ToInt32(ShowPercentOf30DayAvg) +
Convert.ToInt32(ShowSellVolumePercent) +
Convert.ToInt32(ShowTodayVolume);
return items2show;
}
#region Properties
[NinjaScriptProperty]
[Display(Name="Show30DayAvg", Order=1, GroupName="Parameters")]
public bool Show30DayAvg
{ get; set; }
[NinjaScriptProperty]
[Display(Name="ShowTodayVolume", Order=2, GroupName="Parameters")]
public bool ShowTodayVolume
{ get; set; }
[NinjaScriptProperty]
[Display(Name="ShowPercentOf30DayAvg", Order=3, GroupName="Parameters")]
public bool ShowPercentOf30DayAvg
{ get; set; }
[NinjaScriptProperty]
[Display(Name="UnusualVolumePercent", Order=4, GroupName="Parameters")]
public int UnusualVolumePercent
{ get; set; }
[NinjaScriptProperty]
[Display(Name="Show30BarAvg", Order=5, GroupName="Parameters")]
public bool Show30BarAvg
{ get; set; }
[NinjaScriptProperty]
[Display(Name="ShowCurrentBar", Order=6, GroupName="Parameters")]
public bool ShowCurrentBar
{ get; set; }
[NinjaScriptProperty]
[Display(Name="ShowPercentOf30BarAvg", Order=7, GroupName="Parameters")]
public bool ShowPercentOf30BarAvg
{ get; set; }
[NinjaScriptProperty]
[Display(Name="ShowSellVolumePercent", Order=8, GroupName="Parameters")]
public bool ShowSellVolumePercent
{ get; set; }
[NinjaScriptProperty]
[Range(1, int.MaxValue)]
[Display(Name="Length", Order=9, GroupName="Parameters")]
public int Length
{ get; set; }
[NinjaScriptProperty]
[Range(1, int.MaxValue)]
[Display(Name="Length1", Order=10, GroupName="Parameters")]
public int Length1
{ get; set; }
[NinjaScriptProperty]
[Range(1, double.MaxValue)]
[Display(Name="HotPct", Order=11, GroupName="Parameters")]
public double HotPct
{ get; set; }
[NinjaScriptProperty]
[Display(Name = "Moving Averate Type", Order = 11, GroupName = "Parameters")]
public ToS_389_MovingAverageTypes type
{ get; set; }
[NinjaScriptProperty]
[Display(Name = "Label Positioning", Order = 21, GroupName = "Parameters")]
public TextPosition position
{ get; set; }
[Browsable(false)]
[XmlIgnore]
public Series<double> SellVol
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> TV
{
get { return Values[1]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> BuyVol
{
get { return Values[2]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> VolAvg
{
get { return Values[3]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> Hv
{
get { return Values[4]; }
}
#endregion
}
}
Attached Files
Elite Membership required to download: ToS389BuySellVolume.cs
September 4th, 2021, 04:53 PM
Alberta, Canada
Posts: 14 since Aug 2021
Thanks Given: 19
Thanks Received: 5
Thanks.
However, when I attempt to import this into my (NT8) I get this message:
Warning
This NinjaScript archive was made from an older, incompatible version of NinjaTrader
& it fails to import/load.
(I took your file, sent to .zip, then tried to import the zip folder)
Do I have the process right?
Thanks,
Bruce
September 4th, 2021, 05:28 PM
Posts: 74 since Jan 2020
Thanks Given: 23
Thanks Received: 44
caniwi
Thanks.
However, when I attempt to import this into my (NT8) I get this message:
Warning
This NinjaScript archive was made from an older, incompatible version of NinjaTrader
& it fails to import/load.
(I took your file, sent to .zip, then tried to import the zip folder)
Do I have the process right?
Thanks,
Bruce
Hi Bruce.
Uploading pre-compiled code isn't allowed I think. You'll have to compile at your end.
Download the .cs file to your desktop or anywhere on your hard disk. Quit NinjaTrader if it's open. Now copy or move the .cs file to your NinjaTrader data folder (should typicall be inside your "Documents" and named "NinjaTrader 8"). Documents -> NinjaTrader 8 -> bin -> Custom -> Indicators. Drop the .cs file here in Indicators and restart NT.
Then compile. From Control Centre -> New -> NinjaScript Editor -> then press F5 or click the compile button.
Alternatively, just copy the code from the post above, then in NinjaScript Editor start a new indicator wizard pressing next until you reach "Generate". It'll create a new indicator - don't save it yet. Select all and delete the dummy code, and paste the code from the forum and then compile.
September 4th, 2021, 07:03 PM
Alberta, Canada
Posts: 14 since Aug 2021
Thanks Given: 19
Thanks Received: 5
Awesome!! Thank you so much - that worked fine. I really appreciate your help.
Bruce
September 6th, 2021, 12:58 AM
Alberta, Canada
Posts: 14 since Aug 2021
Thanks Given: 19
Thanks Received: 5
Hi again,
Is converting these something doable for a non techie guy like me? Is there some online resource I could go to to teach myself?
I have another ToS script here that I'd really like for NT8:- V01.08.2012 Projection Pivots . Maybe there is a conversion somewhere though. If I can't find a conversion I'd be willing to give it a try....
Attached Files
Elite Membership required to download: V01.08.2012 Projection Pivots.txt
September 6th, 2021, 02:57 AM
Austin Texas / US
Experience: Intermediate
Frequency: Several times daily
Duration: Seconds
Posts: 176 since Dec 2019
Thanks Given: 145
Thanks Received: 211
SamirOfSalem
If still looking, here's a quick conversion.
Samir Thank You!
This is the best conversion I have seen to date of the great ThinkScript info/data boxes to NinjaTrader NT8.
And a nice tight, readable info/rich presentation of volume information in in one panel.
Well Done.
HedgePlay
September 6th, 2021, 03:00 AM
Austin Texas / US
Experience: Intermediate
Frequency: Several times daily
Duration: Seconds
Posts: 176 since Dec 2019
Thanks Given: 145
Thanks Received: 211
caniwi
Hi again,
I have another
ToS script here that I'd really like for NT8:- V01.08.2012 Projection
Pivots . Maybe there is a conversion somewhere though. If I can't find a conversion I'd be willing to give it a try....
Hi!
I would post a few screen shots of what you are looking (final screen views of this pivots Indicator).
There is a good chance it has already been coded and if we recognized it can help you find the existing indicator file.
HedgePlay
Last Updated on September 6, 2021