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

2 TimeFrames Strategy not enough days?

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

    2 TimeFrames Strategy not enough days?

    I'm working on 2 time frame strategy (tick and minute) trying to backtest for 1 mth. period I select that one mth, and see that it is executing, let say from Jan. to Feb. Then I went to chart and want to see trades. All trades are complete by Jan. 11 and nothing after. Ok I select Jan 12 - Jan. 22 Now I see trades. Fine. Select Jan. 1 Jan 22 - only till Jan 11.
    Where i can configure something magical to see whole mth, Or maybe 2 as "extreme".
    The clue of any would be really nice.
    --PNF

    #2
    Hello PageNotFound404,

    From what you described that sounds like its possibly that the logic to trade stopped being true after the 11th or that there is something happening surrounding the data.

    A couple of steps you can take would be to add a Print in the script to see if its OnBarUpdate is called for those days and if its called for both BarsInProgress.

    Reloading historical data for all series you use from a chart would be another item to try.

    Based on the Print test that would help determine what to check next, you may want to also enable TraceOrders to see if this is related to a managed order situation.


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

    Comment


      #3
      Jesse,
      Nope, there is no days, but let say it would, why i get result from Jan 11 to 22nd? And NO again from Jan 1 to 22? As for data if i execute 2 different time "pieces" should not DB has Sum of both from Jan 1 to 22?
      --PNF

      Comment


        #4
        Hello PageNotFound404,

        I am not sure what you mean by "Nope, there is no days, but let say it would,", was this in reference to the Print test I had suggested?

        You would need to use a Print here to see what the script is seeing during the test, that will help to know more about the problem. Without that type of observation I really wouldn't have a specific comment on why that would happen. You can try reloading the historical data or potentially clearing the cache folder to see if those are realted in some way. Documents\NinjaTrader 8\db\cache





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

        Comment


          #5
          Jesse,
          There is limit somewhere. This version run only till July 5. Select 01/01/19 - 01/01/2020. and look at the chart. Is that limit how many can be printed on the chart, or something else, IDK. No errors of any kind. FF.zip
          --PNF

          Comment


            #6
            Hello PageNotFound404,

            There is not a specific limit in the platform with the dates you mentioned, this could relate to what you programmed or also data. Without using a print here to check what the script is seeing we are just guessing at the problem. Have you tried using a print yet and do you see it printing on those missing days?

            You could try something like:

            Code:
            protected override void OnBarUpdate()
            {
            Print(BarsInProgress + " " + Time[0]);

            Please let me know if I may be of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Jesse,
              Yes, it run every bar, yet execute something only till july 5th. No, i do not have any day limit as you can see in the code, but fact are just that - facts, regardless there is no limit, or there is one. Seems i'm an exception. Still can not execute full set on the tick.
              --PNF

              Comment


                #8
                Hello PageNotFound404,

                If I understand correctly the print worked for all bars of the test is that right?

                If so you would now need to continue using the print to track what is not happening right in your logic. As noted there is nothing in the platform that is specific to those dates and if OnBarUpdate is being called we can exclude Data being the problem. Now you could try checking the order entry logic to see if that is working correctly. This is a standard process with NinjaScript files, if something is not working as expected you can generally use a Print to track down what is happening to a more specific area.

                Please let me know if I may be of additional assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  I use print to track order, and order status, and usually understand that print is the way to go. The issue is that code executed number of times, and the is it not executing anymore creating illusion that there is a limit. It if fine not to have a limit and have illusion, what is not helping is that there is no error message in the log, or anywhere else. what is upmost puzzling that if i use 6 working hours i get only till January 11, if i use only 1 hr a day i can "last" till July 5. This "strange" behavior only support illusion of the limit, as question is why 6 hours January 11, if something fundamentally wrong in the code 1 hr should stop at the same time, date, well it is not. I would code around, if i would know what that around is. As of now this mysterious behavior does not allow me to use 2 time frame spans tick and minute, and there is no way i can know even with magic of print (because i do use that) where such issue is. This make all exercise - how to say it - annoying?
                  --PNF

                  Comment


                    #10
                    Hello PageNotFound404,

                    I use print to track order, and order status, and usually understand that print is the way to go. The issue is that code executed number of times, and the is it not executing anymore creating illusion that there is a limit. It if fine not to have a limit and have illusion, what is not helping is that there is no error message in the log, or anywhere else.
                    There would be no error if your condition is failing to become true. That would be an important reason to use prints here. If you don't see anything like an error you need to explore more to find what the cause is.


                    what is upmost puzzling that if i use 6 working hours i get only till January 11, if i use only 1 hr a day i can "last" till July 5. This "strange" behavior only support illusion of the limit, as question is why 6 hours January 11, if something fundamentally wrong in the code 1 hr should stop at the same time, date, well it is not.
                    I Couldn't say without debugging your code however that would be up to you to debug as you write the code. This is a good situation to continue to explore your code to find out what the specific hold up is in the logic. If one line of code is causing a problem you would be able to see that by using a print.

                    I would code around, if i would know what that around is.
                    This is exactly what a print is meant for. "coding around" or fixing the problem is what needs to happen here, to find how to do that you need to debug your code more to find what is not working. Explaining that it does not work really does not help to find a solution, we would need to know what does not work or what in your logic is failing.

                    As of now this mysterious behavior does not allow me to use 2 time frame spans tick and minute, and there is no way i can know even with magic of print (because i do use that) where such issue is. This make all exercise - how to say it - annoying?
                    There is no magic here, the print is a tool you can use to debug your script. If you are having trouble with debugging the script please provide a sample of how you used the print in your script. We could try to provide suggestions on how you can further identify the problem. Everything is happening for a reason and the print can help find that reason.

                    Please let me know if I may be of additional assistance.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      Jesse,
                      post #5 above has code FF.zip, you may clearly see how i use print. I did mentioned, that i do use it, I did mentioned that is not give any clue. I do know what debugging means, i do understand that i can use VS for this purposes.
                      --PNF

                      Comment


                        #12
                        Hello PageNotFound404,

                        Yes I had reviewed the file before I made my comments. If you are not certain what is happening at this point that is a good situation to either move the prints to new more relevant locations for testing or to add more prints. Adding the print I suggested allowed you to see that OnBarUpdate is being called for those bars which is a good first step. Next you could test the later conditions and make sure that logic is being met on those bars.

                        Debugging can involve multiple steps of testing to find the source of the problem. In this case you will need to work through your code in OnBarUpdate to gain a better understanding of the problem on those bars.


                        I look forward to being of further assistance.

                        JesseNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Barry Milan, Yesterday, 10:35 PM
                        5 responses
                        15 views
                        0 likes
                        Last Post NinjaTrader_Manfred  
                        Started by DanielSanMartin, Yesterday, 02:37 PM
                        2 responses
                        13 views
                        0 likes
                        Last Post DanielSanMartin  
                        Started by DJ888, 04-16-2024, 06:09 PM
                        4 responses
                        12 views
                        0 likes
                        Last Post DJ888
                        by DJ888
                         
                        Started by terofs, Today, 04:18 PM
                        0 responses
                        11 views
                        0 likes
                        Last Post terofs
                        by terofs
                         
                        Started by nandhumca, Today, 03:41 PM
                        0 responses
                        8 views
                        0 likes
                        Last Post nandhumca  
                        Working...
                        X