CONVERSIONE INDICATORE IN TS

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #114872 quote
    tradingpro
    Participant
    Senior
    VORREI CONVERTIRE QUESTO CODICE IN TRADING AUTOMATICO... MI DICE CHE DEVO MODIFICARE LE VARIABILI
    //parameters :
    //MM=0
    //periodo=14
    //box=0 (in case the boxsize has to be based on ATR) or any other value for traditional computation
    //coeff=1
    if 0 then
    boxsize = 1*average[14,28](tr)
    else
    boxsize=0
    endif
    
    once topprice = close
    once bottomprice = close - boxsize
    once barold=0
    once posold=close
    
    if barindex>2*14 then
    if (close > topprice) THEN
    valup=round((close-topprice)/boxsize)+1
    topprice=topprice + valup*boxsize
    bottomprice = topprice - boxsize
    up=1
    down=0
    ELSIF (close < bottomprice ) THEN
    valdown=round((bottomprice-close)/boxsize)+1
    bottomprice = bottomprice - valdown*boxsize
    topprice = bottomprice + boxsize
    up=0
    down=1
    ELSE
    topprice = topprice
    bottomprice = bottomprice
    ENDIF
    
    //calcolo linee zig zag
    //trend up
    if up=1 then
    if up[1]=0 then
    DRAWARROWUP(barindex, LOW)coloured (0,0,255)
    
    barold=barnew
    posold=posnew
    upvol=0
    downvol=0
    endif
    if close>posnew then
    posnew=high
    barnew=barindex
    endif
    upvol=upvol+round(volume/1000)
    endif
    
    //trend down
    if down=1 then
    if down[1]=0 then
    DRAWARROWDOWN(barindex, HIGH) coloured (250,0,0)
    
    barold=barnew
    posold=posnew
    upvol=0
    downvol=0
    endif
    if close<posnew then
    posnew=low
    barnew=barindex
    endif
    downvol=downvol+round(volume/1000)
    endif
    
    endif
    RETURN
    #114876 quote
    robertogozzi
    Moderator
    Master

    Devi usare la variabili che, all’inizio sono commentate, quindi togli i commenti. Ovviamente la riga 2 non ha variabili, è intuitivo anche se inglese.

    Alla riga 5 il commento non devi toglierlo, ma spostarlo verso destra, subito dopo lo zero.

    Dopodiché ProOrder:

    • non accetta la parola riservata RETURN (serve solo per gli indicatori)
    • non accetta istruzioni GRAFICHE, quindi devi toglierle o commentarle
    • devi inserire le condizioni per entrare Long e/o Short
    • aggiungere un TP e SL

    E’ chiaro che dovrai stabilire te l’eventuali altre condizioni, le sue per entrare Long sono quelle alle righe 38 e 39, quindi potresti sostituire la riga 40 con una variabile che ti faccia da segnale Long:

    Segnale = 1

    quelle per entrare Short sono quelle alle righe 55 e 56, quindi potresti sostituire la riga 57 con una variabile che ti faccia da segnale Short:

    Segnale = -1

    Alla riga 17 metti:

    Segnale = 0

    Dopodiché quando SEGNALE=1 (oltre ad eventuali altre tue condizioni, tipo orari, giorni, indicatori) vai Long e quando è -1 vai Short.

    #114904 quote
    tradingpro
    Participant
    Senior

    mi dice che devo togliere le variabili POSOLD  … pero con cosa le sostituisco?

    grazie

    #114906 quote
    robertogozzi
    Moderator
    Master

    Non riesco a capire perché, dal momento che non dovresti averla toccata e se funzionava l’indicatore deve funzionare anche con la strategia.

    Posta il codice che hai scritto per verificarlo.

    #114907 quote
    tradingpro
    Participant
    Senior
    if box=0 then
    boxsize = coeff*average[14,28](tr)
    else
    boxsize=box
    endif
    
    once topprice = close
    once bottomprice = close - boxsize
    once barold=0
    once posold=close
    
    if barindex>2*14 then
    if (close > topprice) THEN
    valup=round((close-topprice)/boxsize)+1
    topprice=topprice + valup*boxsize
    bottomprice = topprice - boxsize
    up=1
    down=0
    ELSIF (close < bottomprice ) THEN
    valdown=round((bottomprice-close)/boxsize)+1
    bottomprice = bottomprice - valdown*boxsize
    topprice = bottomprice + boxsize
    up=0
    down=1
    ELSE
    topprice = topprice
    bottomprice = bottomprice
    ENDIF
    
    //calcolo linee zig zag
    //trend up
    if up=1 then
    if up[1]=0 then
    BUY 1 shares at market
    
    barold=barnew
    posold=posnew
    upvol=0
    downvol=0
    endif
    if close>posnew then
    posnew=high
    barnew=barindex
    endif
    upvol=upvol+round(volume/1000)
    endif
    
    //trend down
    if down=1 then
    if down[1]=0 then
    SELLSHORT 1 shares at market
    
    barold=barnew
    posold=posnew
    upvol=0
    downvol=0
    endif
    if close<posnew then
    posnew=low
    barnew=barindex
    endif
    downvol=downvol+round(volume/1000)
    endif
    
    endif
    Cattura.png Cattura.png
    #114910 quote
    robertogozzi
    Moderator
    Master

    Le righe 3,4,5 e 6 servivano, solo le barre di commento andavano tolte.

    #114927 quote
    tradingpro
    Participant
    Senior

    lo rienserite ma dice che devo mettere le variabili di nuovo

    #115100 quote
    robertogozzi
    Moderator
    Master

    Scusami, dove hai preso quel codice, come faceva a funzionare a chi l’ha scritto?

    Manca un sacco di roba, forse hai fatto un copia & incolla errato.

    Prova a postare il link dove l’hai trovato.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

CONVERSIONE INDICATORE IN TS


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
tradingpro @tradingpro Participant
Summary

This topic contains 7 replies,
has 2 voices, and was last updated by robertogozzi
6 years, 1 month ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 12/14/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...