Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

RSI strategy optimization

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

    RSI strategy optimization

    Hello,

    I am trying to run a strategy optimization based on the Relative Strength Index. Once the index is above the Overbought line, the strategy closes my long position. I would like to be able to optimize this strategy by waiting to see if the instrument goes further up another 10 points, 20, 30, and so forth, once it crosses the overbought line, instead of just closing the position when it crosses the first time.

    At the moment, my NinjaScript Editor has a condition where if RSI >= Overbought, then close long position. How could I set up my strategy to have it place an order at the closing price + X aditional points once the RSI is over, and have the backtest continue whether the order was filled or not?

    An help will be greatly appreciated.

    Best regards,

    Danny Lei

    #2
    Hello Danny Lei,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    You would create a user defined parameter that would be used in the condition as the following:
    Code:
    			if(RSI(12, 1)[0] >= Overbought + TickSize*(offSet * (Instrument.MasterInstrument.PointValue / (Instrument.MasterInstrument.PointValue * TickSize))))
    			{
    				// do something
    			}
    Where offSet is your user defined parameter that can be optimized. For more information please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=5782

    The equation I use, TickSize*(offSet * (Instrument.MasterInstrument.PointValue / (Instrument.MasterInstrument.PointValue * TickSize))), takes the value of the point and divides it by the tick size to get the value per tick, then we divide the point value by the tick value to determine the ticks per point, and finally multiply our offSet value by the ticks per point and then multiply again by the tick size to get the desired offset based on the point value.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    65 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    41 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    23 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    26 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    52 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X