Thinkorswim Thinkscript Studies

Useful thinkscript studies to earn more money in trading
Menu
  • Home

Join Us Now for Free
Home
Home

Home

  • Dual Moving Average Upper
    Dual Moving Average Upper

    Study which shows you which direction the price movement is going to go in very quick way. This indicator has helped me to a great extent

    ## This study adjusts the StanL study noted i the header below. 
    ## In particular it replaces arrows which only pointed upward with arrows  
    ## identifying the direction of the cross 
    # Dual Moving Averages with clouds and cross arrows 
    #Labels added by SFL 
    #TOS Title = CloudBetween2MovingAverages 
    #hint:Cloud usage between two moving averages 
    declare upper; 
    #  Input Code 
    input price = close;#hint close:Select the price of choice 
    input fastLength = 8;#hint fastLength:The fast average length 
    input fastAvgType = AverageType.SIMPLE;#hint fastAvgType:Select the average type 
    input slowLength = 20;#hint slowLength:The slow average length 
    input slowAvgType = AverageType.SIMPLE; #hint slowAvgType:Select the average type 
    input Show_Crosses = YES;#hint Show_Crosses:Toggles crossing arrows ON/OFF 
    #  Moving Average Plot Code 
    plot FastMva = MovingAverage( fastAvgType, price, fastLength ); 
    plot SlowMva = MovingAverage( slowAvgType, price, slowLength ); 
    #  Cloud Code 
    AddCloud( FastMva, SlowMva, Color.YELLOW, Color.RED ); 
    #  Crossing Code 
    def CrossUp =  if Crosses(FastMva, SlowMva, CrossingDirection.above) then 1 else 0; 
    Plot UpArrow = If CrossUp && Show_Crosses then low else double.nan; 
    UpArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); 
    UpArrow.SetLineWeight(3); 
    UpArrow.SetDefaultColor(Color.GREEN); 
    def CrossDown =  if Crosses(FastMva, SlowMva, CrossingDirection.below) then 1 else 0; 
    Plot DownArrow = If CrossDown && Show_Crosses then high else double.nan; 
    DownArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); 
    DownArrow.SetLineWeight(3); 
    DownArrow.SetDefaultColor(Color.RED); 
    #  Label Code 
    #AddLabel(Show_Crosses,"Cross = UP ARROW",color.PINK); 
    addlabel(1,"Slow MA(" +  slowLength  + ") is " +  (If fastAvgType == AverageType.EXPONENTIAL then "Exponential average"  
    else if  fastAvgType == AverageType.Hull then "Hull average"  
    else if fastAvgType == AverageType.simple then "Simple average" 
    else if fastAvgType == AverageType.wilders then "Wilders average" 
    else if fastAvgType == AverageType.weighted then "Weighted average" 
    else "")   ,color.cyan); 
    addlabel(1,"Fast MA(" +  fastLength  + ") is " +  (If slowAvgType == AverageType.EXPONENTIAL then "Exponential average"  
    else if  slowAvgType == AverageType.Hull then "Hull average"  
    else if slowAvgType == AverageType.simple then "Simple average" 
    else if slowAvgType == AverageType.wilders then "Wilders average" 
    else if slowAvgType == AverageType.weighted then "Weighted average" 
    else "")   ,color.pink); 
    # end 
    July 1, 2022
    Trend
    moving average
  • Colored Moving Average Lines
    Colored Moving Average Lines

    Here’s a real simple script that will plot the moving average of your choice with the color of the line based on the slope of the line. If you want different colors, just change the two color constants in the line of code:

    ave.AssignValueColor(if ave > ave[1] then color.cyan else color.dark_red);

    Read more: Colored Moving Average Lines
    # TS_MOVINGAVERAGE 
    # http://www.thinkscripter.com 
    # thinkscripter@gmail.com 
    # Last Update 15 MAR 2009 
    input displace = 0; 
    input length = 9; 
    input price = close; 
    input movingAverageType = {default Simple, Exponential, Weighted, Hull, Variable}; 
    rec data; 
    switch (movingAverageType) { 
    case Simple: 
        data = compoundValue(1, Average(price[-displace], length), price); 
    case Exponential: 
        data = compoundValue(1, ExpAverage(price[-displace], length), price); 
    case Weighted: 
        data = compoundValue(1, wma(price[-displace], length), price); 
    Case Hull: 
        data = compoundValue(1, hullMovingAvg(price[-displace], length), price); 
    case variable: 
        data = VariableMA(price=price, length=length); 
    } 
    plot ave = data; 
    ave.SetLineWeight(2); 
    ave.AssignValueColor(if ave > ave[1] then color.cyan else color.dark_red); 
    ave.HideBubble(); 
    #---------------- End Of Code ----------------
    June 29, 2022
    Trend
    moving average
  • ALMA Strategy
    ALMA Strategy

    ALMA Strategy gives the buy and sell signal and it worked great, attaching the results for the samebelow

    Read more: ALMA Strategy
    # ALMA (Arnaud Legoux Moving Average) 
    # ALMA is based on a shifted Gaussian distribution  
    # Mobius 
    # Chat Room Request 
    # ALMA color change added by ZupDog 
    input offset = 2; #default was 2 
    input sigma = .5; 
    input length = 8; 
    plot alma_ = (fold n = 0 to length 
                  with s 
                  do s + getValue(Exp(-Power(n - Floor(offset * length), 2)/ 
                                 (2 * Power((length + 1) / sigma, 2)))*  
                         getValue(close, n), n, length)) /  
                  fold nn = 0 to length  
                  with ss  
                  do ss + getValue(Exp(-Power(nn - Floor(offset * length), 2)/ 
                                  (2 * Power((length + 1) / sigma, 2))), nn); 
    alma_.DefineColor("Up", color.LIME); 
    alma_.DefineColor("Down", color.PINK); 
    alma_.AssignValueColor(if alma_ > alma_[1] then alma_.color("Up") else alma_.color("Down")); 
    alma_.setLineWeight(3); 
    # End Code ALMA 
    def LongEntry = alma_ > alma_[1]; 
    def longExit = alma_ < alma_[1]; 
    addOrder(OrderType.BUY_TO_OPEN, longEntry, price = OPEN[-1]); 
    addOrder(orderType.SELL_TO_CLOSE, longexit, price = OPEN[-1]); 
    June 26, 2022
    Trend
    ALMA
  • Adaptive Gaussian Moving Average Bands
    Adaptive Gaussian Moving Average Bands

    # Designed to achieve Normal Distribution across all aggregations and instruments
    # Mobius
    # V02.02.2019
    #Hint: Plots a Gaussian Mean with Standard deviation Envelope. If Normal Distribution is met, then at minimum, 68.2% of the close values should be inside a One Standard Deviation Envelope and 95.4% of the close values should be inside a 2 Standard Deviation Envelope.

    May 19, 2022
    Trend
  • 3rd Order Polynomial Thinkscripts
    3rd Order Polynomial  Thinkscripts

    Script only works on a 100 or less bars and don’t fed it with full long timeseries .There are three inputs. the sample length, the “y” which is currently the “close” and there is also “def x = data” string…you can put there just anything as a regressor.

    Read more: 3rd Order Polynomial Thinkscripts
    #VM_3rd_Order_Polynomial 
    #gRowEx 
    input n = 50; 
    input y = close; 
    # y=ax^3+bx^2+cx+d 
    script matrix_3x3 { 
        input a11 = 0; 
        input a12 = 0; 
        input a13 = 0; 
        input a21 = 0; 
        input a22 = 0; 
        input a23 = 0; 
        input a31 = 0; 
        input a32 = 0; 
        input a33 = 0; 
        plot delta = a11 * a22 * a33 + a12 * a23 * a31 + a13 * a21 * a32 - (a13 * a22 * a31 + a12 * a21 * a33 + a11 * a23 * a32); 
    } 
    script matrix_4x4 { 
        input a11 = 0; 
        input a12 = 0; 
        input a13 = 0; 
        input a14 = 0; 
        input a21 = 0; 
        input a22 = 0; 
        input a23 = 0; 
        input a24 = 0; 
        input a31 = 0; 
        input a32 = 0; 
        input a33 = 0; 
        input a34 = 0; 
        input a41 = 0; 
        input a42 = 0; 
        input a43 = 0; 
        input a44 = 0; 
        plot delta = a31 * matrix_3x3(a12, a13, a14, a22, a23, a24, a42, a43, a44) - a32 * matrix_3x3(a11, a13, a14, a21, a23, a24, a41, a43, a44) + a33 * matrix_3x3(a11, a12, a14, a21, a22, a24, a41, a42, a44) - a34 * matrix_3x3(a11, a12, a13, a21, a22, a23, a41, a42, a43); 
        ; 
    } 
    #the equations 
    #a∑x3i+b∑x2i+c∑xi+nd=∑yi, 
    #a∑x4i+b∑x3i+c∑x2i+d∑xi=∑xiyi, 
    #a∑x5i+b∑x4i+c∑x3i+d∑x2i=∑x2iyi, 
    #a∑x6i+b∑x5i+c∑x4i+d∑x3i=∑x3iyi; 
    #======================= 
    input fb = 1; 
    def bar = if barnumber()>=fb then bar[1]+1 else 0; 
    def x = bar; 
    def sx3 = Sum(Power(x, 3), n); 
    def sx2 = Sum(Sqr(x), n); 
    def sx = Sum(x, n); 
    def sx4 = Sum(Power(x, 4), n); 
    def sx5 = Sum(Power(x, 5), n); 
    def sx6 = Sum(Power(x, 6), n); 
    def sy = Sum(y, n); 
    def sxy = Sum(x * y, n); 
    def sx2y = Sum(Sqr(x) * y, n); 
    def sx3y = Sum(Power(x, 3) * y, n); 
    #======================== 
    #rewrite the equations with the inputs 
    #======================== 
    # sx3 sx2 sx   n  | a | sy 
    # sx4 sx3 sx2 sx  | b | sxy 
    # sx5 sx4 sx3 sx2 | c | sx2y 
    # sx6 sx5 sx4 sx3 | d | sx3y 
    #считаем определитель 
    def delta = matrix_4x4(sx3, sx2, sx, n, sx4, sx3, sx2, sx, sx5, sx4, sx3, sx2, sx6, sx5, sx4, sx3); 
    def delta_a = matrix_4x4(sy, sx2, sx, n, sxy, sx3, sx2, sx, sx2y, sx4, sx3, sx2, sx3y, sx5, sx4, sx3); 
    def delta_b = matrix_4x4(sx3, sy, sx, n, sx4, sxy, sx2, sx, sx5, sx2y, sx3, sx2, sx6, sx3y, sx4, sx3); 
    def delta_c = matrix_4x4(sx3,sx2,sy,n,sx4,sx3,sxy,sx,sx5,sx4,sx2y,sx2,sx6,sx5,sx3y,sx3); 
    def delta_d = matrix_4x4(sx3,sx2,sx,sy,sx4,sx3,sx2,sxy,sx5,sx4,sx3,sx2y,sx6,sx5,sx4,sx3y); 
    def a = delta_a/delta; 
    def b = delta_b/delta; 
    def c = delta_c/delta; 
    def d = delta_d/delta; 
    plot eq = a*power(x,3)+b*sqr(x)+c*x+d; 
    May 19, 2022
    Trend
Share
Tweet
Pinterest
Reddit
Linkedin

Categories

  • Trend (5)

Thinkorswim Thinkscript Studies

Useful thinkscript studies to earn more money in trading
Copyright © 2023 Thinkorswim Thinkscript Studies
Theme by MyThemeShop.com

Ad Blocker Detected

Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Refresh
Go to mobile version
 

Loading Comments...