Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Gap strategy

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

    Gap strategy

    Is there a session open or close variable? or even better a gap recognizer?

    I want to make a simple strategy that fades the opening gap but I can't find a way to look only at the first candle of the open as compared to the last of previous close, take opposite position (fade) and then when reached previous close to close position.

    In addition when the opening gap is >2% I wish to follow and if it is <2% to fade it

    I will use session 09:30-16:15 on TF future

    Any hints on how I could set this up for testing?

    #2
    if (Bars.FirstBarOfSession)

    Would that work?
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      if (Bars.FirstBarOfSession)
      I am afraid this is for people with programing skills. I have just learned the wizard
      Any clues how to do it using the wizard?

      Comment


        #4
        Alexnj,, what did you use in the strategy wiz to keep track of yesterdays close?

        Comment


          #5
          alexnj,

          Unfortunately this cannot be done in the Strategy Wizard.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Anything close to that? How can I assign an opening session bar and a closing session bar? Maybe with time parameters?
            If not in the wizard could anyone make a script for me so I can test it?

            Comment


              #7
              alexnj,

              You can check Time in the Condition Builder time category. If you know a new session starts at 9:30AM for instance you can check for such a timestamp on a bar. Then you will know that that is the start of a new session.

              On the left select Time series. On the right select Time value. On a 1-minute chart, if session begins at 9:30AM, the first bar will be timestamped as 9:31AM. You will want to check for 9:31AM.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Quite helpful but still, on the left time series but what value in bars ago (o, 1 ?)
                then in middle what ==, >,< ??, on the right I understand time value 09:31
                Then to close the trade I need to assign "when reach close of 16:15 previous day" or close to that (to be on the safe side, say 75% of the way to fill)....

                Comment


                  #9
                  Bars ago 0 for the latest bar.
                  == in the middle for equal to.

                  You need to make any additional conditions as a separate condition in the Condition Builder. Any action you want it to do you need to do in the Strategy Action side.

                  Please first review these tutorials on how to use the Strategy Wizard: http://www.ninjatrader-support.com/H...tml?Overview34
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Have read samples didn't gain much-not so detailed. I tried set1: close[0]>close[1] and ToTime[Time[0]]==ToTime[09,30,0] enter short and vice versa for long with profit targets and stop loss as a percentage (to difficult to set when reach previous close for the time being...) but when backtesting no trades at all!

                    Could you help me pls with a simple parameter to test it either send me a file or decribe in more detail.

                    Also I tried optimizing another startegy and used 8 instruments. It has taken already 15 hours and have no clue how much is remaining (the remaining time fluctuates). is there a way to know before hand number of calculations or time required (like with TradeStation for example it says xxxxxx calculations)

                    Thanx a lot in advance

                    Comment


                      #11
                      Where is if (Bars.FirstBarOfSession) found in the wizard, under which categories could you give me a specific example what to use left size, middle and right side?

                      Comment


                        #12
                        is there a way to input user defined values for different time frames (eg 5min, increase to 10,15,30,60 etc) in optimizing parameters? I noticed it only accepts one numerical value so one needs to run the entire optimazation in different time frames...

                        Comment


                          #13
                          Hi alexnj, Bars.FirstBarOfSession is unfortunately not directly available in the wizard - you would have to work with the direct times then (Time series, Time value).

                          Unfortunately you can't optimize the timeframes with the Strategy Analyzer.

                          Please post a screenshot of the exact conditions you have setup in the strategy, or export the file and attach it here, so I can review it.

                          Comment


                            #14
                            I tried to import your gap strategy by import ninjascript archive (.ntns) get message NT requires that you shut down and restart the application to make imported assembly affective but the strategy never shows up under strategies.
                            Although I get after a message that NT successfuly imported all inic//start. contained in the NS file
                            the file you gave me was twgaptrade

                            Comment


                              #15
                              Not sure I follow. I am not aware of giving you any files. If the file was an assembly you will need to restart NinjaTrader for the assembly to be loaded for you to use.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

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