Conversion of SP Indicator useThinkScript community page

Forums ProRealTime English forum ProBuilder support Conversion of SP Indicator useThinkScript community page

Viewing 5 posts - 1 through 5 (of 5 total)
  • #243630

    #// Indicator for TOS
    #// © Smoker024
    #indicator(“SP Indicator”, overlay=true)
    # Converted by Sam4Cok@Samer800 – 10/2024

    input showBands = yes;
    input source = close;
    input lookback = 60;
    input multi = 0.2;

    def na = Double.NaN;
    def exitLength = RoundUp(lookback / 4, 0);

    Script ma {
    input src = close;
    input len = 15;
    def sqLen = Round(sqrt(len), 0);
    def wma1 = wma(src, len);
    def wma2 = wma(src, len / 2);
    def ma = wma(2 * wma2 – wma1, sqLen);
    plot out = ma;
    }
    def tr = TrueRange(high, close, low);
    def BBMC = ma(source, lookback);
    def rangema = ExpAverage(tr, lookback);
    def upperk =BBMC + rangema * multi;
    def lowerk = BBMC – rangema * multi;
    def col = if source > upperk then 1 else if source < lowerk then -1 else 0;

    def ExitHigh = ma(high, exitLength);
    def ExitLow = ma(low, exitLength);
    def Hlv3 = if source > ExitHigh then 1 else if source < ExitLow then -1 else Hlv3[1];
    def sslExit = if Hlv3 < 0 then ExitHigh else ExitLow;
    def base_cross_Long = (close > sslExit) and (close[1] <= sslExit[1]);
    def base_cross_Short = (sslExit > close) and (sslExit[1] <= close[1]);
    def codiff = if base_cross_Long then 1 else if base_cross_Short then -1 else 0;

    plot ExitArrowUp = if codiff>0 then low else na;
    plot ExitArrowDn = if codiff<0 then low else na;
    plot maTrendLine = BBMC; # ‘MA Trendline’
    plot limitUp = if showBands then upperk else na;
    plot limitDn = if showBands then lowerk else na;

    maTrendLine.SetLineWeight(2);
    maTrendLine.AssignValueColor(if col>0 then Color.CYAN else if col<0 then Color.MAGENTA else Color.GRAY);
    limitUp.AssignValueColor(if col>0 then Color.CYAN else if col<0 then Color.MAGENTA else Color.GRAY);
    limitDn.AssignValueColor(if col>0 then Color.CYAN else if col<0 then Color.MAGENTA else Color.GRAY);
    ExitArrowUp.SetDefaultColor(Color.CYAN);
    ExitArrowDn.SetDefaultColor(Color.MAGENTA);
    ExitArrowUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
    ExitArrowDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

    Plots Up and Down arrows

     

    Variable options:

    #243635
    #243731

    Here it is:

    1 user thanked author for this post.
    #243736

    I took the liberty of making a few changes to it, in order to make it little bit faster… at least i tried 🙂

    #243765

    Sorry for the delay in replying, but Thank you! Both look fantastic!

Viewing 5 posts - 1 through 5 (of 5 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login