VARIARE UN INDICATORE HA SMOOTHED IN SCREENER

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #94727 quote
    robertogozzi
    Moderator
    Master
    If Segnale = 1 and not OnMarket then
       BUY At Market
    Endif

    Basta che togli l’ultima riga ed aggiungi le condizioni, sopra ho indicato quella Long.

    #94732 quote
    nanniarc
    Participant
    Average

    salvo mio errore nelle ultime righe ho fatto come mi hai detto ma non genera alcun segnale nè in buy nè in short in un periodo di due anni…

    //Reglas en Heikin-Ashi:
    //1- Secuencia de cuerpos blancos = tendencia alcista.
    // Secuencia de cuerpos negros = tendencia bajista.
    //2- Tendencia alcista fuerte = Grandes cuerpos blancos y sin sombras inferiores.
    // Tendencia bajista fuerte = Grandes cuerpos negros sin sombras superiores.
    //3- Cuando la tendencia se debilita surgen cuerpos pequeños con posibles sombras superior y/o inferior.
    //4- Una consolidación se da cuando aparecen cuerpos pequeños con ambas sombras tanto arriba como abajo.
    //5- La reversión de una tendencia se puede sospechar con la aparición de pequeños cuerpos con sombras largas tanto superiores como inferiores, o un cambio repentino de color.
    
    // parámetros
    ONCE SmoothPeriod=2 // valor por defecto
    ONCE period=5 // valor por defecto
    ONCE flecha=0
    ONCE Dflech=barindex
    // ciclo normal
    IF BarIndex=0 THEN
    xClose = (open+high+low+close)/4
    xOpen = open
    xHigh = high
    xLow = low
    ELSE
    xClose = (open+high+low+close)/4
    xOpen = (xOpen[1]+xClose[1])/2
    xHigh = Max(max(high, xOpen), xClose)
    xLow = Min(min(Low, xOpen), xClose)
    endif
    // SUAVIZADO con la media de 2 en las velas
    if barindex>=(period+SmoothPeriod) then
    AvOpen=exponentialAverage[SmoothPeriod](xOpen)
    AvHigh=exponentialAverage[SmoothPeriod](xHigh)
    AvLow=exponentialAverage[SmoothPeriod](xLow)
    Avclose=exponentialAverage[SmoothPeriod](xClose)
    endif
    // y ésta es la que uso
    //DRAWCANDLE(AvOpen, AvHigh, AvLow, AvClose)
    IF AvOpen + AvHigh + AvLow + AvClose + Rango + Valor THEN
    ENDIF
    //ha7 para indicar cruces
    // los valores para barindex<2 son especiales
    If Barindex < SmoothPeriod then
    Opcl=Open[1]
    else
    Opcl=Open
    ENDIF
    // calculo dos medias de 7 y de 10
    Media7 = Average[7](Opcl)
    Media10 = Average[10](Opcl)
    rango= Media7/10
    // uso rango para el dibujo
    Alcista = AvOPen<AvClose
    Alcista1 = AvOpen[1]<AvClose[1]
    Bajista = AvOpen>AvClose
    Bajista1 = AvOpen[1]>AvClose[1]
    //Doji = Range[1] > ABS(AvOpen[1]-AvClose[1])*5
    //no puede haber dos operaciones en dos dias
    //valor representa mi compra cuando estoy dentro
    // y el precio de venta cuando me salgo
    IF Dflech < barindex[2] then
    IF (Opcl>Media7 or Opcl>Media10) and not (Bajista and Bajista1) and flecha<1 then
    // uso Range para que salgan visibles las flechas
    //DRAWARROWUP (barindex, AvHigh+Range) COLOURED (0, 0, 255)
    Segnale = 1
    flecha=1
    Dflech = barindex
    valor = AvClose
    ELSIF (Opcl<Media7 or Opcl<Media10) and not (Alcista and Alcista1) and flecha>=1 then
    //DRAWARROWDOWN (barindex, AvHigh+Range) COLOURED (255, 0, 0)
    Segnale = 2
    flecha=-1
    Dflech = barindex
    valor = AvClose
    ENDIF
    ENDIF
    //SCREENER [Segnale](Segnale AS "1=↑/2=↓")
    //RETURN Media7 COLOURED (0,0,255), Opcl-rango COLOURED(0,0,0) as "op-cl", Media7-rango coloured (0,0,255) as "media7", Media10-rango coloured(250,0,250) as "media10", valor COLOURED (255,0,0) as "valor"
    buy at -close limit //linea inutile, però è richiesta da ProBackTest
    GRAPH Dflech //lo vedi nella finestra delle variabili
    GRAPHONPRICE valor coloured(0,128,0,255) AS "V" //lo vedi sul grafico dei prezzi
    If Segnale = 1 and not OnMarket then
    BUY 1 CONTRACT At Market
    Endif
    IF SEGNALE = -1 AND NOT ONMARKET THEN
    SELLSHORT 1 CONTRACT AT MARKET
    
    ENDIF
    #94734 quote
    robertogozzi
    Moderator
    Master

    Funziona, solo che apre un’operazione e la mantiene aperta perché non gli è stato detto di chiuderla, quindi non la vedi nel rapporto.

    Se aggiungi queste due righe funzionerà:

    set target pprofit 50
    set stop ploss     50

    Ad ogni modo le tre righe 76-78 toglile o commentale.

    x-16.jpg x-16.jpg
    #94820 quote
    nanniarc
    Participant
    Average

    Ciao Roberto, una storia senza fine… il sistema gira ma su un daily a 1000 periodi mi dà solo segnali long e mi sembra strano.
    Dove sbaglio secondo te? Grazie mille.

    //Reglas en Heikin-Ashi:
    //1- Secuencia de cuerpos blancos = tendencia alcista.
    // Secuencia de cuerpos negros = tendencia bajista.
    //2- Tendencia alcista fuerte = Grandes cuerpos blancos y sin sombras inferiores.
    // Tendencia bajista fuerte = Grandes cuerpos negros sin sombras superiores.
    //3- Cuando la tendencia se debilita surgen cuerpos pequeños con posibles sombras superior y/o inferior.
    //4- Una consolidación se da cuando aparecen cuerpos pequeños con ambas sombras tanto arriba como abajo.
    //5- La reversión de una tendencia se puede sospechar con la aparición de pequeños cuerpos con sombras largas tanto superiores como inferiores, o un cambio repentino de color.

    // parámetros
    ONCE SmoothPeriod=2 // valor por defecto
    ONCE period=5 // valor por defecto
    ONCE flecha=0
    ONCE Dflech=barindex
    // ciclo normal
    IF BarIndex=0 THEN
    xClose = (open+high+low+close)/4
    xOpen = open
    xHigh = high
    xLow = low
    ELSE
    xClose = (open+high+low+close)/4
    xOpen = (xOpen[1]+xClose[1])/2
    xHigh = Max(max(high, xOpen), xClose)
    xLow = Min(min(Low, xOpen), xClose)
    endif
    // SUAVIZADO con la media de 2 en las velas
    if barindex>=(period+SmoothPeriod) then
    AvOpen=exponentialAverage[SmoothPeriod](xOpen)
    AvHigh=exponentialAverage[SmoothPeriod](xHigh)
    AvLow=exponentialAverage[SmoothPeriod](xLow)
    Avclose=exponentialAverage[SmoothPeriod](xClose)
    endif
    // y ésta es la que uso
    //DRAWCANDLE(AvOpen, AvHigh, AvLow, AvClose)
    IF AvOpen + AvHigh + AvLow + AvClose + Rango + Valor THEN
    ENDIF
    //ha7 para indicar cruces
    // los valores para barindex<2 son especiales
    If Barindex < SmoothPeriod then Opcl=Open[1] else Opcl=Open ENDIF // calculo dos medias de 7 y de 10 Media7 = Average[7](Opcl) Media10 = Average[10](Opcl) rango= Media7/10 // uso rango para el dibujo Alcista = AvOPenAvClose
    Bajista1 = AvOpen[1]>AvClose[1]
    //Doji = Range[1] > ABS(AvOpen[1]-AvClose[1])*5
    //no puede haber dos operaciones en dos dias
    //valor representa mi compra cuando estoy dentro
    // y el precio de venta cuando me salgo
    IF Dflech < barindex[2] then IF (Opcl>Media7 or Opcl>Media10) and not (Bajista and Bajista1) and flecha<1 then
    // uso Range para que salgan visibles las flechas
    //DRAWARROWUP (barindex, AvHigh+Range) COLOURED (0, 0, 255)
    Segnale = 1
    flecha=1
    Dflech = barindex
    valor = AvClose
    ELSIF (Opcl=1 then
    //DRAWARROWDOWN (barindex, AvHigh+Range) COLOURED (255, 0, 0)
    Segnale = 2
    flecha=-1
    Dflech = barindex
    valor = AvClose
    ENDIF
    ENDIF
    //SCREENER [Segnale](Segnale AS “1=↑/2=↓”)
    //RETURN Media7 COLOURED (0,0,255), Opcl-rango COLOURED(0,0,0) as “op-cl”, Media7-rango coloured (0,0,255) as “media7”, Media10-rango coloured(250,0,250) as “media10”, valor COLOURED (255,0,0) as “valor”

    If Segnale = 1 and not OnMarket then
    BUY 1 CONTRACT At Market
    SET TARGET PPROFIT 100
    SET STOP PLOSS 100
    Endif
    IF SEGNALE = -1 AND NOT ONMARKET THEN
    SELLSHORT 1 CONTRACT AT MARKET
    SET TARGET PPROFIT 100
    SET STOP PLOSS 100

    ENDIF

Viewing 4 posts - 16 through 19 (of 19 total)
  • You must be logged in to reply to this topic.

VARIARE UN INDICATORE HA SMOOTHED IN SCREENER


ProScreener: Scansione Mercati & Screener

New Reply
Author
author-avatar
nanniarc @nanniarc Participant
Summary

This topic contains 18 replies,
has 3 voices, and was last updated by nanniarc
6 years, 11 months ago.

Topic Details
Forum: ProScreener: Scansione Mercati & Screener
Language: Italian
Started: 03/20/2019
Status: Active
Attachments: 2 files
Logo Logo
Loading...