Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

after compile a new strategy, it doesn't appear as available!

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

    #31
    Originally posted by NinjaTrader_ChelseaB View Post
    Hello Anquirk,

    This is not the strategy whom's text was provided in post # 23.
    The code in this script is very different.

    I was able to import this script and this is loading in the Strategy Analyzer and the parameters area is showing.
    Click image for larger version  Name:	2024-01-30_13-17-19.png Views:	0 Size:	77.6 KB ID:	1288943

    Likely that issue is not related to this new specific script.

    Have you excluded the original script from compilation as directed in post # 20?
    If so, try excluding all other custom scripts (other than this one), and then restart NinjaTrader.
    Correct. Now I can see my strategy in analyzer window but for some reason it doesn't execute any trade. Just wondering why?
    p.s. let's use code provided from #29 message for future references

    Comment


      #32
      Hello Anquirk,

      If no orders are submitted, this would imply the condition to submit the order did not evaluate as true, or the order was submitted and ignored or automatically cancelled.

      To understand why you will need to debug using prints and TraceOrders as directed in post # 22.

      Please provide the print and TraceOrders output text file and I will be happy to assist in analyzing the output and understanding why no orders were submitted or filled.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #33
        Originally posted by NinjaTrader_ChelseaB View Post
        Hello Anquirk,

        If no orders are submitted, this would imply the condition to submit the order did not evaluate as true, or the order was submitted and ignored or automatically cancelled.

        To understand why you will need to debug using prints and TraceOrders as directed in post # 22.

        Please provide the print and TraceOrders output text file and I will be happy to assist in analyzing the output and understanding why no orders were submitted or filled.
        Hi Chelsea B
        Seems like the hardiest part of that is upload any files due to restriction of NT forum.
        Here is output link below. Can't upload file itself due to size restriction and extension restriction. So please follow the link to my google drive if it not against NT security policy https://drive.google.com/file/d/153k...ew?usp=sharing
        Attached Files

        Comment


          #34
          Hello Anquirk,

          It's good you are adding prints. Please also enable TraceOrders.

          We are looking for a specific bar and time where you are expecting an order. Start the print with the Time[0] so we can know which bar is updating.
          The print should show every value and how they are being compared.

          For the condition:
          if (!tradeExecutedToday && sessionHigh != double.MinValue && Closes[0][0] > sessionHigh)
          The print would appear as:
          Print(string.Format("{0} | !tradeExecutedToday: {1} && sessionHigh: {2} != double.MinValue: {3} && Closes[0][0]: {4} > sessionHigh: {2}", Time[0], !tradeExecutedToday, sessionHigh, double.MinValue, Closes[0][0]));
          Chelsea B.NinjaTrader Customer Service

          Comment


            #35
            Originally posted by NinjaTrader_ChelseaB View Post
            Hello Anquirk,

            It's good you are adding prints. Please also enable TraceOrders.

            We are looking for a specific bar and time where you are expecting an order. Start the print with the Time[0] so we can know which bar is updating.
            The print should show every value and how they are being compared.

            For the condition:


            The print would appear as:
            Here is the output log file with time print as well as strategy archive to make sure that TraceOrders enabled
            Attached Files

            Comment


              #36
              Hello Anquirk,

              Starting at the top of the file
              1/3/2021 6:15:00 PM | !tradeExecutedToday: True && sessionHigh: 3892 != double.MinValue: -1.79769313486232E+308 && Closes[0][0]: 3887.5 > sessionHigh: 3892

              I'm seeing 3887.5 is not greater than 3892.
              At a glance, i'm not seeing the close is ever greater than the high (as that would make a new high and they would be equal).
              Chelsea B.NinjaTrader Customer Service

              Comment


                #37
                Originally posted by NinjaTrader_ChelseaB View Post
                Hello Anquirk,

                Starting at the top of the file
                1/3/2021 6:15:00 PM | !tradeExecutedToday: True && sessionHigh: 3892 != double.MinValue: -1.79769313486232E+308 && Closes[0][0]: 3887.5 > sessionHigh: 3892

                I'm seeing 3887.5 is not greater than 3892.
                At a glance, i'm not seeing the close is ever greater than the high (as that would make a new high and they would be equal).
                This is a bit strange because according to the log there were no events where the high in the period from 16:00 of the previous day to 9:30 of the current day was not broken during the current session from 9:30 to 16:00 today. It is unlikely that this is due to the fact that such events did not really happen with the price. What could be the problem?

                Comment


                  #38
                  Hello Anquirk,

                  I'm not sure I understand, you are finding the highest high, including the current bar, and checking if the close is greater than the high?

                  The high is the highest close price reached while the bar was open. The close can be equal to the high but cannot be greater. If the close rises past the current bars high, that price becomes the new high so they would be equal.

                  I'm not quite following your logic.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #39
                    Originally posted by NinjaTrader_ChelseaB View Post
                    Hello Anquirk,

                    I'm not sure I understand, you are finding the highest high, including the current bar, and checking if the close is greater than the high?

                    The high is the highest close price reached while the bar was open. The close can be equal to the high but cannot be greater. If the close rises past the current bars high, that price becomes the new high so they would be equal.

                    I'm not quite following your logic.
                    No, it's not quite right.
                    I am looking for the highest high during the time from 16:00 of the previous day to 9:30 of the current day (let's call it a night session for convenience). Then during the time from 9:30 to 16:00 of the current day (let's call it a daytime session) I want to execute a trade if the price goes above the overnight high.​

                    Comment


                      #40
                      Hello Anquirk,

                      I may still not be following.

                      You are setting sessionHigh to double.MinValue at 93000, at which it will remain until 160000, but you are checking the sessionHigh to not be equal to double.MinValue in the condition.

                      I was assuming this was to limit the condition to only being true from 160000 to 93000.

                      1/5/2021 9:30:00 AM | !tradeExecutedToday: True && sessionHigh: -1.79769313486232E+308 != double.MinValue: -1.79769313486232E+308 && Closes[0][0]: 3822 > sessionHigh: -1.79769313486232E+308
                      1/5/2021 9:45:00 AM | !tradeExecutedToday: True && sessionHigh: -1.79769313486232E+308 != double.MinValue: -1.79769313486232E+308 && Closes[0][0]: 3845 > sessionHigh: -1.79769313486232E+308

                      Where you wanting to set sessionHigh to double.MaxValue at 160000?​
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #41
                        Originally posted by NinjaTrader_ChelseaB View Post
                        Hello Anquirk,

                        I may still not be following.

                        You are setting sessionHigh to double.MinValue at 93000, at which it will remain until 160000, but you are checking the sessionHigh to not be equal to double.MinValue in the condition.

                        I was assuming this was to limit the condition to only being true from 160000 to 93000.

                        1/5/2021 9:30:00 AM | !tradeExecutedToday: True && sessionHigh: -1.79769313486232E+308 != double.MinValue: -1.79769313486232E+308 && Closes[0][0]: 3822 > sessionHigh: -1.79769313486232E+308
                        1/5/2021 9:45:00 AM | !tradeExecutedToday: True && sessionHigh: -1.79769313486232E+308 != double.MinValue: -1.79769313486232E+308 && Closes[0][0]: 3845 > sessionHigh: -1.79769313486232E+308

                        Where you wanting to set sessionHigh to double.MaxValue at 160000?​
                        1. At the start of each new trading session (when ToTime(Time[0]) == 93000), I reset sessionHigh to double.MinValue. This is done to begin tracking a new maximum High value for the current session.
                        2. Then, within the time frame from 16:00 of the previous day to 9:30 of the current day (as defined in the condition ToTime(Time[0]) >= 160000 || ToTime(Time[0]) < 93000), sessionHigh is updated if the current High value is greater than the current sessionHigh value. This allows me to track the maximum High value formed within the specified time interval.
                        3. After 9:30 in the current day, my code checks the condition Closes[0][0] > sessionHigh. If the current closing price breaks above sessionHigh, a long position is entered (EnterLong("LongPosition")).

                        In this way, my code attempts to enter a position if the current closing price surpasses the maximum High value formed in the time interval from 16:00 of the previous day to 9:30 of the current day.

                        Comment


                          #42
                          Hello Anquirk,

                          "At the start of each new trading session (when ToTime(Time[0]) == 93000), I reset sessionHigh to double.MinValue. This is done to begin tracking a new maximum High value for the current session."

                          So sessionHigh will always be double.MinValue between 930000 and 160000.

                          "Then, within the time frame from 16:00 of the previous day to 9:30 of the current day (as defined in the condition ToTime(Time[0]) >= 160000 || ToTime(Time[0]) < 93000), sessionHigh is updated if the current High value is greater than the current sessionHigh value. This allows me to track the maximum High value formed within the specified time interval."

                          sessionHigh != double.MinValue will never be true between 930000 and 160000.

                          "After 9:30 in the current day, my code checks the condition Closes[0][0] > sessionHigh. If the current closing price breaks above sessionHigh, a long position is entered (EnterLong("LongPosition"))."

                          Close[0][0] will always be greater than double.MinValue between 930000 and 160000.


                          Are you seeing in the output between 9:30 and 16:00 that sessionHigh is not equal to double.MinValue?
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #43
                            Originally posted by NinjaTrader_ChelseaB View Post
                            Hello Anquirk,

                            "At the start of each new trading session (when ToTime(Time[0]) == 93000), I reset sessionHigh to double.MinValue. This is done to begin tracking a new maximum High value for the current session."

                            So sessionHigh will always be double.MinValue between 930000 and 160000.

                            "Then, within the time frame from 16:00 of the previous day to 9:30 of the current day (as defined in the condition ToTime(Time[0]) >= 160000 || ToTime(Time[0]) < 93000), sessionHigh is updated if the current High value is greater than the current sessionHigh value. This allows me to track the maximum High value formed within the specified time interval."

                            sessionHigh != double.MinValue will never be true between 930000 and 160000.

                            "After 9:30 in the current day, my code checks the condition Closes[0][0] > sessionHigh. If the current closing price breaks above sessionHigh, a long position is entered (EnterLong("LongPosition"))."

                            Close[0][0] will always be greater than double.MinValue between 930000 and 160000.


                            Are you seeing in the output between 9:30 and 16:00 that sessionHigh is not equal to double.MinValue?
                            I think I'm just messed up a bit with time series

                            // Instead of resetting the sessionHigh at 9:30 today, I reset it only at the beginning of a new trading session (16:00 of the current day).
                            if (ToTime(Time[0]) == 160000)
                            {
                            sessionHigh = double.MinValue;
                            tradeExecutedToday = false;

                            And now it works fine

                            But here is another thing. The long position entry occur only if the price breaks sessionHigh on bar CLOSE. Is there any option to makes entry right in breakout? I found that I can't use last or ask or market price. I should mention that I need it for backtesting
                            Last edited by Anquirk; 01-31-2024, 05:18 PM.

                            Comment


                              #44
                              Hello Anquirk,

                              You can enable TickReplay and use Calculate.OnPriceChange.

                              1-tick intra-bar granularity would also be necessary for accurate order fills.
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Haiasi, 04-25-2024, 06:53 PM
                              2 responses
                              17 views
                              0 likes
                              Last Post Massinisa  
                              Started by Creamers, Today, 05:32 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post Creamers  
                              Started by Segwin, 05-07-2018, 02:15 PM
                              12 responses
                              1,786 views
                              0 likes
                              Last Post Leafcutter  
                              Started by poplagelu, Today, 05:00 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post poplagelu  
                              Started by fx.practic, 10-15-2013, 12:53 AM
                              5 responses
                              5,408 views
                              0 likes
                              Last Post Bidder
                              by Bidder
                               
                              Working...
                              X