Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stategy works backtesting but not on live data

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

    Stategy works backtesting but not on live data

    I have a stategy that employs monitor RSI values and then bollinger values. I have created the code and backtested it - which works. However when trying to perform the strategy on live data (or using simulated data feed for that matter) no trades are made.

    The basis of the strategy is this;

    monitor for RSI above 70
    when the RSI level is above 70
    monitor for ask price >= bollinger upper
    then monitor for ask price < bollinger upper
    then enter short

    monitor for ask price < bollinger lower
    monitor for ask price >= bollinger lower

    exit short position

    I am at a loss as to why the strategy runs on a backtest but not on live data

    any help is most appreciated.
    Mikeod1066
    Last edited by mikeod1066; 12-12-2009, 06:39 PM.

    #2
    Mikeod1066, when you start up the strategy in real-time, are there any errors in the logs (right-most tab of Control Center)?

    If you're comfortable with it, you could post the code and we can take a quick look to see if anything looks out of place.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Austin,

      no errors in log but it did point out that the ATI was defaulted to disabled - checking to see if that was the issue and will report back.

      Thanks for your quick reply
      Mike

      Comment


        #4
        No luck even with turning on the ATI. attached is a simplified version of teh code that still will not trade - any help anyone can be is most appreciated.

        Thanks
        Mike
        Attached Files

        Comment


          #5
          First thing is that enums should not be created inside the strategy scope. Should be outside. Please see this reference sample: http://www.ninjatrader-support2.com/...ead.php?t=3420

          From a NinjaScript strategy, ATI should be disabled. What I suggest you do is add Print() statements throughout your code and try to step through its logic one line at a time. You should also use TraceOrders = true in Initialize() to understand what your orders are doing and why they may be ignored/rejected.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Thanks everybody for helping me on this - The Print() statement really helped me work out what was going on;

            The issue was not that my stategy was not trading but for some reason it inacted on data that came in before I clicked Start in the App.

            Does anyone know why this would happen?

            For example I added a print() statement for each candle (just candle number) and when I started the script on live data the output window showed over 3000 candles (going back almost 15 days)

            I thought that a Ninja Script would only execute on live data - do I need to add a statement to make this true?

            Comment


              #7
              NinjaScript always processes all historical data before processing any live data. If you do not want it to process historically you need to code it specifically with this line at the top of OnBarUpdate().

              Code:
              if (Historical)
                   return;
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Thanks Josh - that did it

                You guys are AWESOME

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by ZenCortexAuCost, Today, 04:24 AM
                0 responses
                2 views
                0 likes
                Last Post ZenCortexAuCost  
                Started by ZenCortexAuCost, Today, 04:22 AM
                0 responses
                0 views
                0 likes
                Last Post ZenCortexAuCost  
                Started by SantoshXX, Today, 03:09 AM
                0 responses
                13 views
                0 likes
                Last Post SantoshXX  
                Started by DanielTynera, Today, 01:14 AM
                0 responses
                2 views
                0 likes
                Last Post DanielTynera  
                Started by yertle, 04-18-2024, 08:38 AM
                9 responses
                42 views
                0 likes
                Last Post yertle
                by yertle
                 
                Working...
                X