Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Several questions about Auto Trading

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

    Several questions about Auto Trading

    Hi,

    I try to write some strategy for auto trading. There are some issues below.

    1, how can I get current marketing price.
    2, In the candle chart, how can I get highest/lowest/open/close price for previous candle?
    3, Where can I get API from Ninja7?

    Thanks in advance!
    Thomson

    #2
    Hi Thomson,

    Thanks for the post.
    1) Current market price is Close[0] when CalculateOnBarClose = false.

    2) Please see here for help working with [ ] brackets to reference prior bar values:


    For highest, lowest values over a series of bars, there are built in methods MAX() and MIN()

    3) Can you please clarify what you are looking to do? We do not provide an API that allows external control of NT functions.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your quickly response.
      I am a developer,so I try to use code to do some auto trading.
      For the 1st question, example,in 5 range chart, if CalculateOnBarClose = true, how can I get the current price/close price?
      To answer your 3rd question, I try to get previous 5 range candle bar max/min price and judge whether the current price equal to previous candle max or min price(CalculateOnBarClose ). If close price==min price buy short otherwise buy long. It is one of the component or function I want to implement for my auto trading strategy.

      Thanks
      Thomson

      Comment


        #4
        If you need to get the current price while working with COBC = true, then you can use an OnMarketData() handler, which updates for every bid/ask/last change.

        There is not a NinjaTrader API available. Please see here for an introduction to strategy development:
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Hi, Ryan,

          I just saw your reference link,
          double close1 = Close[1]; // gets the close price one bar ago
          Is this close price doesn't matter what is the time line ? For 5 mins 10 mins or 5 range or 10 range. How can I get close price by different type. eg 5range/5mins. How can I let system know the close price by 5 range and 5 mins at the same time?
          Thanks in advance.
          Thomson

          Comment


            #6
            There is a primary series of the strategy/indicator. This series is not specified anywhere in code, but will be based on whatever you run the strategy on. If you run directly from a chart, it will use that chart series as the primary. If you run the strategy anywhere else, you specify the interval in the Data Series section when configuring the strategy.

            NinjaScript also allows for multiple series within a single script. There is a sample available in all installations under Tools > Edit NinjaScript > SampleMultiTimeFrame. Documentation for multiseries NinjaScript is here:
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Waxavi, 04-19-2024, 02:10 AM
            2 responses
            36 views
            0 likes
            Last Post poeds
            by poeds
             
            Started by chbruno, Yesterday, 04:10 PM
            1 response
            44 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by Max238, Today, 01:28 AM
            1 response
            23 views
            0 likes
            Last Post CactusMan  
            Started by giulyko00, Yesterday, 12:03 PM
            2 responses
            10 views
            0 likes
            Last Post giulyko00  
            Started by r68cervera, Today, 05:29 AM
            0 responses
            4 views
            0 likes
            Last Post r68cervera  
            Working...
            X