Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

lost orders

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

    lost orders

    Hi ,

    I'm an expert c# developper and I'm also trading since 10 years...

    I had an opportunity to manage a fund with automate trading.

    Beeing a C# programmer since the beginning of .NET , I don't like platforms with script language.
    So I came to NinjaTrader 3 months ago to try it.
    Write my strategy and test it.

    I made a lot of backtest , rewrite some code , more backetest... Every day since 3 months.

    Since last week , I think my strategy is well enough to test in real time but on demo account.
    (Good draw down , good profit factor , good sharpe ratio...)

    The idea is if it's correct , I will test with a real money account after...
    And if it's ok , manage the fund money with it...

    So I installed a version on another computer to let it run with the strategy all day long.
    I backed up the data's and script code from my development computer to the other.

    I must add that I'm trading Futures (ES,TF,YM,6E,NQ) , I use the same strategy on each future BUT with different parameter values.

    So every morning I turn up the test computer , I encode 5 new strategies in the strategy list and let it run
    (Remark : It would be very nice to be able to save the strategy list )

    I come to the bad point :

    Sometimes of course , some trades loose money...
    So I test the strategy on chart to try to understand the bad trade...

    And I'm very surprise...

    The same strategy with same parameters with same datas don't give the same result when it is run on Chart or when it is run on the list !!!!!

    Some executions are not execute on the list.

    One more thing to say , the strategy is calculated OnBarClose
    So I should not even have big difference between backtest and real-time.
    Both are executed "CalculateOnBarClose = true"

    How can I have difference between strategy on graph and strategy on List ???

    Thanks for help...

    #2
    Welcome to our forums Trumumflu!

    Correct the CalculateOnBarClose setting is only applicable for realtime usage, in backtesting it's always set to 'true' as the intrabar tick formation is not known then -



    Realtime vs backtest results can differ for a variety of reasons, please review this link here for details - http://www.ninjatrader-support.com/H...sBacktest.html

    What you experienced has most likely to deal with the first section 'Getting Filled on an order'.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Not sure what data feeds you are using (i.e. whether you are using data from the same data feed in playback/backtest as you did when forwardtesting "live"), but if you think differences in data feed might be part of the issue, then the following two threads may be of interest ...

      Bars created from broker real-time data feed differ from bars created from eSignal http://www.elitetrader.com/vb/showth...hreadid=194423

      Each trader sees real-time bar charts that are unique to them


      Hope these help. Ignore if not relevant to you!

      Comment


        #4
        Thank you both for the interest on my post

        I would like to be more precise...

        I know that the price on real-time and on backtest may be different for some ticks...

        Cause of spread , slippage , slow market... Anything else...

        But here it's not the same thing....

        I use only market order..
        My algorithm can gives me differents entries or exit point...

        The fact is that some orders are not executed...

        A simple example :
        In the algorithm , I close all open position at 22:30 (I live in Europe)

        Yesterday night I was still open on 4 futures near 22:30...

        When the time came , only 1 of the 4 get closed...

        And I repeat , I'm using the same strategy on each Futures !!!

        I really don't understand... As I said I'm a developper , and usually I finish to find a logical explanation...
        But here... I really don't know...

        I'm testing the "Position" object to be sure before entering or quitting a trade.

        For example :

        if
        (Position.MarketPosition == MarketPosition.Flat)
        {
        GoLong(
        "Entree Long at " + barTime.ToString());
        return;
        }

        I just hope it's not a Static object cause it should explains problems...
        But it should be a big bug !!!

        I'm testing now a very simple strategy :
        - Enter at a certain time
        - Exit at another time

        There is no more simple then that
        I will see if it misses some executions... And come back to you

        Comment


          #5
          Sure, please report back what you found with this simple test strategy.

          Were you using the ExitOnClose() method?

          Then please ensure ExitOnCloseSeconds is entered high enough to allow all open contracts to be executed / filled in time.

          Also - are you synching your strategy vs account position properly when starting up?

          BertrandNinjaTrader Customer Service

          Comment


            #6
            I have ExitOnclose = TRUE

            But it's only a garantee...

            when I say I close at 22:30 , it's a parameter on my strategy

            This is the code for that test :

            // On Check les heures limite de trading
            TimeSpan barTime = Time[0].TimeOfDay;
            if ( barTime < tradingPeriodStartTime || barTime >= tradingPeriodEndTime )
            {
            if (Position.MarketPosition == MarketPosition.Long)
            {
            OutLong();
            return;
            }
            elseif (Position.MarketPosition == MarketPosition.Short)
            {
            OutShort();
            return;
            }

            return;
            }


            The strategy is always started with a Start Time parameter.
            I put that Start Time near 10 min after I push the Start button on the strategy list.

            I never have open position on account before starting...
            Like that ,I'm sure to be synchronized...

            I did that because I had that kind of problem before

            Comment


              #7
              I see, thanks for clarifying - but I don't follow then why you also use the ExitOnClose() method which would refer to entered session begin and end times for determining the time to close, could your custom handling and this be overlapping producing overfills?
              BertrandNinjaTrader Customer Service

              Comment


                #8
                As I said , ExitOnClose = true is just a garantee.
                Normaly there is no more open position at that time...

                I use my own time 'fork' because I let the session limits to 0:00

                In fact , my strategy needs a lot of bars in calculation before beeing able to give good signals...
                So like that , I trade between 8:00 and 22:30 but calculation begins before , at 0:00.

                Comment


                  #9
                  Ok, got it thanks - if you haven't been using them already, TraceOrders are a valuable debug feature as well - http://www.ninjatrader-support2.com/...ead.php?t=3627
                  BertrandNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  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
                  16 views
                  0 likes
                  Last Post rocketman7  
                  Started by briansaul, Today, 05:31 AM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by PaulMohn, Today, 03:49 AM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by frslvr, 04-11-2024, 07:26 AM
                  6 responses
                  106 views
                  1 like
                  Last Post NinjaTrader_BrandonH  
                  Working...
                  X