Filtro su codice per ricerca pattern candela

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

    Ho costruito un indicatore che mi individua tre tipi differenti di candele e mi distingue se sono rialziste o ribassiste, funziona correttamente, però volevo creare un filtro che le candele sono valide solo se una media mobile esponenziale 8 periodi eattraversa il “range” della candela.

    Ho creato la condizione  e ho messo un If then che comprendesse al suo interno tutti le condizioni delle candele ricercate però ho dei falsi segnali ti metto il codice dell’indicatore che funziona e quello col filtro che non funziona.

    Codice indicatore ricerca candele.

    // candela Long
    corpo = abs(close-open)
    corpomedio = average[20](corpo)
    ampia = corpo > (corpomedio * ForzaLong)
    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
    // Engulfing
    Bearish = CLOSE[1] > OPEN[1] AND OPEN >= CLOSE[1] AND CLOSE < OPEN[1] // Engulfing Bearish
    Bullish = CLOSE[1] < OPEN[1] AND OPEN <= CLOSE[1] AND CLOSE > OPEN[1] // Engulfing Bullish
    if Bullish then
    result2 = 1
    elsif Bearish then
    result2 = -1
    else
    result2 = 0
    endif
    //Doji
    Shootingstar = range > abs(open – close)*4 and close < (low + high)/2 //Shootingstar
    Hammer = range > abs(open – close)*4 and close > (low + high)/2 // Hammer
    if Hammer then
    result3 = 1
    elsif Shootingstar then
    result3 = -1
    else
    result3 = 0
    endif
    return result as “long”,result2 as “Engulfing”, result3 as “Doji”,

    Codice con filtro che dà falsi segnali

    MMA = ExponentialAverage[8](close) //qui ho creato la condizione che mi dice che MMA deve essere all’interno del range della candela chiamato “FILTRO”
    c1 = MMA < High
    c2 = MMA > low
    Filtro = c1 and c2
    if Filtro then// qui ho messo un ciclo “IF THEN”  su “FILTRO” che comprende tutte le candele 
    // candela Long
    corpo = abs(close-open)
    corpomedio = average[20](corpo)
    ampia = corpo > (corpomedio * ForzaLong)
    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
    // Engulfing
    Bearish = CLOSE[1] > OPEN[1] AND OPEN >= CLOSE[1] AND CLOSE < OPEN[1] // Engulfing Bearish
    Bullish = CLOSE[1] < OPEN[1] AND OPEN <= CLOSE[1] AND CLOSE > OPEN[1] // Engulfing Bullish
    if Bullish then
    result2 = 1
    elsif Bearish then
    result2 = -1
    else
    result2 = 0
    endif
    //Doji
    Shootingstar = range > abs(open – close)*4 and close < (low + high)/2 //Shootingstar
    Hammer = range > abs(open – close)*4 and close > (low + high)/2 // Hammer
    if Hammer then
    result3 = 1
    elsif Shootingstar then
    result3 = -1
    else
    result3 = 0
    endif
    endif// Chiusura “IF THEN” su “FILTRO”

    return result as “long”,result2 as “Engulfing”, result3 as “Doji”,0

    #202379 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Il codice va bene, devi solo azzerare i vecchi segnali.

    Metti queste 3 righe all’inizio:

    result  = 0
    result2 = 0
    result3 = 0
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

Filtro su codice per ricerca pattern candela


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
Summary

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

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