Tradingview RSI code to Thinkscript - ThinkOrSwim | futures io social day trading
futures io futures trading


Tradingview RSI code to Thinkscript
Updated: Views / Replies:79 / 2
Created: by kris00l Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Tradingview RSI code to Thinkscript

  #1 (permalink)
Trading Apprentice
Plainsboro, NJ USA
 
Trading Experience: None
Platform: TOS
Favorite Futures: stocks
 
Posts: 1 since Dec 2018
Thanks: 0 given, 0 received

Tradingview RSI code to Thinkscript

Can you please help me to figure out Tradingview RSI code to Thinkscript?

Thanks

Reply With Quote
 
  #2 (permalink)
Elite Member
Trubchevsk
 
Trading Experience: Beginner
Platform: tos
Favorite Futures: stocks
 
Posts: 59 since May 2011
Thanks: 38 given, 74 received


kris00l View Post
Can you please help me to figure out Tradingview RSI code to Thinkscript?

Thanks


here's mine version. not tradingview's one

 
Code
declare lower;
input length = 14;
input os = 10;
input ob = 90;
def gain = if close > close[1] then close - close[1] else 0;
def loss = if close < close[1] then close[1] - close else 0;
def firstgain = Sum(gain, length) / length;
def firstloss = Sum(loss, length) / length;
def avgain = (firstgain[1] * (length - 1) + gain) / length;
def avloss = (firstloss[1] * (length - 1) + loss) / length;
def rs = avgain / avloss;
plot overbought = ob;
plot oversold = os;
plot rsi = 100 - (100 / (1 + rs));

Reply With Quote
 
  #3 (permalink)
Trading Apprentice
Los Angeles, United States
 
Trading Experience: None
Platform: ToS
 
Posts: 13 since Dec 2018
Thanks: 0 given, 0 received


This is the one im using

 
Code
RSI divergence, by Mobius 

 

 

declare lower;  

 

input nRSI = 5; #hint nRSI: RSI periods  

input nTrend = 100; #hint nTrend: RSI Trend Line periods  

input over_Bought = 70; #hint over_Bought: Over Bought Line  

input over_Sold = 30; #hint over_Sold: Over Sold Line  

input MidLine = 50; #hint MidLine: MidLine  

input TrendLine = {EMA, SMA, default LRL, WMA};  

input AlertOn = yes;  

 

def o = open;  

def h = high;  

def l = low;  

def c = close;  

def NetChgAvg = WildersAverage(c - c[1], nRSI);  

def TotChgAvg = WildersAverage(AbsValue(c - c[1]), nRSI);  

def ChgRatio = if TotChgAvg != 0  

                           then NetChgAvg / TotChgAvg  

                           else 0;  

 

plot RSI = 50 * (ChgRatio + 1);  

plot OverSold = over_Sold;  

plot OverBought = over_Bought;  

plot RSItrend;  

 

switch (TrendLine) {  

case EMA:  

        RSItrend = ExpAverage(RSI, nTrend);  

case SMA:  

        RSItrend = Average(RSI, nTrend);  

case LRL:  

        RSItrend = InertiaAll(RSI, nTrend);  

case WMA:  

        RSItrend = WMA(RSI, nTrend);  

}  

 

def lowestLow = if RSI > over_Sold  

                              then l  

                              else if RSI < over_Sold and l < lowestLow[1]  

                                      then l  

                                     else lowestLow[1];  

def lowestRSI = if RSI > MidLine  

                            then RSI  

                            else if RSI < MidLine and RSI < lowestRSI[1]  

                                    then RSI  

                                    else lowestRSI[1];  

def divergentLow = if RSI < over_Sold and l <= lowestLow[1] and RSI > lowestRSI[1]  

                                   then over_Sold  

                                   else Double.NaN;  

 

plot DLow = divergentLow;  

        DLow.SetPaintingStrategy(PaintingStrategy.POINTS);  

        DLow.SetLineWeight(2);  

        DLow.SetDefaultColor(Color.YELLOW);  

 

def highestHigh = if RSI < over_Bought  

                               then h  

                               else if RSI > over_Bought and h > highestHigh[1]  

                                       then h  

                                      else highestHigh[1];  

def highestRSI = if RSI < MidLine  

                             then RSI  

                             else if RSI > MidLine and RSI > highestRSI[1]  

                                     then RSI  

                                     else highestRSI[1];  

def divergentHigh = if RSI > over_Bought and h >= highestHigh and RSI < highestRSI  

                                    then over_Bought  

                                   else if RSI < over_Bought and c < o  

                                           then Double.Nan  

                                           else divergentHigh[1];  

 

plot DHigh = divergentHigh;  

        DHigh.SetPaintingStrategy(PaintingStrategy.POINTS);  

        DHigh.SetLineWeight(2);  

        DHigh.SetDefaultColor(Color.YELLOW);  

 

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(Color.BLUE);  

OverBought.SetDefaultColor(Color.BLUE);  

 

def AlertCond1 = RSI crosses RSItrend;  

 

# Alert(AlertCond1, "RSI crossed RSI Trend Line", Alert.Bar, Sound.Bell);  

 

# End Code Wilders RSI with Divergence

Reply With Quote

Reply



futures io > > > > Tradingview RSI code to Thinkscript

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

Battlestations! Show us your trading desks w/GFF Brokers ($750 in Prizes)

January
 

Trading Preparedness w/GFF Brokers

Jan 22
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
TradingView cloud based software steve2222 Platforms and Indicators 37 May 23rd, 2018 04:17 PM
Convert ThinkScript to ThinkScript API t0757tlr ThinkOrSwim Programming 0 May 20th, 2018 12:09 PM
Converting EasyLanguage Code to Thinkscript Code (TOS) joeking ThinkOrSwim 2 November 21st, 2017 09:04 AM
How to plot the previous 20 period RSI(9) high overlay on current RSI(9)? kaysonchan AmiBroker 5 February 23rd, 2016 12:48 PM
RSI - Thinkscript question... netarchitech ThinkOrSwim 2 January 12th, 2015 10:31 PM


Tags
code, divergence, ema, rsi, sma, thinkorswim, thinkscript, tos, tradingview, trend, trend line, trendline, trendlines

All times are GMT -4. The time now is 02:25 AM. (this page content is cached, log in for real-time version)

Copyright © 2019 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business, info@futures.io
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.
no new posts
Page generated 2019-01-20 in 0.16 seconds with 14 queries on phoenix