Problema con backtest su indicatore

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #21215 quote
    tatankayotanka
    Participant
    Senior

    Buonasera, ho provato ha fare back test dell indicatore da me modificato “Velocity mix ” ma non me lo esegue ,io penso che sia dovuto al fatto che nell’ indicatore ci sono più curve che per° alla fine creano lo stesso nome , per cui  il back test non produce risultati , di seguito pubblico lo script dell indicatore sia lo script del backtest

    “Indicatore ”

    //Tracy
    //short=8
    //vfactor=.7
    Data=customclose
    x1=(exponentialaverage[short](Data))*(1+vfactor)
    x2=(exponentialaverage[short](exponentialaverage[short](Data)))*vfactor
    gd=x1-x2
    x11=(exponentialaverage[short](gd))*(1+vfactor)
    x21=(exponentialaverage[short](exponentialaverage[short](gd)))*vfactor
    gd1=x11-x21
    x12=(exponentialaverage[short](gd1))*(1+vfactor)
    x22=(exponentialaverage[short](exponentialaverage[short](gd1)))*vfactor
    first=x12-x22
    y1=(exponentialaverage[short](Data))*(1+vfactor/2)
    y2=(exponentialaverage[short](exponentialaverage[short](Data)))*vfactor/2
    ygd=y1-y2
    y11=(exponentialaverage[short](ygd))*(1+vfactor/2)
    y21=(exponentialaverage[short](exponentialaverage[short](ygd)))*vfactor/2
    ygd1=y11-y21
    y12=(exponentialaverage[short](ygd1))*(1+vfactor/2)
    y22=(exponentialaverage[short](exponentialaverage[short](ygd1)))*vfactor/2
    second=y12-y22
    S = first - second[1]
    
    //T+2
    //intermediate =32
    //vfactor=0.7
    x10=(exponentialaverage[intermediate ](Data))*(1+vfactor)
    x20=(exponentialaverage[intermediate ](exponentialaverage[intermediate ](Data)))*vfactor
    gd2=x10-x20
    x110=(exponentialaverage[intermediate ](gd2))*(1+vfactor)
    x210=(exponentialaverage[intermediate ](exponentialaverage[intermediate ](gd2)))*vfactor
    gd20=x110-x210
    x120=(exponentialaverage[intermediate ](gd20))*(1+vfactor)
    x220=(exponentialaverage[intermediate ](exponentialaverage[intermediate ](gd20)))*vfactor
    first1=x120-x220
    y10=(exponentialaverage[intermediate ](Data))*(1+vfactor/2)
    y20=(exponentialaverage[intermediate ](exponentialaverage[intermediate ](Data)))*vfactor/2
    ygd2=y10-y20
    y110=(exponentialaverage[intermediate ](ygd2))*(1+vfactor/2)
    y210=(exponentialaverage[intermediate ](exponentialaverage[intermediate ](ygd2)))*vfactor/2
    ygd20=y110-y210
    y120=(exponentialaverage[intermediate ](ygd20))*(1+vfactor/2)
    y220=(exponentialaverage[intermediate ](exponentialaverage[intermediate ](ygd20)))*vfactor/2
    second1=y120-y220
    S1 = first1 - second1[1]
    
    
    //T+3
    //long=64
    //vfactor=.7
    x100=(exponentialaverage[long](Data))*(1+vfactor)
    x200=(exponentialaverage[long](exponentialaverage[long](Data)))*vfactor
    gd3=x100-x200
    x1100=(exponentialaverage[long](gd3))*(1+vfactor)
    x2100=(exponentialaverage[long](exponentialaverage[long](gd3)))*vfactor
    gd30=x1100-x2100
    x1200=(exponentialaverage[long](gd30))*(1+vfactor)
    x2200=(exponentialaverage[long](exponentialaverage[long](gd30)))*vfactor
    first2=x1200-x2200
    y100=(exponentialaverage[long](Data))*(1+vfactor/2)
    y200=(exponentialaverage[long](exponentialaverage[long](Data)))*vfactor/2
    ygd3=y100-y200
    y1100=(exponentialaverage[long](ygd3))*(1+vfactor/2)
    y2100=(exponentialaverage[long](exponentialaverage[long](ygd3)))*vfactor/2
    ygd30=y1100-y2100
    y1200=(exponentialaverage[long](ygd30))*(1+vfactor/2)
    y2200=(exponentialaverage[long](exponentialaverage[long](ygd30)))*vfactor/2
    second2=y1200-y2200
    S2 = first2 - second2[1]
    return S  coloured (255,0,0) as "SHORT" ,  S1 coloured (0,160,0) as "INTERMEDIATE", S2 coloured (0,0,255) as "LONG",0 coloured (1,1,1)
    //as "level 0"

     

     

    backtest

    // Definizione dei parametri del codice
    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
    
    // Condizioni per entrare su posizioni long
    indicator1, ignored, ignored, ignored = CALL "Velocity mix Mari"[8, 32, 64, 0.7](close)
    c1 = (indicator1 CROSSES OVER indicator1)
    ignored, indicator2, ignored, ignored = CALL "Velocity mix Mari"[8, 32, 64, 0.7](close)
    c2 = (indicator2 > indicator2)
    ignored, ignored, indicator3, ignored = CALL "Velocity mix Mari"[8, 32, 64, 0.7](close)
    c3 = (indicator3 > indicator3)
    
    IF c1 AND c2 AND c3 THEN
    BUY 1 CASH AT MARKET
    ENDIF
    
    // Condizioni per uscire da posizioni long
    indicator4, ignored, ignored, ignored = CALL "Velocity mix Mari"[8, 32, 64, 0.7](close)
    c4 = (indicator4 CROSSES UNDER indicator4)IF c4 THEN
    SELL AT MARKET
    ENDIF// Stop e target
    SET STOP pLOSS 2
    SET TARGET pPROFIT 10
    #21629 quote
    Nicolas
    Keymaster
    Master

    È don ‘necessario dichiarare l’indicatore 4 volte. È possibile utilizzare solo istruzioni 1 chiamare per 4 diverse variabili nella stessa linea:

    // Definizione dei parametri del codice
    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
    
    // Condizioni per entrare su posizioni long
    indicator1,indicator2,indicator3,indicator4 = CALL "Velocity mix Mari"[8, 32, 64, 0.7](close)
    c1 = (indicator1 CROSSES OVER indicator1)
    c2 = (indicator2 > indicator2)
    c3 = (indicator3 > indicator3)
    
    IF c1 AND c2 AND c3 THEN
    BUY 1 CASH AT MARKET
    ENDIF
    
    // Condizioni per uscire da posizioni long
    c4 = (indicator4 CROSSES UNDER indicator4)
    IF c4 THEN
    SELL AT MARKET
    ENDIF// Stop e target
    SET STOP pLOSS 2
    SET TARGET pPROFIT 10

    Il problema nel codice è certamente in condizione di C1 e C4 quando si verifica se una variabile sta attraversando il proprio valore .. che è impossibile 🙂
    Anche voi volete sapere se un valore è superiore al proprio valore in condizioni di C2 e C3 …

    #21915 quote
    tatankayotanka
    Participant
    Senior

    Ok grazie, buon weekend

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

Problema con backtest su indicatore


ProOrder: Trading Automatico & Backtesting

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by tatankayotanka
9 years, 1 month ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 01/15/2017
Status: Active
Attachments: No files
Logo Logo
Loading...