• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

strategy halts/stops after first call to SubmitOrderUnamanged

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

  • NinjaTrader_Kate
    replied
    Hello momchi,

    Thank you for your reply.

    Ah ha! That would do it. Looking at it again I see where I didn't catch that -1 quantity in the print when it enters the SubmitOrderUnmanaged - I think my brain just thought it was part of the equals sign. Glad you got it worked out.

    Please let us know if we may be of further assistance to you.

    Leave a comment:


  • momchi
    replied
    Hi Kate,

    that's totally embarrassing! Found out that due to a bug in my code, I was submitting the SubmitOrderUnmanaged() for shorts with a negative quantity i.e. -1 or -2 ...
    Once this was corrected all orders proceed as they should. Thank you for looking into this!

    Now you know what to check for when someone says "my orders are halting" LOL ....

    Leave a comment:


  • momchi
    replied

    Originally posted by NinjaTrader_Kate View Post
    Hello momchi,

    Thank you for your note.

    When the strategy is enabled, do you see any errors in the Log tab of the Control Center? If so, what is the full text of the error?

    Does the strategy remain enabled, or does it disable itself?

    Do you see the entry order get placed/fill? Or does nothing at all occur after you see the notation regarding the SubmitOrderUnmanaged?

    Thanks in advance; I look forward to assisting you further.
    Hi Kate, thanks for responding -
    interesting suggestion to try enable the strategy, result that I was originally describing was during Backtesting.

    A) So here is my log during Backtesting:
    ----------------
    State: Configured done.
    6:02 PMState: Data Loaded
    7:45 PM Processing main series ...
    ....
    8:28 AM Processing main series ...
    8:28 AM Enter SHORT: position quantity = 0x Flat => tradeSignal = -1
    3/23/2020 8:28:57 AM Strategy 'DeployNLS2003/-1': Entered internal SubmitOrderUnmanaged() method at 3/23/2020 8:28:57 AM: BarsInProgress=0 Action=Sell OrderType=Market Quantity=-1 LimitPrice=0 StopPrice=0 SignalName=''
    Sate: defaults set
    Sate: defaults set
    Sate: defaults set

    Notice: after the first order - "Processing main series" stops (means OnBarUpdate() no longer called at all). Also does not seem to reach end of the OnBarUpdate method:
    if( entryOrder != null )
    Print(Times[BarsInProgress][0].ToShortTimeString() + " END OF OnBarUpdate... order state: " + entryOrder.OrderState.ToString() );
    else
    Print(Times[BarsInProgress][0].ToShortTimeString() + " END OF OnBarUpdate... order state: N/A" );
    does not print anything!?

    B) when run in simulation, instance of the strategy on an account - it, actually, reaches much further! It executes two orders, even checks their state - but then, also "just stops" with no error or warning in neither of the log files...?!

    Example:
    State: Configured done.
    6:04 PMState: Data Loaded
    6:16 PM Processing main series ...
    ....
    9:08 AM Processing main series ...
    9:08 AM Enter LONG: position quantity = 0x Flat => tradeSignal = 1
    3/30/2020 9:08:53 AM Strategy 'DeployNLS2003/137464090': Entered internal SubmitOrderUnmanaged() method at 3/30/2020 9:08:53 AM: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName=''
    9:08 AM END OF OnBarUpdate... order state: Working
    9:25 AM Processing main series ...
    9:25 AM END OF OnBarUpdate... order state: Filled
    9:30 AM Processing main series ...
    9:30 AM END OF OnBarUpdate... order state: Filled
    9:32 AM Processing main series ...
    9:32 AM Enter SHORT: position quantity = 1x Long => tradeSignal = -2
    3/30/2020 9:32:47 AM Strategy 'DeployNLS2003/137464090': Entered internal SubmitOrderUnmanaged() method at 3/30/2020 9:32:47 AM: BarsInProgress=0 Action=Sell OrderType=Market Quantity=-2 LimitPrice=0 StopPrice=0 SignalName=''

    after the second order - nothing seems to be running, and it does not print the "END OF OnBarUpdate" debug message...
    The strategy does disable itself after that.

    One thing that I might be doing wrong is that my entryOrder reference is defined as a strategy data-object:

    public class DeployNLS2003 : Strategy
    {
    ...
    private Order entryOrder;
    ...
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    ....
    entryOrder = null; // unmanaged only

    is this alright? I wanted the order reference to be kept "more static" between the calls to OnBarUpdate.

    Any suggestions would be very appreciated!!!

    Leave a comment:


  • NinjaTrader_Kate
    replied
    Hello momchi,

    Thank you for your note.

    When the strategy is enabled, do you see any errors in the Log tab of the Control Center? If so, what is the full text of the error?

    Does the strategy remain enabled, or does it disable itself?

    Do you see the entry order get placed/fill? Or does nothing at all occur after you see the notation regarding the SubmitOrderUnmanaged?

    Thanks in advance; I look forward to assisting you further.

    Leave a comment:


  • strategy halts/stops after first call to SubmitOrderUnamanged

    Hi,
    my strategy suddenly stops (does not even print debug messages after the first occurrence of an un-managed order... Any hints what might be wrong?
    IsUnmanaged = true; (OnStateChange/Set defaults)
    ...
    the call:
    entryOrder = SubmitOrderUnmanaged(0, OrderAction.Buy, OrderType.Market, tradeSignal);

    entryOrder is defined (as data obj of the strategy):
    private Order entryOrder = null;

    the log:
    8:26 AM OnBarUpdate [BarsInProgress:1] => current bars:845
    8:27 AM OnBarUpdate [BarsInProgress:1] => current bars:846
    8:28 AM OnBarUpdate [BarsInProgress:1] => current bars:847
    8:28 AM OnBarUpdate [BarsInProgress:0] => current bars:37
    8:28:57 AM AutoPeriod = 4
    Enter SHORT: position quantity = 0x Flat => tradeSignal = -1
    3/23/2020 8:28:57 AM Strategy 'DeployNLS2003/-1': Entered internal SubmitOrderUnmanaged() method at 3/23/2020 8:28:57 AM: BarsInProgress=0 Action=Sell OrderType=Market Quantity=-1 LimitPrice=0 StopPrice=0 SignalName=''
    Sate: defaults set
    Sate: defaults set
    Sate: defaults set
    Sate: defaults set
    ...
    ?

    I am new to UnmanagedOrder methods

    thank you -

Latest Posts

Collapse

Topics Statistics Last Post
Started by irissoto, Today, 10:35 PM
0 responses
4 views
0 likes
Last Post irissoto  
Started by hedgeplay, Today, 08:04 PM
0 responses
4 views
0 likes
Last Post hedgeplay  
Started by DTSSTS, Today, 07:02 PM
0 responses
6 views
0 likes
Last Post DTSSTS
by DTSSTS
 
Started by arguru, Today, 04:07 PM
1 response
11 views
0 likes
Last Post NinjaTrader_ShawnB  
Started by lakersfan, Today, 06:02 PM
0 responses
13 views
0 likes
Last Post lakersfan  
Working...
X