• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Two separate logics in the same strategy (each uses its own different time fram)

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

    Two separate logics in the same strategy (each uses its own different time fram)

    I have two separate logics in one strategy. Each has its own differemt time bars.

    Primary uses 10m
    Secondary uses 1m

    There is a custom variable switch that I use to switch between one or the other. In no occasion can the two run simultaneously.

    I have added BarsArray[1] and closes[1][0] for the indicators for the secondary logic and it seems to beexecuting properly.

    I however have not set anything in specific (other than the standard condition rules) for the primary and they don't appear to be executing properly.

    I did a test run on market replay and it appears tha, though the switch between the two logic is working properly, the Primary logic is executing simultaneously on the 10m and the 1m time bars.

    Should I add BarsArray[0] and Closes[0][0] to all indicators and conditions that are related to the primary logic as well?

    #2
    Hello nikolaalx,

    Thank you for your post.

    Your assessment is correct, you would also need to ensure you are performing BarsInProgress checks to ensure the calculations are performed on the correct bars: http://www.ninjatrader.com/support/h...inprogress.htm

    Please let me know if you have any questions.
    Patrick H.NinjaTrader Customer Service

    Comment


      #3
      I did the above, and when in real trading, it appears to be functioning properly.

      When however backtested, the results are not true. I have the feeling that the 10min and 1min bars are merged into one, which causes compromised results.

      Comment


        #4
        Hello nikolaalx,

        Thank you for your response.

        You can take a look at the discrepancies between real-time and backtesting at the following link: http://www.ninjatrader.com/support/h...ime_vs_bac.htm

        Please let me know if you have any questions.
        Patrick H.NinjaTrader Customer Service

        Comment


          #5
          I am aware of the difference between historical and real time data.

          When backtesting, my strategy produces hundreds of trades per day.

          When done in real time, the trades are no more than 2-3 per day.

          This is what I mean by "discrepancy" and not slight entry/exit price deviation which is normally seen when comparing historical with real time trading.

          Comment


            #6
            Hello nikolaalx,

            Are you running the strategy in real-time with CalculateOnBarClose = false?
            Patrick H.NinjaTrader Customer Service

            Comment


              #7
              I always use CalculateOnBarClose = true, as otherwise I get false signals.

              Comment


                #8
                Hello nikolaalx,

                Thank you for your response.

                Do have an example I can test for in the Strategy Analyzer and real-time data?
                Patrick H.NinjaTrader Customer Service

                Comment


                  #9
                  Yes, please tell me to which email I should send the strategy export?

                  Please test it for FB.

                  Keep in mind that the problem occurs when trading in real time with an IB connection, so I am not sure whether market replay would replicate the issue.

                  I think this is a compatibility issue between NT and IB.

                  Comment


                    #10
                    Hello nikolaalx,

                    Thank you for your response.

                    To test I will need the .cs file for the strategy located in the following directory on your PC: (My) Documents\NinjaTrader 7\bin\Custom\Strategy
                    Patrick H.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by FMtrader, 03-15-2019, 02:30 AM
                    6 responses
                    32 views
                    0 likes
                    Last Post James108  
                    Started by timko, Today, 08:18 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post timko
                    by timko
                     
                    Started by victorsmith, Today, 06:00 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post victorsmith  
                    Started by sohailashraf, Yesterday, 10:18 PM
                    0 responses
                    6 views
                    0 likes
                    Last Post sohailashraf  
                    Started by jjnc2006, Yesterday, 07:36 PM
                    0 responses
                    16 views
                    0 likes
                    Last Post jjnc2006  
                    Working...
                    X