Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

inside bar

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

    inside bar

    I am looking for an inside bar strategy...

    Basically:

    - Check (current bar low > previous bar low) AND (current bar high < previous bar high)
    - If true either

    go long current bar high + 1, stop loss current bar low -1

    Or
    go short current bar low -1, stop loss current bar high + 1

    thanks

    #2
    Hello,

    You can implement this as an inside-bar strategy by adding a secondary data series with a lower-timeframe interval, then testing its highs and lows against the highs and lows of the previous higher-timeframe bar. For example, you might do something like this for entries:

    Code:
     protected override void Initialize()
            {
                CalculateOnBarClose = true;
    	    Add(PeriodType.Minute,1);
            }
    
            protected override void OnBarUpdate()
            {
    			if(BarsInProgress == 1)
    			{
    				if(Highs[1][0] > Highs[0][1])
    				{
    					//entry order
    				}
    			}
            }
    For exits, you can use the SetStopLoss() overload below, set the calculation mode to Price, then pass in Lows[0][0] +/- TickSize:

    Code:
    SetStopLoss(CalculationMode mode, double value)
    For more information, please see the links below:

    BarsInProgress: http://www.ninjatrader.com/support/h...inprogress.htm

    Highs: http://www.ninjatrader.com/support/h...html?highs.htm

    SetStopLoss: http://www.ninjatrader.com/support/h...etstoploss.htm

    Reference Sample: http://www.ninjatrader.com/support/f...ead.php?t=5787

    Please let me know if I can assist further.
    Dave I.NinjaTrader Product Management

    Comment


      #3
      Hello,

      I'd like to make a quick note. My previous reply was assuming that you were looking for a intra-bar execution on this strategy. If you are just looking for an "inside bar" candlestick pattern, then you would not need to use the secondary timeframe. You could just use High[] and Low[], like so:

      Code:
      if(High[0] < High[1] && Low[0] > Low[1])
      The exit logic would be the same as my previous post.
      Dave I.NinjaTrader Product Management

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      267 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      169 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      171 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      260 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      210 views
      0 likes
      Last Post CarlTrading  
      Working...
      X