NexusFi: Find Your Edge


Home Menu

 





Is MC. NET RSI CORRECT?


Discussion in MultiCharts

Updated
    1. trending_up 1,269 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

Is MC. NET RSI CORRECT?

  #1 (permalink)
alex27
Surrey - UK
 
Posts: 41 since Sep 2015
Thanks Given: 12
Thanks Received: 8

Hi There,

I have based a strategy off RSI in the think or swim platform, moving over to automation with mc.net but im not sure if these 2 RSI's formulas are the same.

Feedback be great thanks,
RSI CALCULATION



THINK OR SWIM - (CORRECT ONE WHICH STRATEGY IS BASED OFF)





declare lower;



input length = 14;

input over_Bought = 70;

input over_Sold = 30;

input price = close;

input averageType = AverageType.WILDERS;



def NetChgAvg = MovingAverage(averageType, price - price[1], length);

def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);

def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;



plot RSI = 50 * (ChgRatio + 1);

plot OverSold = over_Sold;

plot OverBought = over_Bought;



RSI.DefineColor("OverBought", GetColor(5));

RSI.DefineColor("Normal", GetColor(7));

RSI.DefineColor("OverSold", GetColor(1));

RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));

OverSold.SetDefaultColor(GetColor(8));

OverBought.SetDefaultColor(GetColor(8));



























MC.NET RSI CODE



using System;

using System.Drawing;



namespace PowerLanguage.Indicator

{

public class RSI : IndicatorObject

{

private Function.RSI m_rsi1;



private VariableSeries<Double> m_myrsi;



private IPlotObject Plot1;



private IPlotObject Plot2;



private IPlotObject Plot3;



public RSI(object ctx) :

base(ctx){

overbcolor = Color.Red;

overscolor = Color.Cyan;

overbought = 70;

oversold = 30;

length = 14;

}



[Input]

public int length { get; set; }



[Input]

public double oversold { get; set; }



[Input]

public double overbought { get; set; }



[Input]

public Color overscolor { get; set; }



[Input]

public Color overbcolor { get; set; }



protected override void Create(){

m_rsi1 = new Function.RSI(this);

m_myrsi = new VariableSeries<Double>(this);

Plot1 =

AddPlot(new PlotAttributes("RSI", 0, Color.Silver,

Color.Empty, 0, 0, true));

Plot2 =

AddPlot(new PlotAttributes("OverBot", 0, Color.Green,

Color.Empty, 0, 0, true));

Plot3 =

AddPlot(new PlotAttributes("OverSld", 0, Color.Green,

Color.Empty, 0, 0, true));

}



protected override void StartCalc(){

m_rsi1.price = Bars.Close;

m_rsi1.length = length;

}





protected override void CalcBar(){

m_myrsi.Value = m_rsi1[0];

Plot1.Set(0, m_myrsi.Value);

Plot2.Set(0, overbought);

Plot3.Set(0, oversold);

if (PublicFunctions.DoubleGreater(m_myrsi.Value, overbought)){

Plot1.Colors[0] = overbcolor;

}

else{

if (PublicFunctions.DoubleLess(m_myrsi.Value, oversold)){

Plot1.Colors[0] = overscolor;

}

}

if (this.CrossesOver(m_myrsi, oversold)){

Alerts.Alert("Indicator exiting oversold zone");

}

else{

if (this.CrossesUnder(m_myrsi, overbought)){

Alerts.Alert("Indicator exiting overbought zone");

}

}

}

}

}

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
Better Renko Gaps
The Elite Circle
What broker to use for trading palladium futures
Commodities
 
  #2 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


alex27 View Post
I have based a strategy off RSI in the think or swim platform, moving over to automation with mc.net but im not sure if these 2 RSI's formulas are the same.

This isn't something that we can compare given the use of proprietary functions by both platforms. Have you tried outputting the computed data from each platform and compare the RSI scripts that way?

Reply With Quote
  #3 (permalink)
alex27
Surrey - UK
 
Posts: 41 since Sep 2015
Thanks Given: 12
Thanks Received: 8


Yes got it roughly working the same now

Reply With Quote




Last Updated on March 8, 2016


© 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