Segnale doppio supertrend

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #158294 quote
    AndreaAndrea
    Participant
    Average

    Vorrei realizzare un indicatore con doppio supertrend (uno veloce uno lento):

    indicator1 = SuperTrend[2,10]
    c1 = (close[1] > indicator1[1])
    indicator2 = SuperTrend[3.5,19]
    c2 = (close[1] > indicator2[1])

    Se le due condizioni sono vere il segnale=1 altrimenti il segnale=0

    IF c1 AND c2 THEN
    segnale=1
    Else
    segnale=0
    endif
    
    Return segnale

    Il problema lo incontro se al posto del grafico del valore del segnale volessi mettere sul grafico la freccia di buy o di sell, non riesco a discriminare tra il segnale buy numero uno e i successivi, mi stampa a video tutte le frecce. Come devo fare? Pensavo di inserire un contatore di segnale ma mi sono arenato.

    #158313 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    E’ nella fase di stampa della freccia che devi discrimare la stampa, in modo da farla quando il segnale è VERO e, contemporanemente, diverso dal PRECEDENTE:

    indicator1 = SuperTrend[2,10]
    c1 = (close[1] > indicator1[1])
    indicator2 = SuperTrend[3.5,19]
    c2 = (close[1] > indicator2[1])
    IF c1 AND c2 THEN
       segnale=1
    Else
       segnale=0
    endif
    IF Segnale = 1 AND (Segnale <> Segnale[1]) THEN
       DrawArrowUP(BarIndex,low - range) coloured(0,200,0,255)
    ENDIF
    Return segnale
    Andrea thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Segnale doppio supertrend


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Andrea @andy60rm Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
5 years, 8 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 01/18/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...