Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Order rejected on SIM account on external data feed.

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

    Order rejected on SIM account on external data feed.

    I developed a strategy which is working properly on historical data and Market Replay. For testing purposes I'm connected to external data feed, which pushes a data to NinjaTrader from Metatrader DDE server by External Data Feed connection. The data flows properly and is stored in Ninja database, all indicators are working properly on this data. The Market Replay is in fact the data acquired as described above.
    Every order created by my strategy on External Data Feed is rejected, independently of its size, positions are not entered and the strategy on my instrument is disabled.
    Is it: 1) A limitation of the free NinjaTrader on Sim account ?
    2) A limitation of External Data Feed , not supported by Ninja? Does ordering protocol expect certain acknowledgment from the data provider and without it the order cannot be accomplished?
    3) Any other problem?

    It seems I have an answer for myself. Looking at

    and

    and Automated Trading Interface in the help
    it seems I should implement ATI functions by myself. Any comment? Do you know about any code/examples available on the forum?
    Last edited by xTrader1; 09-22-2014, 02:29 AM. Reason: I didn't read enough about External Data Feed.

    #2
    xTrader1, which rejection message do you exactly get when trying to submit an order? Is it different if you manually attempted to trade on this feed / data?

    The DLL interface PLACE command would be for any signals generated via an external application, if you run a native NinjaScript this would not be needed as you would have the Managed (Enter()) or Unmanaged (SubmitOrder) methods directly available.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Attached a log file:
      Date,Category,Message,
      9/22/2014 11:32:46,Strategy,Disabling NinjaScript strategy 'MyRenkoTick1/54c1d82e9e584bd683a198034536c904',
      9/22/2014 11:32:46,Strategy,Strategy 'MyRenkoTick1/54c1d82e9e584bd683a198034536c904' submitted an order that generated the following error 'OrderRejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself.,

      9/22/2014 11:32:46,Order,External Data Feed, Order has exceeded available account equity: Please reduce order size affected Order: Buy 10 Market,

      9/22/2014 11:32:46,Order,Order='48b271edb1334546a22ba01f965f 75c4/Sim101' Name='Buy' New state=Rejected Instrument='$GBPJPY' Action=Buy Limit price=0 Stop price=0 Quantity=10 Type=Market Filled=0 Fill price=0 Error=OrderRejected Native error='Order has exceeded available account equity: Please reduce order size',
      9/22/2014 11:32:46,Order,Order='48b271edb1334546a22ba01f965f 75c4/Sim101' Name='Buy' New state=PendingSubmit Instrument='$GBPJPY' Action=Buy Limit price=0 Stop price=0 Quantity=10 Type=Market Filled=0 Fill price=0 Error=NoError Native error='',
      9/22/2014 11:14:04,Strategy,Disabling NinjaScript strategy 'MyRenkoTick1/0d5496612b004ad5893e2d9f7a860c82',

      9/22/2014 11:14:04,Strategy,Strategy 'MyRenkoTick1/0d5496612b004ad5893e2d9f7a860c82' submitted an order that generated the following error 'OrderRejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself.,

      9/22/2014 11:14:04,Order,External Data Feed, Order has exceeded available account equity: Please reduce order size affected Order: SellShort 10 Market,

      9/22/2014 11:14:04,Order,Order='611e84acab844edaa2ea330100a5 c636/Sim101' Name='Sell short' New state=Rejected Instrument='$AUDUSD' Action=SellShort Limit price=0 Stop price=0 Quantity=10 Type=Market Filled=0 Fill price=0 Error=OrderRejected Native error='Order has exceeded available account equity: Please reduce order size',

      9/22/2014 11:14:04,Order,Order='611e84acab844edaa2ea330100a5 c636/Sim101' Name='Sell short' New state=PendingSubmit Instrument='$AUDUSD' Action=SellShort Limit price=0 Stop price=0 Quantity=10 Type=Market Filled=0 Fill price=0 Error=NoError Native error='',

      All these generated by EnterLong / EnterShort from my strategy. I reduced order size from 1000 to 10 and defined SIM account as 10 000 000 , it doesn't help.

      Comment


        #4
        Thanks, so I guess you get the same rejection if you just buy 1 one unit manually? What vol do you set for your external feed driving the charts?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          May be I don't understand your question, but the same settings, even 10000 on Market Replay with the same data.

          Comment


            #6
            I was curious if the was a difference if the order came from your strategy vs manually placed through any order entry window - like ChartTrader or FXPro.

            What volume do you see for each tick via your external connection? Perhaps that's too low to allow for fills.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Stange results

              I'm testing forex: 1 tick = 1 tick volume. But look at another issue:
              The 1-st screen shot was taken on Right click==>Strategy Performance==>[My strategy]==>Historical and Real time I see in results that all trades are 0 bars long.
              The 2-nd screenshot is for File==>New==>Strategy Analyzer. I have different results, I'm going to crosscheck whether I have the same inputs, also I'm sure they are, because I'm using defaults in both cases.
              But in any case, please look at the same trade in these screenshots: The trade beginning on 9/12/2014 16:29:41 has 291 [tick] bars using Strategy Analyser and 0 bars right clicking from the window.
              Entry/Exit times and prices are identical. It is the same module - isn't it? What's going on?
              Attached Files

              Comment


                #8
                xTrader1, ok which volume do you see associated to the Level 1 data you drive to NT via your connector? If you have the replay rolling and check the Control Center data window > what volume is pushed there for bid / ask / last?

                For your strategy reports - do you see the same difference for example for SampleMACrossOver? Only outstanding item I notice here is the date, which seems shifted by one day comparing the reports.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  May be I misunderstood again - I'm testing forex: 1 tick = 1 [tick] volume for every tick bar. As I developed the DDE bridge between Metatrader and Ninja I'm in total control an can push to Ninja whatever volume I want for every tick, if it will solve the issue. Alternately I can create an order with quantity of 1. As I'm not looking at tick volume in this particular strategy it's Ok for me for now, to help to solve the issue.
                  Regarding Market Replay: I checked it on another desktop, it's even worse: I'm trying to place my strategy , when connected to market replay, set Enabled=True. There is no error, but the strategy is disabled immediately, and I see Enabled=False. It's consistent, I recompiled all , removed , inserted again, it does not help.


                  Regarding SampleMACrossOver – it works properly.


                  A few days ago I sent here an implementation of checking Renko tick by tick, using SampleMACrossOver as a base: http://www.ninjatrader.com/support/f...ad.php?t=68886

                  I tested it now, it is not rejected on MarketReplay and Enabled remains True. However testing by right click gives 0 trades , while New ==> Strategy Analyzer gives trades for the same period while connected to market replay.

                  The log on my strategy in marke replay is:
                  Date,Category,Message,
                  09/22/2014 14:53:56,Strategy,Enabling NinjaScript strategy 'MyTest1Stg/834f3062059c4729a40b5ba1bc5a7df8' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True CalculateOnBarClose=True MaxRestarts=4 in 5 minutes,

                  09/22/2014 14:52:58,Strategy,Disabling NinjaScript strategy 'MyTest1Stg/d380b56ffdca41578cc37844f52b2a38',

                  09/22/2014 14:51:26,Strategy,Enabling NinjaScript strategy 'MyTest1Stg/d380b56ffdca41578cc37844f52b2a38' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True CalculateOnBarClose=True MaxRestarts=4 in 5 minutes,

                  09/22/2014 14:49:48,Strategy,Disabling NinjaScript strategy 'SampleMACrossOver/ce4a1a55bc304fc1bbf9f61d6e05ea50',
                  09/22/2014 14:48:19,Strategy,Enabling NinjaScript strategy 'SampleMACrossOver/ce4a1a55bc304fc1bbf9f61d6e05ea50' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True CalculateOnBarClose=True MaxRestarts=4 in 5 minutes,

                  09/22/2014 14:48:18,Strategy,Disabling NinjaScript strategy 'MyRenkoTick1/1292e20ee1f1458aa47d4b2eb4453fd0',

                  09/22/2014 14:45:24,Strategy,Enabling NinjaScript strategy 'MyRenkoTick1/1292e20ee1f1458aa47d4b2eb4453fd0' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True CalculateOnBarClose=True MaxRestarts=4 in 5 minutes,

                  09/22/2014 14:37:54,Default,Simulation account 'Replay101' reset,
                  09/22/2014 14:37:40,Default,Simulation account 'Replay101' reset,
                  09/22/2014 14:37:18,Default,Simulation account 'Replay101' reset,
                  09/22/2014 14:37:18,Connection,Time to flatten=00:00:00, Flatten all=Disabled,
                  09/22/2014 14:37:18,Default,Simulation account 'Replay101' reset,
                  =======
                  Would you taka a source in the link above and send it to developers? The programming idea is the same as my current strategy, entry/exit conditions are different.


                  .
                  Last edited by xTrader1; 09-22-2014, 06:47 AM.

                  Comment


                    #10
                    Originally posted by NinjaTrader_Bertrand View Post
                    Thanks, so I guess you get the same rejection if you just buy 1 one unit manually? What vol do you set for your external feed driving the charts?
                    EnterLong/EnterShort even with quantity=1 fails.
                    So I changed my strategy to work on 2-tick bars. In this case we have tick volume=2 for every bar. EnterLong/Short are with quantity=1. It didn't work either, log file says “Please reduce order size” as previously and the strategy disables itself. So it seems the problem is not “lack of volume in the market”.

                    Comment


                      #11
                      xTrader1, for the enablement issue, does it matter what BarsRequired your script uses? You load additional series for Bid / Ask data so perhaps there's not enough historical data present to start up?

                      The SampleMA would only be a single series script in contrast.

                      Typically the FX volume we see on connections would be set to 0.1M so one full lot in unit terms per tick.
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_Bertrand View Post
                        xTrader1, for the enablement issue, does it matter what BarsRequired your script uses? You load additional series for Bid / Ask data so perhaps there's not enough historical data present to start up?

                        The SampleMA would only be a single series script in contrast.

                        Typically the FX volume we see on connections would be set to 0.1M so one full lot in unit terms per tick.
                        Thanks for following this thread. As I'm sure you know, there is no general market volume in FX market. the volume might be supplied supplied by the data provider, as in MbTrading or it is just a tick volume. it means volume=1 for every tick. As Oanda does not broadcast volume, I'm just pushing it as 1 per tick. As I told, I may do everything else , but it would be artificial. There is a problem here, as I described in my previous post, when volume=2 for every 2-tick bar and I'm using EnterLong(1)/EnterShort(1), the order is rejecting and the strategy is disabled. So there is a problem. Of course, you may answer that I'm on my own, as external data feeds are not supported.

                        But may be can you answer what is checked by order management methods when working against supported data provider / market replay? Is any handshaking between the strategy and the data provider performed? It means, are these methods just sending order management commands, orders, or are they awaiting for certain acknowledge from the data provider in order to decide if the order is filled or rejected?

                        May be I should just implement Command function in my DDE to Ninja bridge and then everything will be Ok? In any case I'm not sending currently real orders, and an implementation of Command would always return "Success " ?
                        Do you think it's a right direction? Do you know about examples?

                        My current alternative is to develop "Clone order management" object and to use it instead, but it's reinventing a wheel, and the wheel is going to be a bit elliptic.

                        Thanks.

                        Comment


                          #13
                          Please disregard this thread. Not only I didn't enable ATI interface, but also set improper initial cash value in Sim account. Now everything works. Sorry , my fault.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Felix Reichert, 04-26-2024, 02:12 PM
                          10 responses
                          68 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Started by PaulMohn, 04-24-2024, 03:49 AM
                          4 responses
                          36 views
                          0 likes
                          Last Post PaulMohn  
                          Started by lightsun47, Today, 11:37 AM
                          1 response
                          9 views
                          0 likes
                          Last Post NinjaTrader_Zachary  
                          Started by vitaly_p, Yesterday, 05:09 PM
                          4 responses
                          35 views
                          0 likes
                          Last Post vitaly_p  
                          Started by bortz, 11-06-2023, 08:04 AM
                          50 responses
                          1,777 views
                          0 likes
                          Last Post carnitron  
                          Working...
                          X