NexusFi: Find Your Edge


Home Menu

 





Converting 2 RSI Divergence from Tradingview to NT


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Kharmaz with 3 posts (1 thanks)
    2. looks_two TigerStripes with 3 posts (4 thanks)
    3. looks_3 bobwest with 2 posts (0 thanks)
    4. looks_4 SamirOfSalem with 1 posts (0 thanks)
    1. trending_up 2,109 views
    2. thumb_up 5 thanks given
    3. group 4 followers
    1. forum 8 posts
    2. attach_file 4 attachments




 
Search this Thread

Converting 2 RSI Divergence from Tradingview to NT

  #1 (permalink)
Kharmaz
Orlando, FL
 
Posts: 34 since Jun 2014
Thanks Given: 14
Thanks Received: 4

I need help with converting 2 RSI Divergence from Tradingview to TOS and NT8.
Introduced by Shizaru
https://www.tradingview.com/script/fH6e5TuN-RSI-Divergence/

Basically 5 RSI and 14 RSI Divergence. Instead of a line, I need the indicator to print columns, similar to picture.

Attached Thumbnails
Click image for larger version

Name:	Screenshot_20220807-141851~2.png
Views:	78
Size:	82.3 KB
ID:	326280  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
What broker to use for trading palladium futures
Commodities
Trade idea based off three indicators.
Traders Hideout
 
  #2 (permalink)
 TigerStripes   is a Vendor
 
Posts: 109 since Mar 2021
Thanks Given: 33
Thanks Received: 56


Kharmaz View Post
I need help with converting 2 RSI Divergence from Tradingview to TOS and NT8.
Introduced by Shizaru
https://www.tradingview.com/script/fH6e5TuN-RSI-Divergence/

Basically 5 RSI and 14 RSI Divergence. Instead of a line, I need the indicator to print columns, similar to picture.

if you build the indie w a moving average or plotting a line to represent the values NT has a built in indie plot visual combo box and allows you to set the visuals of most histogram values to different plot settings, like a Bar(shown in your image), Block, Box, Cross, Dot, Hash, Horizontal Line, Line, so just create it to use that and set to Bar.

Reply With Quote
Thanked by:
  #3 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,172 since Jan 2013
Thanks Given: 57,515
Thanks Received: 26,292


Giving this thread a bump, if anyone can give @Kharmaz a hand with this indicator request.

Bob.

When one door closes, another opens.
-- Cervantes, Don Quixote
Reply With Quote
  #4 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,172 since Jan 2013
Thanks Given: 57,515
Thanks Received: 26,292

To renew the request, can someone with a knowledge of NT8 give @Kharmaz some help with this indicator?

He does not appear to have programming skills, and basically just needs someone to create the indicator.

Details are in the first post.

Thanks.

Bob.

When one door closes, another opens.
-- Cervantes, Don Quixote
Reply With Quote
  #5 (permalink)
 TigerStripes   is a Vendor
 
Posts: 109 since Mar 2021
Thanks Given: 33
Thanks Received: 56


Kharmaz View Post
I need help with converting 2 RSI Divergence from Tradingview to TOS and NT8.
Introduced by Shizaru
https://www.tradingview.com/script/fH6e5TuN-RSI-Divergence/

Basically 5 RSI and 14 RSI Divergence. Instead of a line, I need the indicator to print columns, similar to picture.

That is something I can try.

I have questions, can you explain the chart. Please post a picture showing the histogram & the corresponding chart.
If you use indies that are best used to reproduce that image or ones that you like, post those or a link to those indies.
My q's here start w Why is there 2 RSI's, one slow & one fast, if you can also add an image showing what part of the image is the RSI 5 & which is the RSI 14 I can attempt to write it. I am able to nest an RSI into momentum indie which reproduces that effect and can do the opposite nesting the momentum in the RSI to show when momentum in RSI shows an Overbought or oversold condition. Still not sure here when the need to have 2 comes into the indie, unless you overlay each and notice convergence, or you just want to display 2 values of the trend to get a confirmed momentum.

Attached Thumbnails
Click image for larger version

Name:	Screenshot_78 (3).png
Views:	67
Size:	57.6 KB
ID:	326747  
Reply With Quote
Thanked by:
  #6 (permalink)
Kharmaz
Orlando, FL
 
Posts: 34 since Jun 2014
Thanks Given: 14
Thanks Received: 4

Hello @TigerStripes
Here is how the RSI Divergence works here. Please read the description by Shizaru on Tradingview.
https://www.tradingview.com/script/fH6e5TuN-RSI-Divergence/

RSI DIVERGENCE is a difference between a fast and a slow RSI . Default values are 5 for the fast one and 14 for the slow one.
signal line: when RSI Divergence cross zero line from bottom to top you get a buy signal (the line become green), vice versa when the RSI Divergence cross zero line in the opposite way you get a sell signal (the line become red)
I need help coding from Tradingvidew to Ninjatrader 8. Instead of a line, I need the indicator to print columns, similar to picture.
Here is the TV code:

