Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can i make Candle(RSI data to Candle)

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

    How can i make Candle(RSI data to Candle)

    region Using declarations
    using System.Windows.Media;
    #endregion

    namespace NinjaTrader.NinjaScript.Indicators
    {
    public class RSICandles : Indicator
    {
    private RSI rsiClose;
    private RSI rsiOpen;
    private RSI rsiHigh;
    private RSI rsiLow;

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Name = "RSICandles";
    Description = "RSI Close 값만 하단 패널에 실시간 업데이트하는 인디케이터";

    IsOverlay = false;
    AddLine(Brushes.White, 70, "Overbought");
    AddLine(Brushes.White, 30, "Oversold");

    AddPlot(Brushes.Yellow, "RSI Close");

    Calculate = Calculate.OnEachTick;
    }
    else if (State == State.DataLoaded)
    {
    rsiClose = RSI(Close, 14, 3);
    rsiOpen = RSI(Open, 14, 3);
    rsiHigh = RSI(High, 14, 3);
    rsiLow = RSI(Low, 14, 3);
    }
    }

    protected override void OnBarUpdate()
    {
    if (CurrentBar < 14) return;

    if (IsValidRSI(rsiClose))
    {
    Values[0][0] = rsiClose[0];
    Print($"Time: {Time[0]} / RSI Close: {rsiClose[0]} / RSI Open: {rsiOpen[0]} / RSI High: {rsiHigh[0]} / RSI Low: {rsiLow[0]}");
    }
    }
    private bool IsValidRSI(RSI rsi)
    {
    return rsi != null && CurrentBar >= 14 && !double.IsNaN(rsi[0]);
    }
    }
    }

    region NinjaScript generated code. Neither change nor remove.

    namespace NinjaTrader.NinjaScript.Indicators
    {
    public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
    {
    private RSICandles[] cacheRSICandles;
    public RSICandles RSICandles()
    {
    return RSICandles(Input);
    }

    public RSICandles RSICandles(ISeries<double> input)
    {
    if (cacheRSICandles != null)
    for (int idx = 0; idx < cacheRSICandles.Length; idx++)
    if (cacheRSICandles[idx] != null && cacheRSICandles[idx].EqualsInput(input))
    return cacheRSICandles[idx];
    return CacheIndicator<RSICandles>(new RSICandles(), input, ref cacheRSICandles);
    }
    }
    }

    namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
    {
    public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
    {
    public Indicators.RSICandles RSICandles()
    {
    return indicator.RSICandles(Input);
    }

    public Indicators.RSICandles RSICandles(ISeries<double> input)
    {
    return indicator.RSICandles(input);
    }
    }
    }

    namespace NinjaTrader.NinjaScript.Strategies
    {
    public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
    {
    public Indicators.RSICandles RSICandles()
    {
    return indicator.RSICandles(Input);
    }

    public Indicators.RSICandles RSICandles(ISeries<double> input)
    {
    return indicator.RSICandles(input);
    }
    }
    }

    #endregion
    ​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--​--
    This is my code get open, close, high, and low of RSI.
    How can i make does Data to Candlestick?
    like https://kr.tradingview.com/script/FLyADZ7C/

    #2
    Hello lme7mint,

    Welcome to the NinjaTrader forums!

    You would need to custom render rectangles as candles in OnRender().

    The 'Spread Indicator With Candlesticks' and 'Advance Decline' indicators have code that custom render rectangles as candles.
    This is a conversion of the Spread Indicator with Candlesticks. Please contact the original author for any questions or comments.

    NYSE Advancing Issues/Declining Issues Uses historical tick data to calculate the ^ADV index minus the ^DECL index to give a simulation of the ^ADD index. Requires a data feed that supports indexes and provides data for the ^ADV (NYSE Advancing Issues) and ^DECL (NYSE Declining Issues). Update June 16th, 2020 &#8211; Corrected stroke attributes to [&#8230;]


    Also, you might be wanting to track the highest ATR, lowest ATR, open ATR, and Close ATR with custom logic. The High as the input series might not be the values you are looking for.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you, Chelsea B.
      But I'm still having trouble making RSI in candle form. If successful, I'll keep posting.​

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      553 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      100 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      543 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      546 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X