Indicatore da strategia

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #81577 quote
    Gianluca
    Participant
    Master

    Ciao, ho una strategia che ho provato a trasformare in indicatore prendendo spunto da un precedente mio post, purtroppo con scarsissimo successo. Potreste aiutarmi?

    Lo strumento è il Dax Future 15 minuti, questo è il codice che ho fatto, ma mi da 1 solo risultato che non combacia con quelli della strategia che uso per verificarlo

    
    DEFPARAM CALCULATEONLASTBARS = 10000
    
    ONCE maxsetup = 0
    ONCE minSetup = 0
    //PROFITLONG=110
    //STOPLONG=85
    //PROFITSHORT=40
    //STOPSHORT=80
    // DOPO 30 PUNTI METTERE LO STOP A PROFIT A 5 PUNTI
    STARTHOUR = 93000
    LIMITHOUR = 100000
    Result = 0
    if time=91500 then
    res=high
    supp=low
    maxsetup=0
    minsetup=0
    BUYPOSITION=0
    SELLPOSITION=0
    endif
    
    longok=(close[1]crosses over res)
    shortok= (close[1] crosses under supp)
    
    if TIME > STARTHOUR AND TIME < LIMITHOUR then
    if longok THEN
    if buyposition=0 and maxsetup = 0 then
    if iamlong then
    buyposition=1
    else
    maxsetup = res
    result=1
    DRAWTEXT("#maxsetup#", barindex, high, Dialog, Bold, 10) COLOURED(0,255,0,255)
    iamlong=1
    iamshort=0
    endif
    ENDIF
    if shortok then
    if sellposition=0 and minsetup=0 then
    if iamshort then
    sellposition=1
    else
    minsetup = supp
    result=2
    DRAWTEXT("#minsetup#", barindex, low, Dialog, Bold, 10) COLOURED(255,0,0,255)
    iamlong=0
    iamshort=1
    ENDIF
    ENDIF
    endif
    endif
    IF IamLong AND (TIME> LIMITHOUR) THEN
    Result = 5
    IamLong = 0
    ELSIF IamShort AND (TIME > LIMITHOUR) THEN
    Result = 6
    IamShort = 0
    endif
    endif
    IF Result THEN    //blocco IF...ENDIF inutile, solo per usare la variabile RESULT
    ENDIF
    return
    
    #81580 quote
    robertogozzi
    Moderator
    Master

    Che cosa deve indicare?

    #81601 quote
    Gianluca
    Participant
    Master

    Al verificarsi delle condizioni (LONG OK E SHORT OK) deve dire il prezzo di acquisto o vendita da inserire manualmente.
    ( O SUL GRAFICO, COME UNA LINEA ORIZZONTALE) O IN BASSO COME ISTOGRAMMA)

    #81690 quote
    Gianluca
    Participant
    Master

    Pensi sia fattibile?

    #81718 quote
    robertogozzi
    Moderator
    Master

    Immagino di si, su quale TF vuoi usarlo, sul 15 minuti o sul 5 minuti?

    #81789 quote
    Gianluca
    Participant
    Master

    il segnale proviene dal 15 minuti, poi lo gestisco con il 5, ho fatto questa strategia ORB per il multiframe che ho lanciato sui CFD, ora io vorrei usarla anche sui futures ufficiali, ma li io non esiste il PRO-ORDER, quindi l’unica possibilità per poterla usare è farne un indicatore, siccome deve dirmi anche i prezzi di entrata e di stop l’unica cosa è qualcosa ad histogramma.

    Potete aiutarmi?

    ti incollo la strategia completa:

    DEFPARAM FLATBEFORE = 080000
    DEFPARAM PRELOADBARS = 10000
    DEFPARAM FLATAFTER = 210000
    DEFPARAM CUMULATEORDERS = FALSE
    
    ONCE maxsetup = 0
    ONCE minSetup = 0
    PROFITLONG=110
    STOPLONG=85
    PROFITSHORT=40
    STOPSHORT=80
    
    //once breakeaven = 0
    //startBreakeven = 30
    //PointsToKeep = 5
    ///////////////////////////////
    ///////////////////
    TIMEFRAME (15 MINUTES, UPDATEONCLOSE)
    ONCE RES = 0
    ONCE SUPP = 0
    if time=91500 then
    res=high
    supp=low
    graphonprice res
    graphonprice supp
    endif
    ignored, ignored, ignored, ignored, ignored, COMPOM = CALL "Composite momentum"[4, 3, 9]
    //graph compom
    avt=AverageTrueRange[14](close)
    TIMEFRAME (DEFAULT)
    //avt=AverageTrueRange[14](close)
    longok=(close[1]crosses over res)  and (avt>9.25) and (compom<51)
    shortok= (close[1] crosses under supp) and (avt>19.5)and (compom<56)
    if OnMarket THEN
    MinSetup=0
    MaxSetup=0
    ENDIF
    IF NOT ONMARKET THEN
    maxsetup=0
    minsetup=0
    ENDIF
    
    ///////ORDINI//////////////////
    //BUY ORDERS
    if not onmarket and TIME > 93000 AND TIME < 100000 and longok THEN
    IF maxsetup = 0 THEN
    maxsetup = res
    endif
    BUY 1 CONTRACT AT maxsetup limit
    endif
    //SELL ORDERS
    if not onmarket and TIME > 93000 AND TIME < 100000 and shortok THEN
    if minsetup = 0 then
    minsetup = supp
    endif
    SELLSHORT 1 CONTRACT AT minsetup limit
    ENDIF
    
    
    
    IF LONGONMARKET THEN
    SET TARGET PPROFIT PROFITLONG
    SET STOP PLOSS STOPLONG
    ELSE
    IF SHORTONMARKET THEN
    SET TARGET PPROFIT PROFITSHORT
    SET STOP PLOSS STOPSHORT
    ENDIF
    ENDIF
    
    if time>212300 then
    exitshort at market
    sell at market
    endif
    
    TIMEFRAME (DEFAULT)
    
    #81801 quote
    robertogozzi
    Moderator
    Master

    Provalo, io non l’ho testato perché non ho quell’indicatore

    DEFPARAM CALCULATEONLASTBARS = 500
    //PROFITLONG  = 110
    STOPLONG      = 85
    //PROFITSHORT = 40
    STOPSHORT     = 80
    ONCE RES      = 0
    ONCE SUPP     = 0
    if time = 091500 then
    res  = high
    supp = low
    endif
    ignored, ignored, ignored, ignored, ignored, COMPOM = CALL "Composite momentum"[4, 3, 9]
    avt           = AverageTrueRange[14](close)
    longok        = (close[1] crosses over res)   and (avt > 9.25) and (compom < 51)
    shortok       = (close[1] crosses under supp) and (avt > 19.5) and (compom < 56)
    IF longok THEN
    Prezzo = res
    Sl     = res  - (STOPLONG * pipsize)
    ELSIF shortok THEN
    Prezzo = supp
    Sl     = supp + (STOPSHORT * pipsize)
    ENDIF
    IF longok OR shortok THEN
    DRAWTEXT("#Prezzo#", barindex, Prezzo, Dialog, Bold, 10) COLOURED(0,255,0,255)
    DRAWTEXT("#Sl#"    , barindex, Sl,     Dialog, Bold, 10) COLOURED(0,255,0,255)
    ENDIF
    RETURN
    #81803 quote
    Gianluca
    Participant
    Master

    Provalo, io non l’ho testato perché non ho quell’indicatore

    ma è nel Database del sito PRC!

    #81804 quote
    robertogozzi
    Moderator
    Master

    Non usare spesso il QUOTE, altrimenti i post si allungano smisuratamente, tanto si sa di cosa si parla.

    Usalo solo quando davvero vuoi evidenziare qualcosa di specifico, magari togliendo dalla citazione le righe superflue. Grazie.

    #81807 quote
    Gianluca
    Participant
    Master

    Scusami hai ragione.

    Non funziona :8

    [attachment file=”81808″]

    ORB.jpg ORB.jpg
    #81866 quote
    Gianluca
    Participant
    Master

    Buonasera, a cosa puo’ esser dovuto il non funzionamento dell’indicatore?

    #81868 quote
    Gianluca
    Participant
    Master

    O meglio, funziona se messo sul grafico, ma servirebbe come Histogramma sotto. e che uscisse solo la barra che deve fare il trade non una linea continua.

    #81870 quote
    Gianluca
    Participant
    Master

    Ho aggiustato l’indicatore con le frecce visto che non sono capace a fare quello ad istogramma, mi da pero’ un errore, non mi disegna bene i segmenti per gli stop, infatti ho inserito che mi segnali un segmento all’altezza dei take profit per i long e viene regolarmente disegnato, ma non segnala il segmento per lo stop (devo aver sbagliato qualcosa) nè mi disegna il segmento per le operazioni short

    Altro quesito, mi disegna troppe frecce (MOTIVO per cui volevo optare per far uscire un histogramma con i valori) dovrebbe disegnarmela solo una volta e non sempre, questo avviene perchè me le segnala finchè non vengono meno le condizioni ? (come altre variabili atr etc?)

    DEFPARAM CALCULATEONLASTBARS = 500
    PROFITLONG  = 110
    STOPLONG      = 85
    PROFITSHORT = 40
    STOPSHORT     = 80
    
    
    ONCE RES      = 0
    ONCE SUPP     = 0
    if time = 091500 then
    res  = high
    supp = low
    endif
    ignored, ignored, ignored, ignored, ignored, COMPOM = CALL "Composite momentum"[4, 3, 9]
    avt           = AverageTrueRange[14](close)
    longok        = (close[1] crosses over res)   and (avt > 9.25) and (compom < 51)
    shortok       = (close[1] crosses under supp) and (avt > 19.5) and (compom < 56)
    IF longok THEN
    Prezzo = res
    Sl     = res  - (STOPLONG * pipsize)
    GAIN=PREZZO+PROFITLONG
    ELSIF shortok THEN
    Prezzo = supp
    Sl     = supp + (STOPSHORT * pipsize)
    GAIN=PREZZO+PROFITSHORT
    ENDIF
    IF longok  THEN
    DRAWARROWUP(barindex,LOW-15)coloured(127,255,212)
    DRAWTEXT("#PREZZO#", barindex, HIGH+10, Dialog, Bold,10) COLOURED(127,255,212)//PREZZO DI ENTRATA
    ///////////////////////////////////////////////////////
    ///PREZZO E GRAFICA STOP LOSS
    DRAWTEXT("#Sl#"    , barindex, LOW-10*PIPSIZE, Dialog, Bold, 10) COLOURED(255,191,0)
    DRAWSEGMENT(barindex,LOW-SL,barindex-SL, HIGH+SL)coloured(255,191,0)
    /////////////////////////////////////////////
    ///PREZZO E GRAFICA TAKE PROFIT//////////////
    DRAWSEGMENT(barindex,HIGH+PROFITLONG,barindex+20, HIGH+PROFITLONG)coloured(127,255,212)
    DRAWTEXT("#GAIN#"    , barindex-2, HIGH+PROFITLONG, Dialog, Bold, 10)  COLOURED(127,255,212)
    // LIVELLO DI PROFIT
    ELSE
    IF SHORTOK THEN
    DRAWARROWDOWN(barindex,HIGH+15)coloured(255,0,0)
    DRAWTEXT("#Prezzo#", barindex, LOW-10, Dialog, Bold, 10) COLOURED(255,0,0)
    ///////////////////////////////////////////////////////
    ///PREZZO E GRAFICA STOP LOSS
    DRAWTEXT("#Sl#"    , barindex, HIGH+10,Dialog, Bold, 10) COLOURED(255,191,0)
    DRAWSEGMENT(barindex,HIGH+SL,barindex+SL, HIGH+SL)coloured(255,191,0)
    //PREZZO E GRAFICA TAKE PROFIT
    DRAWSEGMENT(barindex,LOW-SL,barindex-SL, LOW-SL)coloured(255,0,0)
    DRAWTEXT("#GAIN#"    , barindex-2, LOW-PROFITSHORT,Dialog, Bold, 10) COLOURED(255,0,0)
    ENDIF
    ENDIF
    
    RETURN
    

    [attachment file=”81871″]

    INDICATORE-ORB.jpg INDICATORE-ORB.jpg
    #81891 quote
    robertogozzi
    Moderator
    Master

    Ho provato a scaricare un Composite Momentum dalla libreria, ma è leggermente diverso, restituisce 6 parametri, ma non ne richiede nessuno tra parentesi quando lo chiami, hai aggiunto te quei 3 parametri [4,3,9], cosa sono?

    CALL "Composite momentum"[4, 3, 9]
    #81893 quote
    Gianluca
    Participant
    Master

    Io dal forum l’ho preso.

    [attachment file=”81895″]

    [attachment file=”81894″]

    Composite-momentum.itf Cattura.jpg Cattura.jpg
Viewing 15 posts - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.

Indicatore da strategia


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Gianluca @altares Participant
Summary

This topic contains 18 replies,
has 2 voices, and was last updated by robertogozzi
7 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 09/28/2018
Status: Active
Attachments: 4 files
Logo Logo
Loading...