Help coding with SuperTrend and Ema

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #120970 quote
    davostrader
    Participant
    New

    Can anyone please help with where I am going wrong. Still new to this. Thank you in advance

    i1 = SuperTrend[3.75,10]
    
    i2 = ExponentialAverage[15](i1)
    
    i3 = (i1 – i1[1])/i1*100
    
    linemid = 0
    
    RETURN i2 coloured(147,112,216) as “EMA”
    
     
    
    IF i1 > i2 and i3 > linemid THEN
    
    DRAWARROWUP(barindex, xlow-.005)
    
    backgroundcolor(204,255,204)
    
     
    
    ELSIF i1 < i2 and i3 < linemid THEN
    
    DRAWARROWDOWN(barindex, xhigh+.005)
    
    backgroundcolor(255,204,204)
    
    ENDIF
    
     
    
    RETURN ST as “Supertrend”
    #120976 quote
    robertogozzi
    Moderator
    Master

    For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<

    Use a more meaningful title, othe than generic help. Thank you. 🙂

    What error have you been reported and what doesn’t it do that you want, instead?

    At first sight there cannot be twice RETURN lines in an indicator, but that should hgave been reported, hasn’t it?

    #120986 quote
    willi
    Participant
    Master

    How are xhigh and xlow defined?
    With this if..then statement no value should be displayed under “linemid”, since Supertrend and EMA always use values over 0.

    If you want to display Supertrend and EMA, it looks like it is displayed.

    i1 = SuperTrend[3.75,10]
    i2 = ExponentialAverage[15](i1)
    i3 = (i1 - i1[1])/i1*100
     
    RETURN i1 as "Supertrend", i2  as "EMA", i3 as "Wert"
    
    robertogozzi thanked this post
    Testindicator.png Testindicator.png
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Help coding with SuperTrend and Ema


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 2 replies,
has 3 voices, and was last updated by willi
5 years, 11 months ago.

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