If condizionali in un indicatore

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #205319 quote
    andrea trevisanandrea trevisan
    Participant
    Average

    Ho creato un indicatore con tre filtri: Candela Long, Range che attraversa MMA[8], Filtro di volatilità : Il range deve essere maggiore della media del range delle ultime 5 candele.

    Allego il codice vorrei, se possibile, avere un controllo se è strutturato bene ho migliorabile, ho usato dei cicli “if condizionali”, forse ho solo complicato le cose.

    // Pulisci programma
    result = 0

    // filltro range che attraversa  media esponenziale [8]
    MMA = ExponentialAverage[8](close)
    c1 = MMA < High
    c2 = MMA > low
    Filtro = c1 and c2

    //Filtro di volatilità

    Espansione = range > average[5,0](range[1])

    // Se validati i miei filtri cerco candela Long (buy o sell)

    If Espansione then
    If Filtro  then
    corpo = abs(close-open)
    corpomedio = average[20](corpo)
    ampia = corpo > (corpomedio * Forzalong) // Forzalong non è nel codice perché e una variabile modificabile
    Long = ampia and (close > open)// Rialzista
    Short = ampia and (close < open)// Ribassista
    if long then
    result = 1
    elsif short then
    result = -1
    else
    result = 0
    endif
    endif
    endif
    return result ,0

    #205320 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Le righe 27 e 28 puoi toglierle, in quanto c’è già la riga 2 che azzera il risultato ad ogni nuova candela.

    A parte questo (comunque ininfluente), mi sembra tutto corretto. Non mi pare ci siano altre cose da rilevare.

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

If condizionali in un indicatore


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
Summary

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

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 12/06/2022
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...