TESTARE UN MULTI SYS

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #177898 quote
    Hary Trading
    Participant
    New

    Buongiorno,

    Ho difficoltà a trovare un tutorial che mi aiuti a fare questo:

    se avessi per esempio due tipi di strategie sullo stesso strumento, e volessi che la PRT mi restituisse sia le due equity separate che quella cumulata di entrambi i sistemi, come dovrei fare?

    un esempio banalissimo:

    if close>open then

    buy 1 contracts at market

    endif

    if longonmarket then

    sell at market

    endif

    if close<open then

    sell short  1 contracts at market

    endif

    if shortonmarket then

    sell at market

    endif

    grazie infinite a chi potrà rispondere

    Hary

    #177902 quote
    robertogozzi
    Moderator
    Master

    Se sono due strategie distinte, in due diversi file, non si può fare, in quanto ogni strategia è indipendente dalle altre.
    Se hai due strategie codificate all’interno dello stesso codice, si può fare, con una certa complessità (per strategie più complicate) perché PRT segue il totale complessivo e non può essere diviso.
    Nel tuo esempio si può fare. In pratica vuoi tenere separati i risultati dei Long dagli Short (ho modificato leggermente il codice per fargli fare sempre Stop & Reverse):

    ONCE LongProfit  = 0
    ONCE ShortProfit = 0
    Gain = StrategyProfit - StrategyProfit[1]
    IF Gain <> 0 THEN
       IF LongOnMarket[1] THEN
          LongProfit = LongProfit + Gain
       ELSIF ShortOnMarket[1] THEN
          ShortProfit = ShortProfit + Gain
       ENDIF
    ENDIF
    if close crosses over average[100](close) and Not LongOnMarket then
       buy 1 contracts at market
    endif
    if close crosses under average[100](close) and Not ShortOnMarket then
       sellshort 1 contracts at market
    endif
    graph LongProfit  coloured(0,0,255,255)
    graph ShortProfit coloured(0,128,155,255)

    Come puoi vedere dalla foto (DAX Daily, con 1K unità), la somma delle due curve da il risultato complessivo della strategia. Una è positiva, l’altra negativa.

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

TESTARE UN MULTI SYS


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Hary Trading @adtrader Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
4 years, 4 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 09/19/2021
Status: Active
Attachments: 1 files
Logo Logo
Loading...