Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Buy only once

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

    Buy only once

    Code:
            protected override void Initialize()
            {
                SetStopLoss(Dollarstop, false);
                CalculateOnBarClose = true;
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                // Condition set 1
                if (ToTime(Time[0]) == ToTime(9, 29, 0))
                {
                    EnterLong(DefaultQuantity, "");
                }
                
                if (ToTime(Time[0]) == ToTime(15, 57, 0))
                {
                    ExitLong("", "");
                }            
            }
    hi will the above simply buy an instrument at time > 9:29AM. But once my stoploss is hit, will it try to buy again? Since the condition to buy is time > 9:29AM.

    How can i make it so that if my stoploss is hit, it does not buy again ?

    #2
    Hello Calhawk01,

    Thank you for your note.

    The condition you have set will only buy when the bar time is equal to 9:29 AM, no more nor less.
    Cal H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    648 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    574 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X