Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Analyzer Optimization

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

    Strategy Analyzer Optimization

    I'm getting results when testing the SampleMA strategy, but not getting any results from my custom strat with parameters. I have a feeling that its because i have my params set in OnMarketData(MarketDataEventArgs e) rather than OnBarUpdate(), but would like to confirm this before making any changes.

    thanks

    #2
    dargente, likely correct as the OnMarketData() would only be called in realtime / Market Replay and not in a backtest.

    Comment


      #3
      ok hopefully, i'll move my code in that function and retest.

      what's the equivilant of e.Time in OnBarUpdate ?

      Comment


        #4
        You can check off the bar time stamp with Time[x] -

        Comment


          #5
          Time[0] is stuck on my timeframe dataseries and will only update accordingly, no matter my 'calculate on bar close' is set to true or false i get same result. How do i get the real intra-bar time including seconds?
          Last edited by dargente; 02-21-2011, 03:17 AM.

          Comment


            #6
            CalculateOnBarClose is true in backtesting per default, as there's only the historical series OHLCV info you can access...for a lower granularity timestamp please add another bars object and then use Times[index][barsago] to access those.

            Comment


              #7
              ok, i added a second timeframe.

              Print(Times[1][0].ToString());

              ok now i just retested the Strategy Optimizer and still getting no results. i have a feeling now maybe it is because i am using the bid and ask volumes; the instrument is forex EURUSD. but i am not sure, can you confirm? and if so how to proceed? i appreciate your help in migrating my code and getting it ready for optimization.
              Last edited by dargente; 02-22-2011, 12:09 AM.

              Comment


                #8
                Great, how do you access the bid and ask volumes? Are you adding any additional bid / ask series to work with them historically here?

                Comment


                  #9
                  Bertrand, i have added the following:

                  Add(PeriodType.Tick, 1);

                  Add("$EURUSD", PeriodType.Tick, 1, MarketDataType.Bid);

                  Add("$EURUSD", PeriodType.Tick, 1, MarketDataType.Ask);

                  bidPrice = Closes[2][0];
                  bidVolume = Volumes[2][0];
                  askPrice = Closes[3][0];
                  askVolume = Volumes[3][0];

                  fyi, volume here is a double, whereas elsewhere it was changed to a long data type for NT7. just wanted to bring that up.

                  i have added BarsInProgress for retrieving prices and volumes. the strategy is now functioning properly. what else am i missing because i am still getting no results on the back-test?
                  Last edited by dargente; 02-22-2011, 02:50 AM.

                  Comment


                    #10
                    dargente, are you sure your conditions are triggering as expected? Have you confirmed via Prints? Or do you perhaps call ATM's here, those could not be backtested unfortunately.

                    Comment


                      #11
                      ok, i am able to see some trades in the back-testing now, but there is definitely a problem with the synching of bids and asks on every tick. My strategy is dependent on these and respective volumes, but I'm not getting a true time and sales:

                      Code:
                      if(BarsInProgress == 2 || BarsInProgress == 3)
                                  {    
                                      bidPrice = Closes[2][0];
                                      bidVolume = Volumes[2][0];
                                      askPrice = Closes[3][0];
                                      askVolume = Volumes[3][0];
                      
                                      Print(Times[1][0].ToString()
                                      + " BID: " + bidVolume + "     " + bidPrice
                                      + "    " + askPrice + "     " + askVolume + "     :ASK ");
                      }
                      How do i store and retrieve from the data series so the bid / ask prices and volumes match the real data-feed?

                      Comment


                        #12
                        dargente, you might be seeing slightly different results as the granularity here is limited to a second, unfortunately not lower - this is on our list for future consideration though already.

                        Comment


                          #13
                          can you clarify which below is causing the 1 second granularity?

                          - OnBarUpdate() ?
                          - Add("$EURUSD", PeriodType.Tick, 1, MarketDataType.Bid/Ask)?
                          and/or
                          - BackTesting
                          ?

                          Note that there are problems even before back-testing.

                          Also, using OnMarketData(MarketDataEventArgs e) i am able to get a true tape-reading but not able to backtest/optimize, hence this thread.

                          Comment


                            #14
                            dargente, I was referring to the timestamp resolution of your tick series, this will be limited to 1 second unfortunately.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by argusthome, 03-08-2026, 10:06 AM
                            0 responses
                            88 views
                            0 likes
                            Last Post argusthome  
                            Started by NabilKhattabi, 03-06-2026, 11:18 AM
                            0 responses
                            48 views
                            0 likes
                            Last Post NabilKhattabi  
                            Started by Deep42, 03-06-2026, 12:28 AM
                            0 responses
                            31 views
                            0 likes
                            Last Post Deep42
                            by Deep42
                             
                            Started by TheRealMorford, 03-05-2026, 06:15 PM
                            0 responses
                            34 views
                            0 likes
                            Last Post TheRealMorford  
                            Started by Mindset, 02-28-2026, 06:16 AM
                            0 responses
                            68 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Working...
                            X