I want to create a bar. It has no tick time but operations. seeing the timesale I see the volumes of every single transaction. I want the transaction bar. how you do it?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
bartype
Collapse
X
-
Hello bebbus, thanks for your note.
The T&S window gets this info from the OnMarketData method. Overriding this will provide an order type (buy or sell), the quantity, and the volume for every tick of the market.
Please let us know if we can assist any further.
-
Hello bebbus,
Thanks for your reply.
If you want to create a bar type yourself, please see the help guide here: https://ninjatrader.com/support/help...?bars_type.htm You may want to create the bars type using the Ninjascript wizard to ensure you have the structure needed (unless you want to copy and modify an existing bar type), here is a link to the wizard help guide: https://ninjatrader.com/support/help...?ns_wizard.htm
Your NinjaTrader8 comes with a number of bars types and their source code is available for you if you want to see what the structure is like through the Ninjascript editor (BarTypes folder).
Alternatively, if you would rather have this created for you, we can provide references to 3rd party providers of that service.
Comment
-
Hello meweini,
Welcome to the forums.
Could you let us know what difficulties you are having when creating your custom BarsType so we can provide further insight? The information Paul has provided in post 4 will provide direction for creating a new BarsType and how you can reference the existing BarsTypes to help you in the development process.
We look forward to assisting.
Comment
-
Hello,
Interesting conversation. What is a newbar?
I am looking to create a simulation from calculations i made.
DoesAddBar(bars,open,high,low,close,time,(long)Math.Min(volumeTmp,bars.BarsPeriod.Value));ChartBars.ToIndex?
would allow me to create new bars beyong the scope of
Lets say i have a for loop that goes from ChartBars.FromIndex toChartBars.ToIndex and there is 100 bars but i want to predict the future and need to add 50 bars in the for loop with each containing close and volume, can AddBar do that or its completly unrelated?
Ty
Comment
-
Hello frankduc,
AddBar would not be used in the use case you described, this cannot be used from within an indicator or other script. AddBar is specific to a BarsType and would be unrelated to your description. If you are making a BarsType specifically and your calculation is based solely on the market data, you could execute your plan from there to generate bars as needed. You cannot use indicators from a BarsType so your calculation would need to completely reside in the BarsType if that is what your goal is.
please let me know if I may be of further assistance.
Comment
-
Hello,
That would be more like a simulation. Lets say i have a for loop: with 100 bars
I can use highPrice = Bars.GetHigh(barIndex) to get for exemple all the Highs in the for loop.Code:for (int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++)
Lets say i want to add 10 bars (those bars dont exist in the chart i create them with my own values i have calculated) to make it 110 bars.
If i do
Will it mean there is 110 bars in my loop?Code:[LEFT][COLOR=#4D4D4D][FONT=Helvetica]for ([/FONT][/COLOR][/LEFT][LEFT][COLOR=#4D4D4D][FONT=Helvetica][SIZE=13px]int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex + 10; barIndex++)[/SIZE][/FONT][/COLOR][/LEFT]
How could i include close and volume for each 10 bars i am adding?
TY.
Comment
-
Hello frankduc,
My prior reply still applies to your new statement.
Before we continue with any further questions, what is your specific goal and what type of script are you trying to execute that goal from?
Are you specifically trying to build a BarsType?
AddBar only relates to a BarsType, if you are not making a BarsType your question is not relevant to this post. The loop you have displayed is used for OnRender to gather the currently visible bars, this has no relevance in a BarsType.
If you want further information about BarsTypes and how they work, please explore one of the existing BarsTypes in the NinjaScript editor.
Please let me know if I may be of further assistance.
Comment
-
Jesse,
Like you said i dont think bartype is relevant to my goal. I am still trying to figure out what i want to do and how to do it. So i gather info.
Regarding bartype from what i understand it allow a user to create a certain type of bars like a minute bar, volume bar, etc.
I dont have access to thick data so i cant get overnight volume chart. Would it be possible to use bartype to create a bar that would convert minute volume into bar volume equal to the volume of a minute?
Lets say there is a minute bar at 5 am with a 1000 volumes. Could it be converted into 5 bars candle of 200 contracts?
ty
Comment
-
Hello frankduc,
Sure, for this question I would suggest taking a look at the existing Volume bars and how they work. The volume bars are based on tick data but you could change the BuiltFrom To Minute to use Minute data instead. How you then form the bars past that point would be up to your logic. OnDataPoint would be called for the minute data points and then you could use AddBar/UpdateBar/RemoveLastBar to modify the series. If you wanted to experiment with a BarsType I would suggest using this process to generate a new type:I dont have access to thick data so i cant get overnight volume chart. Would it be possible to use bartype to create a bar that would convert minute volume into bar volume equal to the volume of a minute?
Lets say there is a minute bar at 5 am with a 1000 volumes. Could it be converted into 5 bars candle of 200 contracts?- In the NS editor right click on BarsType and click new
- Click Generate
- Find the line which looks like this and copy it: BarsPeriod = new BarsPeriod { BarsPeriodType = (BarsPeriodType) 15, Value = 1 };
- Close the file without saving
- Open the Volume BarsType
- Right click -Save As and give it a name
- Paste over the existing BarsPeriod = line with what you copied, also replace the Name with a string instead of the Custom.Resource line.
That would generate a BarsType based off of the existing one which you can then experiment with, this will work just like the existing bars type until you make changes.Code:Name = "TestVolume"; BarsPeriod = new BarsPeriod { BarsPeriodType = (BarsPeriodType) 15, Value = 1 };
Please let me know if I may be of additional assistance.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
574 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
333 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment