Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

!FirstTickOfBar logic OR LostInMyMind

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

    !FirstTickOfBar logic OR LostInMyMind

    First, I havent been able to test this live yet, and I want to know what to test for, but cant logically get my head wrapped around the code (done in notepad). COBC=true. This would be the only part of the code that will be outside of the COBC=true.


    { if ( (!FirstTickOfBar && Position.MarketPosition == MarketPosition.Flat) && (timeSeries[0] >= 1) )
    // Try to go LONG
    { if ( WatchToGoLong == 1 )
    {
    // Enter Long
    if ((iOrderL1 == null && iQuantity1 != 0)
    iOrderL1 = EnterLong(0, iQuantity1, sENTRY1L);
    if ((iOrderL2 == null && iQuantity2 != 0)
    iOrderL2 = EnterLongLimit(0, false, iQuantity2, Close[1], sENTRY2L);
    if ((iOrderL5 == null && iQuantity5 != 0)
    { iOrderL5 = EnterLongLimit(0, true, iQuantity5, Close[1], sENTRY5L);
    Position.AvgPrice = MyEnterP125;
    Print("entry price= "+MyEnterP125);
    }
    return;
    }
    }





    So:: what happens to each of the order samples? IF they are processed on each tick, is the Close[1] correct for target price or should it be Close[0], or GetCurrentAsk(0) .. even though there is a EnterLong() I am trying to stay away from market orders atm, but still need to test.

    Should I use 'true' or 'false' as I am ordering on ticks not bar close?!

    Can you tell this is my first FTOB piece of code?

    TIA!
    Jon

    #2
    Hello,

    Thanks for the forum post.

    You say that your using COBC = True. So lets take a quick step back.

    Are you using COBC = true or false?

    As using COBC = true there is no need to use FirstTickOfBar. This is only valid when you are using COBC = false.


    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Originally posted by NinjaTrader_Brett View Post
      Hello,

      Thanks for the forum post.

      You say that your using COBC = True. So lets take a quick step back.

      Are you using COBC = true or false?

      As using COBC = true there is no need to use FirstTickOfBar. This is only valid when you are using COBC = false.


      Let me know if I can be of further assistance.
      Hi Brett,

      I acknowledge I will have a difficult time explaining this, so I will take a different approach.

      My strategy is based on COBC=true. There are various BIPs and different indicators on each BIP. I dont use [ (BIP != 0) return; ] for a number of reasons that are helpful in the strategy.

      I am trying to have the trade entry to NOT be tied to this COBC=true. I was hoping to use [ if( !FirstTickOfBar && ... ] but as you explained and as I tested, FTOB isnt working at all if COBC=true.

      Can I effectively wrap the trade entry code in { COBC=false exclusive of the rest of the strategy in COBC=true? I am not sure of the outcome, and obviously a limitation that I can only test in RePlay/SIM which means no Strategy Analyzer .

      Wish list == !FTOB works anytime needed

      ThanksIA,
      Jon

      Comment


        #4
        Hello,

        Understand. In fact your statement below is exactly what FTOB is meant to allow you to be able to do. Should have no problem here.

        Can I effectively wrap the trade entry code in { COBC=false exclusive of the rest of the strategy in COBC=true? I am not sure of the outcome, and obviously a limitation that I can only test in RePlay/SIM which means no Strategy Analyzer .


        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        66 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        149 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        99 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        286 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X