Problème pour faire fonctionner PositionPerf

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #200632 quote
    vats33
    Participant
    New

    Bonjour,

    Je ne parviens pas à faire fonctionner la fonction Positionperf dans ma stratégie d’achat du cac40:

    DEFPARAM CumulateOrders = False
    indicator1 = Average[20](close)
    c1 = (close CROSSES OVER indicator1)
    
    IF NOT LongOnMarket and c1 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    IF LONGONMARKET AND positionperf>0.1 THEN
    SET TARGET %PROFIT 0.3
    SET STOP TRAILING 4
    
    ENDIF

     

    Merci d’avance à celui qui pourra m’aiguiller.

    Cordialement,

    Stéphane

    #200644 quote
    Nicolas
    Keymaster
    Master

    PositionPerf s’exprime en pourcentage du prix, c’est peut être là de provient ton incompréhension ?

    #200669 quote
    vats33
    Participant
    New

    Bonjour Nicolas,

    Justement, c’est bien 0.1% que je cherche à obtenir en gain pour pouvoir placer mon stop suiveur à 4 pts et ma limite à 0.3%. Mais il ne se passe rien …

    #200670 quote
    Nicolas
    Keymaster
    Master

    Ok, as-tu fait un

    GRAPH positionperf

    pour vérifier que la valeur est juste pour activer tes instructions des lignes 10 et 11 ?

    Si le problème persiste, j’aimerai le reproduire avec un exemple concret merci 🙂 (indiquer timeframe, instrument svp).

    #200677 quote
    vats33
    Participant
    New

    Nicolas,

    Merci pour ta réactivité.

    Désolé mais je ne vois pas comment faire avec  GRAPH positionperf

    Si tu peux essayer de reproduire: time frame: 1 min sur France40 cash (PXI)

    Encore merci pour ton aide

    Stéphane

    #200682 quote
    robertogozzi
    Moderator
    Master

    Essaye ça:

    IF close CROSSES OVER average[20,0](close) then
       buy 1 contract at market
       set target %profit 1
       set stop   %loss   1
    endif
    graph PositionPerf                AS "Performance MultiPlier"
    graph PositionPerf * 100          AS "Performance %"
    graph PositionPerf*PositionPrice  AS "Profit/Loss"
    graphonprice PositionPrice        AS "Average Price"
    #200683 quote
    vats33
    Participant
    New

    Bonjour Roberto,

    Merci pour ta réponse. Je viens d’ajouter ces lignes mais j’ai le message suivant qui apparaît sur mon interface PRT: “L’instruction “Graph” ne peut pas être utilisée en trading automatique” !

    Une idée ?

    #200684 quote
    Nicolas
    Keymaster
    Master

    En effet, fait un backtest et tu verras l’utilité de cette instruction qui te permet de débugger.

    Ton code devrait être comme suit pour que tu puisses visualiser le positionperf lors d’un backtest:

    DEFPARAM CumulateOrders = False
    indicator1 = Average[20](close)
    c1 = (close CROSSES OVER indicator1)
    
    IF NOT LongOnMarket and c1 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    IF LONGONMARKET AND positionperf>0.1 THEN
    SET TARGET %PROFIT 0.3
    SET STOP TRAILING 4
    
    ENDIF
    
    graph positionperf
    #200689 quote
    vats33
    Participant
    New

    Merci. Pas de souci pour backtester, mais cela ne résoud pas mon problème de positionperf  sur ProOrder

    #200780 quote
    Nicolas
    Keymaster
    Master

    Donc tu as pu vérifier que ta condition était correcte ?

    Soit à partir de 0.1% de gain vis à vis du prix d’entrée (soit un peu plus de 6 points sur CAC40), tu déplaces ton takeprofit à environ 18 points.

    #200781 quote
    Nicolas
    Keymaster
    Master

    Comme l’indiquai Roberto, pour obtenir positionperf en pourcentage il faut le multiplier par 100. Car positionperf est un ratio du prix actuel vis à vis du prix d’entrée, problème de sémantique ici .. 🙄

    Donc ton code devrait être plutôt :

    DEFPARAM CumulateOrders = False
    indicator1 = Average[20](close)
    c1 = (close CROSSES OVER indicator1)
    
    IF NOT LongOnMarket and c1 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    IF LONGONMARKET AND positionperf*100>0.1 THEN
     SET TARGET %PROFIT 0.3
     SET STOP TRAILING 4
    
    ENDIF
    
    graph positionperf
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.

Problème pour faire fonctionner PositionPerf


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
vats33 @vats33 Participant
Summary

This topic contains 10 replies,
has 3 voices, and was last updated by Nicolas
3 years, 5 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 09/12/2022
Status: Active
Attachments: No files
Logo Logo
Loading...