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!
See more
See less

Partner 728x90

Collapse

creating bars

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    creating bars

    Hello,

    Lets say i have a for loop and there is 100 bars on the chart. There is no connection no live data.

    I want to simulate upcoming bars. Lets say create 10 bars.
    Is it possible to add bars and give a specific price and volume value to those bars?

    Like barIndex 101 would have a price of 1945 with a volume of 300, bar 102 = price 1946 with a volume 560, bar 103 = price 1945.5 with a volume of 1500 etc.

    I can use Bars.GetVolume and Bars.GetClose for the remaining bars.

    Ty

    #2
    Hello frankduc,

    I'm not aware of any way to create bars without some sort of data being processed.

    A bar type script doesn't update unless a tick is being processed.

    You could choose to make a historical data file and import it so that you have some historical data.


    You could choose to use the API to generate and stream real-time data.
    https://ninjatrader.com/support/foru...626#post793626
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea,

      My system make calculation using past data in the chart. At the end a variable returns the price for T0 or current bar in progress. So if the trading price is 3131 the variable for exemple could return 3131.5 telling me the next price it will be traded. I want to return the 3131.5 in the chart or in the system so my system can recalculate and give me the next price it will trade after 3131.5. Then use AddPlot to draw a line that will show me where the price is heading.
      My problem is that every time a new bar is created on the chart it interfere with the calculation.

      Comment


        #4
        Hello frankduc,

        I'm not understanding the series or collection you are using or what values are unexpected.

        However, you can save custom calculations for each bar to a custom Series<double>.

        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cre8able, Today, 03:20 PM
        0 responses
        5 views
        0 likes
        Last Post cre8able  
        Started by Fran888, 02-16-2024, 10:48 AM
        3 responses
        47 views
        0 likes
        Last Post Sam2515
        by Sam2515
         
        Started by martin70, 03-24-2023, 04:58 AM
        15 responses
        114 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by The_Sec, Today, 02:29 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by jeronymite, 04-12-2024, 04:26 PM
        2 responses
        32 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X