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

Bid Ask not drwan by strategy

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

    Bid Ask not drwan by strategy

    Hello,
    I've already looked around in the forum, but unfortunately couldn't find a suitable entry for my problem. I hope someone has a solution.
    I'm currently working on a strategy based on an indicator that is derived directly from the bid and ask values. This indicator starts from 0 every time the chart is reloaded. With the strategy, I currently don't get any results with backtesting (with tick replay) or with live testing, because the bid and ask values ​​are not drawn by the strategy.


    Thanks in advance
    Robin
    Attached Files

    #2
    Hello Lopat,

    Thanks for your post.

    The indicator is not plotting values and this should be the main focus if the strategy requires plots from the indicator to create trade signals.

    Is the custom indicator using MarketDataType.Bid/MarketDataType.Ask events? This would not work with Tick Replay since Tick Replay only works with MarketDataType.Last events.

    As you mention the issue is seen with live testing as well, it would seem the indicator is not getting the data it needs or is plotting 0's for another reason. If you get plot values with realtime data, but not with historical when Tick Replay is enabled, then this would be suspect that the indicator uses MarketDataType.Bid/MarketDataType.Ask events.

    I suggest testing your indicator separately to understand why it is plotting 0's. Please use debugging prints to see how the indicator is assigning plot values. You may reference our built in indicators as well as our AddPlot documentation to see how plots are created and values assigned.

    AddPlot - https://ninjatrader.com/support/help...8/?addplot.htm

    Debugging tips - https://ninjatrader.com/support/help...script_cod.htm

    We do offer a built in BuySellPressure indicator that is built from MarketDataType.Last events that can plot historically with Tick Replay enabled that you could also check to confirm that you have the historical tick data to create the MarketDataType.Last events needed by that indicator.

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hello Jim,
      thank you for your answer.

      The indicator uses the bid and ask rates from the following:

      protected override void OnMarketData (MarketDataEventArgs e).

      The attached image also shows that data is only displayed as soon as the indicator is activated. This is completely sufficient for normal trading. As soon as I want to incorporate this indicator into a strategy as described above, no data comes into the indicator.

      Do I have to incorporate an indicator that uses the bid and ask prices in this way using a certain method?

      Thanks in advance
      Robin
      Attached Files

      Comment


        #4
        Hello Lopat,

        MarketDataType.Bid/MarketDataType.Ask events in OnMarketData are not processed with historical data. Only MarketDataType.Last events are processed in OnMarketData with historical data when Tick Replay is enabled.

        If you need bid/ask ticks, you could consider modifying the indicator and strategy so they add historical Bid/Ask series. This will be processed in OnBarUpdate and would not be processed with OnMArketData.

        Historical Bid/Ask Series - https://ninjatrader.com/support/help..._ask_serie.htm

        Working with Multi Time Frame scripts - https://ninjatrader.com/support/help...nstruments.htm

        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hello Jim,
          the processing of the indicator is fine. But I don´t know why the strategy can´t use the plots of the indicator in real time. Do I have to implement the indicator in a diffrent way as usual?

          Regards
          Robin

          Comment


            #6
            Hello Lopat,

            the processing of the indicator is fine.
            Do you mean that you are seeing the OnMarketData being called?

            But I don´t know why the strategy can´t use the plots of the indicator in real time. Do I have to implement the indicator in a diffrent way as usual?
            For realtime specifically that may be due to how you are setting the plots. We would need a more specific example here to see how the plots are being used. Also how you call the indicator in the strategy could potentially be a factor. It may be a good situation to make a simple test script that we can explore the logic you used here.

            For the historical plot and TickReplay the Indicator would generally need two separate sets of logic to account for that use case. You would have the normal OnMarketData logic that uses MarketDataType.Ask/Bid events and then you have a second set of logic which only uses the Last events and logic shown here: https://ninjatrader.com/support/help...sub=tickreplay
            Because it comes in as a Last event in historical the normal indicator logic won't work with tick replay, that may be one reason the plots are not being populated during the historical bars.



            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mizzouman1, Today, 07:35 AM
            3 responses
            17 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by RubenCazorla, Today, 09:07 AM
            2 responses
            13 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by i019945nj, 12-14-2023, 06:41 AM
            7 responses
            82 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by timmbbo, 07-05-2023, 10:21 PM
            4 responses
            158 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by tkaboris, Today, 08:01 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X