Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy not trading on live data, Sim account

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

    Strategy not trading on live data, Sim account

    My strategy trades fine on historical data but today I put it on live data on the Sim account and its not trading at all? any ideas what could be causing this. Its set to calculate on bar close.

    #2
    Hello GKonheiser,

    Are you verifying your trade signal are being hit in Real-time data? You may do this by using TraceOrders = true and using Print() statements.

    Also, do you see any errors inside of the Log tab of the Control Center?

    Happy to be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Just looked at the logs and I have a load of error relating to another strategy that I have no idea about. It is not in Custom folder and I cant see it active on any charts. The Strategy is LTStrategy, no idea where it came form, is it one that come with NT7?

      When I enable a strategy on live data should I be able to see past executions, ie trades that would have been done?

      With TraceOrders = true; im seeing nothing in the logs?
      Last edited by GKonheiser; 01-15-2014, 10:41 AM.

      Comment


        #4
        Hello GKonheiser,

        Could you let me know what the full error message that you see in the Log tab?

        As for your strategy that is trying to processing in real-time, can you add the TraceOrders and the Print() statements in post #2 to make sure your strategy is processing in real-time?
        JCNinjaTrader Customer Service

        Comment


          #5
          this is the entry in the log,

          1/15/2014 5:06:01 PM Strategy The strategy 'LTStrategy/7f58c31e2d5848f4af46ebc788a2cad7' has called the Add() method with an invalid instrument. Either 'SPY' does not exist in the Instrument Manager or the specified exchange has not been configured.

          Ive added TraceOrders == true;

          do I need to give a specific command to allow the strategy to trade on live data?

          Comment


            #6
            Hello GKonheiser,

            For the "LTStrategy" message, do you have any custom assemblies loaded inside of NinjaTrader? You may verify this by going to File -> Utilities -> Remove NinjaScript Assemblies. Alternatively, have you used this strategy in the past?

            As for your strategy in real-time, there is not special code that you need to use. Let me try a different approach, if you go to the "Strategies" tab of the Control Center, what color is the cell that your Strategy name is in?
            JCNinjaTrader Customer Service

            Comment


              #7
              Hi JC,

              I had a look at my code and this is stopping the script from trading which it doesn't on historical data:-

              if(
              ((Instrument.Expiry.Month == 3) && (Time[0].Date.Month == 12) && (Time[0].Date.Day < iStartTradeDate))
              || ((Instrument.Expiry.Month == 3) && (Time[0].Date.Month != 12 || Time[0].Date.Month != 1 || Time[0].Date.Month != 2 || Time[0].Date.Month != 3))
              || ((Instrument.Expiry.Month == 6) && (Time[0].Date.Month == 3) && (Time[0].Date.Day < iStartTradeDate))
              || ((Instrument.Expiry.Month == 6) && (Time[0].Date.Month != 3 || Time[0].Date.Month != 4 || Time[0].Date.Month != 5 || Time[0].Date.Month != 6))
              || ((Instrument.Expiry.Month == 9) && (Time[0].Date.Month == 6) && (Time[0].Date.Day < iStartTradeDate))
              || ((Instrument.Expiry.Month == 9) && (Time[0].Date.Month != 6 || Time[0].Date.Month != 7 || Time[0].Date.Month != 8 || Time[0].Date.Month != 9))
              || ((Instrument.Expiry.Month == 12) && (Time[0].Date.Month == 9) && (Time[0].Date.Day < iStartTradeDate))
              || ((Instrument.Expiry.Month == 12) && (Time[0].Date.Month != 9 || Time[0].Date.Month != 10 || Time[0].Date.Month != 11 || Time[0].Date.Month != 12))
              )
              {
              return;
              }

              I am currently trading on March contract, 3, so not sure why any statement above would equate to true, can you think why this would be?

              Comment


                #8
                Hello GKonheiser,

                The following statement will be true:

                Code:
                ((Instrument.Expiry.Month == 3) && (Time[0].Date.Month != 12 || Time[0].Date.Month != 1 || Time[0].Date.Month != 2 || Time[0].Date.Month != 3))
                So since you are using || (or command) the entire statement is true and causing your code to return.

                You may want to try to comment out that line.
                JCNinjaTrader Customer Service

                Comment


                  #9
                  Ya your right I see that now. Im going to replace it with:-

                  if(
                  ((Instrument.Expiry.Month == 3) && (Time[0].Date.Month == 12) && (Time[0].Date.Day < iStartTradeDate))
                  || ((Instrument.Expiry.Month == 3) && ((Time[0].Date.Month >3) && (Time[0].Date.Month <12)))
                  || ((Instrument.Expiry.Month == 6) && (Time[0].Date.Month == 3) && (Time[0].Date.Day < iStartTradeDate))
                  || ((Instrument.Expiry.Month == 6) && ((Time[0].Date.Month >6) && (Time[0].Date.Month <3)))
                  || ((Instrument.Expiry.Month == 9) && (Time[0].Date.Month == 6) && (Time[0].Date.Day < iStartTradeDate))
                  || ((Instrument.Expiry.Month == 9) && ((Time[0].Date.Month >9) && (Time[0].Date.Month <6)))
                  || ((Instrument.Expiry.Month == 12) && (Time[0].Date.Month == 9) && (Time[0].Date.Day < iStartTradeDate))
                  || ((Instrument.Expiry.Month == 12) && ((Time[0].Date.Month >12) && (Time[0].Date.Month <9)))
                  )
                  {
                  return;
                  }

                  Thanks

                  Comment


                    #10
                    Originally posted by GKonheiser View Post
                    Ya your right I see that now. Im going to replace it with:-

                    if(
                    ((Instrument.Expiry.Month == 3) && (Time[0].Date.Month == 12) && (Time[0].Date.Day < iStartTradeDate))
                    || ((Instrument.Expiry.Month == 3) && ((Time[0].Date.Month >3) && (Time[0].Date.Month <12)))
                    || ((Instrument.Expiry.Month == 6) && (Time[0].Date.Month == 3) && (Time[0].Date.Day < iStartTradeDate))
                    || ((Instrument.Expiry.Month == 6) && ((Time[0].Date.Month >6) && (Time[0].Date.Month <3)))
                    || ((Instrument.Expiry.Month == 9) && (Time[0].Date.Month == 6) && (Time[0].Date.Day < iStartTradeDate))
                    || ((Instrument.Expiry.Month == 9) && ((Time[0].Date.Month >9) && (Time[0].Date.Month <6)))
                    || ((Instrument.Expiry.Month == 12) && (Time[0].Date.Month == 9) && (Time[0].Date.Day < iStartTradeDate))
                    || ((Instrument.Expiry.Month == 12) && ((Time[0].Date.Month >12) && (Time[0].Date.Month <9)))
                    )
                    {
                    return;
                    }

                    Thanks
                    What is it for? Can you explain in English?

                    Comment


                      #11
                      It prevents a contract from trading before it is liquid, ie normally the day before front month

                      Comment


                        #12
                        ((Instrument.Expiry.Month == 3) && ((Time[0].Date.Month >3) && (Time[0].Date.Month <12)))
                        So what this mean?
                        ((Instrument.Expiry.Month == 6) && ((Time[0].Date.Month >6) && (Time[0].Date.Month <3)))
                        How this can be true?

                        Comment


                          #13
                          Originally posted by Baruch View Post
                          So what this mean?

                          How this can be true?

                          Your correct it cant. I will think it over again.

                          Comment


                            #14
                            The first part you can do in one line:
                            (Instrument.Expiry.Month + 12 - Time[0].Date.Month) mod 12 == 3

                            Comment


                              #15
                              OK I think this is it,

                              if(
                              ((Instrument.Expiry.Month == 3) && (Time[0].Date.Month == 12) && (Time[0].Date.Day < iStartTradeDate))
                              || ((Instrument.Expiry.Month == 3) && ((Time[0].Date.Month >3) && (Time[0].Date.Month <12)))
                              || ((Instrument.Expiry.Month == 6) && (Time[0].Date.Month == 3) && (Time[0].Date.Day < iStartTradeDate))
                              || ((Instrument.Expiry.Month == 6) && ((Time[0].Date.Month >6) || (Time[0].Date.Month <3)))
                              || ((Instrument.Expiry.Month == 9) && (Time[0].Date.Month == 6) && (Time[0].Date.Day < iStartTradeDate))
                              || ((Instrument.Expiry.Month == 9) && ((Time[0].Date.Month >9) || (Time[0].Date.Month <6)))
                              || ((Instrument.Expiry.Month == 12) && (Time[0].Date.Month == 9) && (Time[0].Date.Day < iStartTradeDate))
                              || ((Instrument.Expiry.Month == 12) && (Time[0].Date.Month <9))
                              )
                              {
                              return;
                              }

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by sjsj2732, Yesterday, 04:31 AM
                              0 responses
                              33 views
                              0 likes
                              Last Post sjsj2732  
                              Started by NullPointStrategies, 03-13-2026, 05:17 AM
                              0 responses
                              286 views
                              0 likes
                              Last Post NullPointStrategies  
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              286 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              133 views
                              1 like
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              91 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Working...
                              X