Help for code from pinescript to prorealtime

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #30358 quote
    mexitrader
    Participant
    New

    Please need help to translate from pinescript to prorealcode is a simple code

     

    length1 = input(1)
    length2 = input(24)
    length3 = input(120)
    
    source = close
    osc1 = sma(source, length1) - sma(source, length2)
    osc2 = sma(source, length1) - sma(source, length3)
    
    smooth1 = sma(osc1, input(2))
    smooth2 = sma(osc2, input(24))
    
    //plot(osc, color=gray, style=columns)
    scolor1=smooth1 > smooth1[1] and smooth1 > 0 ? green : 
            smooth1 > smooth1[1] and smooth1 < 0 ? olive : 
            smooth1 < smooth1[1] and smooth1 < 0 ? maroon : 
            smooth1 < smooth1[1] and smooth1 > 0 ? orange : black
    
    scolor2=smooth2 > smooth2[1] and smooth2 > 0 ? green : 
            smooth2 > smooth2[1] and smooth2 < 0 ? olive : 
            smooth2 < smooth2[1] and smooth2 < 0 ? maroon : 
            smooth2 < smooth2[1] and smooth2 > 0 ? orange : black
    
    plot(smooth2, color=scolor2, style=columns, linewidth=1)
    plot(smooth2, color=black, style=line, linewidth=1)
    
    plot(smooth1, color=scolor1, style=histogram, linewidth=2)
    plot(smooth1, color=black, style=line, linewidth=1)
    
    hline(0)
    
    //  ||---   Caps analysis
    upperholder = nz(upper[1])
    lowerholder = nz(lower[1])
    upper = smooth2 >= upperholder ? smooth2 : upperholder
    lower = smooth2 <= lowerholder ? smooth2 : lowerholder
    
    signal1 = cross(smooth2, 0) ? upper : na
    signal2 = cross(smooth1, 0) ? lower : na
    signalcolor1 = smooth2 > 0 ? green : maroon
    signalcolor2 = smooth1 > 0 ? green : maroon
    hidesignals = input(true)
    plot(hidesignals ? na : signal1, style=cross, color=signalcolor1, linewidth=4)
    plot(hidesignals ? na : signal2, style=cross, color=signalcolor2, linewidth=4)
    
    #30468 quote
    Nicolas
    Keymaster
    Master

    What is the name of this indicator? Do you have at least screenshots to see how it looks on a chart? Believe me, it helps me a lot to know how to code it!

    #30509 quote
    mexitrader
    Participant
    New

    Thank you  Nicolas I tried to upload am image but I couldn’t, I will post this again to post the image if it’s ok thanks again

    #30528 quote
    Nicolas
    Keymaster
    Master

    I added your picture to the first post. A description of the indicator maybe? or the original link? I’d like to know what is the original idea behind the code 🙂

    #30538 quote
    mexitrader
    Participant
    New

    Sorry I don’t have the info I’ll try to find the author or the idea behind this

    #30544 quote
    Nicolas
    Keymaster
    Master

    I read the code and this what I understood so far: it’s 2 moving averages differences, smoothed separately with another SMA (just like an old MACD). These 2 curves have different periods to catch the long trend and the short one (this is the 2 black lines). Then histogram are changing their colours, according to their direction: if they are ascending or descending (the 2 MA differences / convergences).

    So to make it brief, this is 2 MACD signal lines made of SMA (instead of EMA), do you still want to translate it?

    #30554 quote
    mexitrader
    Participant
    New

    You’re right I will use MACD

    #30555 quote
    mexitrader
    Participant
    New

    Thanks!!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

Help for code from pinescript to prorealtime


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
mexitrader @mexitrader Participant
Summary

This topic contains 7 replies,
has 2 voices, and was last updated by mexitrader
8 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/30/2017
Status: Active
Attachments: 1 files
Logo Logo
Loading...