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 DawnTreader, 05-08-2024, 05:58 PM
    7 responses
    27 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by sgordet, Today, 05:24 AM
    0 responses
    8 views
    0 likes
    Last Post sgordet
    by sgordet
     
    Started by haas88, 03-21-2024, 02:22 AM
    18 responses
    211 views
    0 likes
    Last Post haas88
    by haas88
     
    Started by Board game geek, Today, 02:20 AM
    0 responses
    11 views
    0 likes
    Last Post Board game geek  
    Started by knighty6508, Today, 01:20 AM
    2 responses
    19 views
    0 likes
    Last Post knighty6508  
    Working...
    X