study(title="RSI Divergence", shorttitle="RSI Divergence")
src_fast = close, len_fast = input(5, minval=1, title="Length Fast RSI")
src_slow = close, len_slow = input(14,minval=1, title="Length Slow RSI")
up_fast = rma(max(change(src_fast), 0), len_fast)
down_fast = rma(-min(change(src_fast), 0), len_fast)
rsi_fast = down_fast == 0 ? 100 : up_fast == 0 ? 0 : 100 - (100 / (1 + up_fast / down_fast))
up_slow = rma(max(change(src_slow), 0), len_slow)
down_slow = rma(-min(change(src_slow), 0), len_slow)
rsi_slow = down_slow == 0 ? 100 : up_slow == 0 ? 0 : 100 - (100 / (1 + up_slow / down_slow))
//plotfast = plot(rsi_fast, color=blue)
//plotslow = plot(rsi_slow, color=orange)
divergence = rsi_fast - rsi_slow
plotdiv = plot(divergence, color = divergence > 0 ? lime:red, linewidth = 2)
//band1 = hline(70,color=green)
//band0 = hline(30,color=red)
band = hline(0)







Screenshot_20220903-203949~2


Screenshot_20220807-141851_2

Reply With Quote
Thanked by:
  #7 (permalink)
Kharmaz
Orlando, FL
 
Posts: 34 since Jun 2014
Thanks Given: 14
Thanks Received: 4

@TigerStripes just a friendly reminder, any update on the RSI indicator for NT8? Thanks for your help.

Reply With Quote
  #8 (permalink)
 TigerStripes   is a Vendor
 
Posts: 109 since Mar 2021
Thanks Given: 33
Thanks Received: 56

I am unsure myself how two RSI MAs and validate the values they currently are then equate each, show divergences and display each.

I have a few divergence Indies, it will bet show RSI and price divergence
They use as an input data series under an RSI or any indie that can display the divergence between it's values and current price relative to recent swig high and lows.

Reply With Quote
Thanked by:
  #9 (permalink)
 SamirOfSalem   is a Vendor
 
Posts: 74 since Jan 2020
Thanks Given: 23
Thanks Received: 44


Kharmaz View Post
Hello @TigerStripes
Here is how the RSI Divergence works here. Please read the description by Shizaru on Tradingview.
https://www.tradingview.com/script/fH6e5TuN-RSI-Divergence/

RSI DIVERGENCE is a difference between a fast and a slow RSI . Default values are 5 for the fast one and 14 for the slow one.

If the requirement is indeed just a simple subtraction of 2 RSI lines*, see if this works for you:

 
Code
#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Gui.Tools;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion

//This namespace holds Indicators in this folder and is required. Do not change it. 
namespace NinjaTrader.NinjaScript.Indicators
{
	public class fio2RSI : Indicator
	{
		protected override void OnStateChange()
		{
			if (State == State.SetDefaults)
			{
				Description									= @"Enter the description for your new custom Indicator here.";
				Name										= "fio2RSI";
				Calculate									= Calculate.OnBarClose;
				IsOverlay									= false;
				DisplayInDataBox							= true;
				DrawOnPricePanel							= true;
				DrawHorizontalGridLines						= true;
				DrawVerticalGridLines						= true;
				PaintPriceMarkers							= true;
				ScaleJustification							= NinjaTrader.Gui.Chart.ScaleJustification.Right;
				//Disable this property if your indicator requires custom values that cumulate with each new market data event. 
				//See Help Guide for additional information.
				IsSuspendedWhileInactive					= true;
				Slow					= 5;
				Fast					= 14;
				
				AddPlot(new Stroke(Brushes.Orange, 4), PlotStyle.Bar, "Difference");
				AddLine(Brushes.Gray, 0, "Zero line");
			}
			else if (State == State.Configure)
			{
			}
		}

		protected override void OnBarUpdate()
		{
			//Add your custom indicator logic here.
			double fast = RSI(Fast, 3)[0];
			double slow = RSI(Slow, 3)[0];
			
			Difference[0] = fast - slow;
			
			if (Difference[0] > 0)
				PlotBrushes[0][0] = Brushes.Green;
			else
				PlotBrushes[0][0] = Brushes.Red;

		}

		#region Properties
		[NinjaScriptProperty]
		[Range(1, int.MaxValue)]
		[Display(Name="Slow", Order=1, GroupName="Parameters")]
		public int Slow
		{ get; set; }

		[NinjaScriptProperty]
		[Range(1, int.MaxValue)]
		[Display(Name="Fast", Order=2, GroupName="Parameters")]
		public int Fast
		{ get; set; }

		[Browsable(false)]
		[XmlIgnore]
		public Series<double> Difference
		{
			get { return Values[0]; }
		}
		#endregion

	}
}


* Caveat 1: NinjaTrader's built-in RSI indicator has a parameter called "Smoothing". I haven't looked into how it affects the calculations. The default value (if you apply an RSI indie to a chart) is 3, which is what I've hard-coded here in lines 60 and 61.

* Caveat 2: Also, the builti-in RSI plots two curves, one being the RSI and the other being an "Average" of some sort. If you want the calcs to use this "Average" value instead, change lines 60 and 61 to:

 
Code
			double fast = RSI(Fast, 3).Avg[0];
			double slow = RSI(Slow, 3).Avg[0];

Reply With Quote




Last Updated on September 18, 2022


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts