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

Orders auto placed at the wrong time

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

    Orders auto placed at the wrong time

    Hello

    This morning I placed my order via the my automated strategy and it placed the order at the wrong time.

    It is only supposed to place the order when the 10:00 candle starts (9:00 AM Computer time, but 10:00 candle time stamp). I set the order at about 8:45 and expected that it would auto place the order when my computer reached 9:0 am

    Here is the code that deals with that particular order placement:

    Code:
    			else if (direction == TrendDirection.Down)
    			{
    				if (ShortEntry == null
    				     && ToTime(Time[0]) == ToTime(endRangeHr,endRangeMin,00) 
    				     && ToTime(Time[0]) < ToTime(removeOrderHr, removeOrderMin,0)
    				     && restrictTrade == false)
    				{
    					ShortEntry = EnterShortStop(0, true, positionSize, ShortEntryPrice, "BreakoutShort");
    				}
    Here is the Properties section for the user defined input that would deal with this also:

    Code:
            [Description("Range End Hour")]
            [GridCategory("Parameters")]
    		[Gui.Design.DisplayName("2 End Range Hr")]
            public int EndRangeHr
            {
                get { return endRangeHr; }
                set { endRangeHr = value; }
            }
    Attached also are two screenshots. One is a screenshot of the strategy in the Strategies Tab showing how I had it set and the second one is the actual Edit Strategies window showing how it is set.

    I can not find any reason why this would have set the order prior to the 10:00 Candle (9:00 Computer time). Can you please see if you can find a possibility and let me know.

    Thank you!
    Attached Files

    #2
    jg123, I don't see a reason from the info presented but it would not be enough to make any conclusions, whenever something that appears debug prints would come in very handy to understand which values / states your variable had that effected the trigger of the order placement in your code, namely this part :

    if (ShortEntry == null
    && ToTime(Time[0]) == ToTime(endRangeHr,endRangeMin,00)
    && ToTime(Time[0]) < ToTime(removeOrderHr, removeOrderMin,0)
    && restrictTrade == false)

    There must be an item that would differently evaluating this morning from what you expected - you also want to be keeping in mind that NT stamps the bar with their closing times.
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cummish, Today, 08:43 PM
    0 responses
    5 views
    0 likes
    Last Post cummish
    by cummish
     
    Started by Option Whisperer, Today, 07:58 PM
    4 responses
    18 views
    0 likes
    Last Post Option Whisperer  
    Started by ETFVoyageur, 05-07-2024, 07:05 PM
    13 responses
    86 views
    0 likes
    Last Post ETFVoyageur  
    Started by cupir2, Today, 07:44 PM
    0 responses
    9 views
    0 likes
    Last Post cupir2
    by cupir2
     
    Started by reynoldsn, Today, 07:23 AM
    6 responses
    20 views
    1 like
    Last Post reynoldsn  
    Working...
    X