Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy won't run although backtest works fine

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

    Strategy won't run although backtest works fine

    Hi,

    I am encountering a problem with activating a newly compiled strategy in the strategies panel. Each time I click to activate it, it won't turn green, and the tick simply disappears.

    I am not sure why this is happening, given that the strategy compiled fine with no errors, and the backtest actually gave valid results.

    Any idea why the strategy won't run? Is there a problem with my If-Else statements? Hope someone can point me in the right direction. Thanks!
    Last edited by skyholder84; 11-01-2010, 03:13 AM.

    #2
    Have just attached the problem strategy to a chart, and it works fine.

    However, I can't get it enabled via the strategies tab in the main window, as the tick simply disappears each time I click on it. I can only activate a strategy when I open a chart. This is a problem, since I have 3 strategies running on 30 securities, and I can't have 90 windows open!

    Pls can someone advise me on how I can enable my problem strategy from the strategies tab the way I can for all my other strategies!

    Comment


      #3
      Problem abruptly disappeared... Can't imagine why.

      Btw, what does it mean when a strategy appears in yellow rather than green?

      Comment


        #4
        Glad to hear, when you have a script that is getting disabled right away, please make it a habit to always check the log tab for any error messages - a yellow strategy 'wait's' to get into a flat state to take the next entry.

        BertrandNinjaTrader Customer Service

        Comment


          #5
          That's a little strange, since I'm currently flat on all strategies. Yet, some FX pairs on one strategy remain yellow.

          Also, I'm really perplexed as to how the problem of auto-disabled strategies went away. The problem resolved it after I tried adding the strategy to a chart (successfully). It's really confounding...

          Comment


            #6
            Were you starting the strategies up with the same sessions and days back as on the charts?

            Did you check for errors? Were there any listed on the log tab as you enabeld them from the strategies tab?

            In which mode are you starting them up? "Wait Until Flat" or "Immediately Submit" ?

            BertrandNinjaTrader Customer Service

            Comment


              #7
              Were you starting the strategies up with the same sessions and days back as on the charts?

              I disabled the strategy and closed the chart before it could place an order. I don't usually load strategies onto charts, so after the strategy populated on the list, I disabled the strat on the chart, closed it and used the strategies tab to add strategies.

              Did you check for errors? Were there any listed on the log tab as you enabeld them from the strategies tab?

              11/1/2010 4:05:14 AM Strategy Error on calling 'OnBarUpdate' method for strategy 'ParabolicSARRev/a7ac5e5693bc4542b9b5d6ef1fd6f91f': You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

              This is in relation to another strategy I was running. I'm not sure I understand what is going on here as well. Is it because I have called too little data (5 days) at the start of the strategy? Would requesting a longer period of data from my data provider work?

              Also, there were no errors listed in relation to the problematic strategy. It just went disabled immediately after I clicked it.

              In which mode are you starting them up? "Wait Until Flat" or "Immediately Submit" ?

              I'm in "wait until flat" mode.

              Comment


                #8
                If you use WaitUntilFlat they would list as yellow to the point when they start executing live.

                For the error message: you would need to debug your strategy to check where you run into accessing the non valid index value - depending on with how much data you load the codes up it could show up or not.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Bertrand View Post
                  If you use WaitUntilFlat they would list as yellow to the point when they start executing live.

                  For the error message: you would need to debug your strategy to check where you run into accessing the non valid index value - depending on with how much data you load the codes up it could show up or not.
                  Have checked through the code, and all indexed values were valid. I had 1 primary bar and 2 secondary bars; all indicators and events referenced referred to these 3 bars, and the error didn't show up when I reloaded the strategy. Guess it was a problem of loading insuff data (esp since it's a monday).

                  I've changed waituntilflat to immediately execute under options, but the strat for AUDJPY, USDJPY and GBPJPY are all still in yellow. Strange...

                  Comment


                    #10
                    Did you restart the strategies after the setting change to 'immediately submit'?
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      HI Bertrand, I was trying to solve the problem as to why they were yellow. After making the setting change to 'immediately submit' and restarting the strategies, the strategies immediately showed some historical positions which were closed long ago.

                      There is now a very irritating problem. I've flattened all my open positions, and the positions tab is rightly showing nothing. However, there are some historical positions which I can't seem to clear out under the strategies tab! When I enable each strategy, these old positions still show up in the strategies tab as open positions with fluctuating, unrealized profits/losses despite the lack of any open positions under the positions tab.

                      I've tried everything! I've reset all accounts, repaired the database, reset the database, and the problem still persists. I can't clear out the old positions. Pls advise me!

                      Comment


                        #12
                        I've also reset all my accounts, so nothing is open. Every tab shows that historical transactions have been successfully erased, EXCEPT for the strategies. No historical executions, no historical or pending orders, nothing. Yet, the strategies can't seem to forget positions long closed.

                        I'm on the verge of a reinstall, and I'm not even sure that will do the job!

                        Comment


                          #13
                          skyholder, this is expected behavior - if you're working in immediately submit mode the historical strategy position the strategy still manages will show in the strategies tab, if this is not in your account -> you would need to ensure to sync the account up with a market order (NT7 also has an option to automatically do this for you) - here are the scenarios you could run into with those settings in mind -

                          BertrandNinjaTrader Customer Service

                          Comment


                            #14
                            Hi Bertrand, thanks for directing me to the explanation.

                            1) I was just wondering if there was a way to completely reset the strategy position and clear the slate. If there is, I could simply flatten all open positions with my broker and gain confirmation that I'm flat.

                            This way, account position = strategy position = 0. Neat and tidy, and my strategies can start trading straight away, rather than have to wait for my strategy to exit a virtual position and agreeing with my account that it is flat before trading can resume.

                            Currently, the neatest way is to set synch to false and to "wait till flat", but there is an opportunity cost to that method which I hope to avoid by resetting my position. Is there a way to do so? This is exceptionally painful since I have some swing trading strategies which remain open for over 6 hours!

                            2) Also, I'd like to know the implications of starting the strategy during the middle of the trading session where "flatten on close = false".

                            Am I right to conclude that in FX markets where "flatten on close = false", the only way to ensure immediate trading and correct position reporting is to start the strategy Before the start of the trading week at 5pm Sunday EST?
                            Last edited by skyholder84; 11-01-2010, 07:56 AM.

                            Comment


                              #15
                              Unfortunately you can't reset a strategy position - the only thing codewise you could do is just ignore historical order placement, thus creating a strategy only for realtime use -



                              I'm not sure I follow which cost is involved for you with the 'Wait Until Flat' option, just ensure the account is flat for the instrument and then execute the next fresh entry by your strategy.

                              Those 2 decisions are exactly the same as in manual trading - what are you doing when you get online your daily swing setup triggered 2 bars ago - are you jumping still in (immediately submit) or do you pass this trade and wait for the next (wait until flat).
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by trilliantrader, 04-18-2024, 08:16 AM
                              7 responses
                              27 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by samish18, 04-17-2024, 08:57 AM
                              17 responses
                              64 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by rocketman7, Today, 02:12 AM
                              2 responses
                              17 views
                              0 likes
                              Last Post rocketman7  
                              Started by briansaul, Today, 05:31 AM
                              1 response
                              13 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by PaulMohn, Today, 03:49 AM
                              1 response
                              12 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Working...
                              X