Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Daily with intraday orders

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

    Daily with intraday orders

    Hi,

    I'm trying to accomplish the following:

    a) I have a strategy based on DAILY bars
    b) I want to enter and order only from 3.30pm EST to 4:00pm EST

    I tried the code below but I get no orders in my backtesting.

    Any ideas?
    Thanks!
    Tex

    ================================================
    Initialize
    Add(PeriodType.Minute, 1);


    CalculateOnBarClose =
    true;

    protectedoverridevoid OnBarUpdate()
    {

    if (BarsInProgress == 0)
    if whateverstrategyIuse = True
    {
    if ((ToTime(Time[0]) >= 153000 && ToTime(Time[0]) < 160000))
    {
    EnterShort(
    1,1,"Short");
    }
    }



    // When the OnBarUpdate() is called from the secondary bar series, do nothing.
    else
    {
    return;
    }
    }


    #2
    If you are applying this to a daily bar then the condition :
    if (BarsInProgress == 0)
    will limit to end of daily bars only...have you tried to change it to 1 to check at end of each end of 1 Min bar ?
    Regards,
    Pablo
    pmaglio
    NinjaTrader Ecosystem Vendor - The Indicator Store

    Comment


      #3
      Thanks for the reply, Pablo.

      Basically I want to have a signal on the daily bar and the order placed at 3.30pm EST (the day after I guess).

      How can I accomplish this?

      Tex

      Comment


        #4
        Tex,

        You can do something like this :
        if (BarsInProgress == 0)
        { do the finished daily bar analysis, set a variable to true if logic result is "do the trade"
        tradeok = true;
        ...
        return;}
        if (BarsInProgress == 1)
        { we are on 1 min finished bar, so...
        if( tradeok && ToTime....) EnterShort(1,1,"Short");
        }
        Regards,
        Pablo
        pmaglio
        NinjaTrader Ecosystem Vendor - The Indicator Store

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        67 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        36 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        59 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X