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 RubenCazorla, Today, 09:07 AM
    2 responses
    13 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by i019945nj, 12-14-2023, 06:41 AM
    7 responses
    82 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by timmbbo, 07-05-2023, 10:21 PM
    4 responses
    158 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by tkaboris, Today, 08:01 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by Lumbeezl, 01-11-2022, 06:50 PM
    31 responses
    820 views
    1 like
    Last Post NinjaTrader_Adrian  
    Working...
    X