Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SampleEnterOnceExitEveryTick

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

    SampleEnterOnceExitEveryTick

    I have some doubts in this sample strategy,

    I don't get if (Historical) return; Wha does this part of the code mean?

    The other thing I don't understand is the meaning of FirstTickOfBar, Wouldn't be the same if we just write if Position.MarketPosition==MarketPosition.Flat??

    Thanks

    Daniel

    #2
    Hi Daniel,

    I don't get if (Historical) return; Wha does this part of the code mean?
    This is used to enforce "real time only" operation of the script. If the bar is historical, then it returns out of OnBarUpdate, preventing any further processing. It only processes if the bars are real time.

    The other thing I don't understand is the meaning of FirstTickOfBar, Wouldn't be the same if we just write if Position.MarketPosition==MarketPosition.Flat??
    This property identifies the first tick of each bar. It's only true for the first tick of each bar and all subsequent ticks for this bar would return false. It is not connected in any way to position updating in a strategy.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply,

      So every strategy using tick information must be run in real-time, is that correct? If I make a backtest, wouldn't I have any results?

      One mpre thing I forgot, in SMA, if I don't specify Close,High, Low, Open, which one takes into account? For example SMA(10)

      Daniel

      Comment


        #4
        Correct -- There is no tick by tick sequencing that can distinguish a first tick of bar in a backtest. But for historical (Backtest) bars, FirstTickOfBar will always be true.

        It's the if (Historical) return; part that would make this not work in a backtest.

        The default input for SMA is Close.
        Last edited by NinjaTrader_RyanM1; 11-22-2011, 12:08 PM.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          where to find the "SampleEnterOnceExitEveryTick" strategy

          Hi guys,

          Just wondering where to find the "SampleEnterOnceExitEveryTick" strategy....

          I can't seem to find it anywhere in the forums.

          Cheers.

          Comment


            #6
            Hi Zigman,

            That sample is available here for separating logic to calculate on bar close or each bar update:
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            581 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            337 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            552 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X