prise de position au dépassement de la Mèche

Viewing 15 posts - 16 through 30 (of 33 total)
  • Author
    Posts
  • #109922 quote
    Sebastien Boissel
    Participant
    New

    Bonjour,

    J’ai essayer votre version mais malheureusement cela ne marche que sur probacktest, sur proorder le robot ne sort plus du marché seul.

    voici la version que j’ai utilisé.

    sell AT low stop
    exitshort AT high stop
    #109923 quote
    Nicolas
    Keymaster
    Master

    Merci de poster le code complet de la stratégie afin d’analyser l’ensemble du problème 🙂

    #109924 quote
    Sebastien Boissel
    Participant
    New
    defparam cumulateorders=false
    DEFPARAM FLATBEFORE = 090000
    DEFPARAM FLATAFTER = 173000
    
    Tenkansen=0
    Kijunsen=0
    Sspa=0
    Sspb=0
    a=3
     
    // Money Management
    
    SET STOP pLOSS 10
    startBreakeven = 10
    PointsToKeep = 0
    
    // ICHIMOKU
    
    Tenkansen = (highest[9](high)+lowest[9](low))/2
    Kijunsen = (highest[26](high)+lowest[26](low))/2
    SspA = (Tenkansen[26]+Kijunsen[26])/2
    SspB = (highest[52](high[26])+lowest[52](low[26]))/2
      
    //  Achat
    
    a1 = close[5] = sspa - sspb
    a2 = close > kijunsen and close > sspa and close > sspb
    a3 = close CROSSES OVER kijunsen and close > sspa and close > sspb
    a4 = close CROSSES OVER sspa and close > kijunsen and close > sspb
    a5 = close CROSSES OVER sspb and close > sspa and close > kijunsen
    IF a1 and a2 AND a3 or a4 or a5 THEN
    testea = 1
    else
    testea = 0
    endif
    if testea = 1 then
    BUY a CONTRACTS AT high stop
    ENDIF
    
    // vente
    
    v1 = close[5] = sspa -sspb
    v2 = close < kijunsen and close < sspa and close < sspb
    v3 = close CROSSES under kijunsen and close < sspa and close < sspb
    v4 = close CROSSES under sspa and close < kijunsen and close < sspb
    v5 = close CROSSES under sspb and close < sspa and close < kijunsen
    IF v1 and v2 AND v3 or v4 or v5 THEN
    testev = 1
    else
    testev = 0
    endif
    if testev = 1 then
    SELLSHORT a CONTRACT AT low stop
    ENdIF
    
    // fermeture achat
    
    fa1 = close < kijunsen
    fa2 = close[1] > close
    if fa1 and fa2 then
    testefa = 1
    else
    testefa = 0
    endif
    if testefa = 1 then
    sell AT low stop
    ENDIF
    
    // fermeture vente
    
    fv1 = close > kijunsen
    fv2 = close[1] < close
    if fv1 and fv2 then
    testefv = 1
    else
    testefv = 0
    endif
    if testefv = 1 then
    exitshort AT high stop
    ENDIF
    
    // remise à zero breakeven
    
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ENDIF
    
    // breakeven
    
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN
    breakevenLevel = tradeprice(1)+PointsToKeep*pipsize
    ENDIF
    
    IF breakevenLevel>0 THEN
    SELL AT breakevenLevel STOP
    ENDIF
    
    IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven*pipsize THEN
    breakevenLevel = tradeprice(1)-PointsToKeep*pipsize
    ENDIF
    
    IF breakevenLevel>0 THEN
    EXITSHORT AT breakevenLevel STOP
    ENDIF

    voici mon code complet

    #109931 quote
    Nicolas
    Keymaster
    Master

    Un order conditionnel de type STOP restera valide durant une seule période/bougie, si tu veux qu’ils restent à un certain niveau durant plusieurs bougies, alors il faudra les placer continuellement (en fonction des conditions que tu établiras bien entendu..). Les fermetures que tu as programmé aux lignes 66 et 79 avec les ordres STOP, sont placés uniquement à la bougie suivante, quand les variables “testefv” et “testefa” sont vrais. Si à la bougie qui suit ces variables sont fausses, alors l’ordre de fermeture STOP ne sera pas placé à nouveau. Il faut donc revoir la logique pour ceux-ci.

    #109943 quote
    Sebastien Boissel
    Participant
    New

    malheureusement je code depuis 3 semaines et très honnêtement je ne vois pas vraiment comment faire. si vous pouviez prendre le temps de me mettre sur la vois. je vous en serais très reconnaissant.

    #110104 quote
    Sebastien Boissel
    Participant
    New

    bonjours, j’ai reussi à modifier mon code, je voudrais savoir si il est possible de décaler la prise de position ainsi que la sortie de 1 point? merci

    #110111 quote
    Nicolas
    Keymaster
    Master

    Pour acheter 1 point plus haut que le High, tu peux modifier le code comme ceci:

    BUY a CONTRACTS AT high+1*pointsize stop

    Pour les sorties, ce sera pareil:

    sell AT low-1*pointsize stop
    #110245 quote
    Sebastien Boissel
    Participant
    New

    Bonjour, je rencontre toujours le même problème le robot ne sort plus de position. avait une solution?

    #110248 quote
    Nicolas
    Keymaster
    Master

    Je ne sais pas ce qui a était modifié, une solution … pour que je le sache ?

    A nouveau, un ordre conditionnel est valable durant une seule bougie, si il n’est pas renouvelé, il n’y aura pas d’ordres permettant de sortir (hormis un ordre contrarien bien entendu).

    Par exemple, si la condition “testefa” n’est pas valide, aucun ordre de vente ne sera placé à la bougie suivante, donc rien ne fera sortir le robot de sa position d’achat !

    Tu devrais grapher ces conditions en backtest pour bien comprendre :

    GRAPH testefa coloured(0,255,0)
    GRAPH testefv coloured(255,0,0)
    #110263 quote
    Sebastien Boissel
    Participant
    New

    dans un 1er temps je tiens à vous dire que le code fonction très bien sur probactest mais que des que je l’active sur proorder il ne sort plus de positon. merci

    defparam cumulateorders=false
    DEFPARAM FLATBEFORE = 090000
    DEFPARAM FLATAFTER = 173000
    
    Tenkansen=0
    Kijunsen=0
    Sspa=0
    Sspb=0
    l=1
     
    // Money Management
    
    SET TARGET pPROFIT 20
    SET STOP pLOSS 10
    startBreakeven = 10
    PointsToKeep = 0
    
    // ICHIMOKU
    
    Tenkansen = (highest[9](high)+lowest[9](low))/2
    Kijunsen = (highest[26](high)+lowest[26](low))/2
    SspA = (Tenkansen[26]+Kijunsen[26])/2
    SspB = (highest[52](high[26])+lowest[52](low[26]))/2
      
    //  Achat
    
    a1 = close[5] < sspa or close[5] < sspb
    a2 = close CROSSES OVER kijunsen and close > sspa and close > sspb
    a3 = close CROSSES OVER sspa and close > kijunsen and close > sspb
    a4 = close CROSSES OVER sspb and close > sspa and close > kijunsen
    for a = 0 to 5 do
    if close[a] > kijunsen[a] and close[a] > sspa[a] and close[a] > sspb[a] then
    testea = 1
    else
    testea = 0
    endif
    IF testea = 1 and a1 and a2 or a3 or a4 THEN
    BUY l CONTRACTS AT high+0.2*pointsize stop
    endif
    next
    
    // vente
    
    v1 = close[5] > sspa or close[5] > sspb
    v2 = close CROSSES under kijunsen and close < sspa and close < sspb
    v3 = close CROSSES under sspa and close < kijunsen and close < sspb
    v4 = close CROSSES under sspb and close < sspa and close < kijunsen
    for v = 0 to 5 do
    if close[v] < kijunsen[v] and close[v] < sspa[v] and close[v] < sspb[v] then
    testev = 1
    else
    testev = 0
    endif
    IF testev = 1 and v1 and v2 or v3 or v4 THEN
    SELLSHORT l CONTRACTS AT low-0.2*pointsize stop
    endif
    next
    
    // fermeture achat
    
    fa1 = close[1] > close
    fa2 = close < kijunsen
    for x = 0 to 5 do
    if close[x] crosses under kijunsen[x]then
    testefa = 1
    else
    testefa = 0
    endif
    if testefa = 1 and fa1 and fa2 then
    sell AT low-0.2*pointsize stop
    ENDIF
    next
    
    // fermeture vente
    
    fv1 = close[1] < close
    fv2 = close > kijunsen
    for c = 0 to 5 do
    if close[c] crosses over kijunsen[c]then
    testefa = 1
    else
    testefa = 0
    endif
    if testefa = 1 and fv1 and fv2 then
    exitshort AT high+0.2*pointsize stop
    ENDIF
    next
    
    // remise à zero breakeven
    
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ENDIF
    
    // breakeven
    
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN
    breakevenLevel = tradeprice(1)+PointsToKeep*pipsize
    ENDIF
    
    IF breakevenLevel>0 THEN
    SELL AT breakevenLevel STOP
    ENDIF
    
    IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven*pipsize THEN
    breakevenLevel = tradeprice(1)-PointsToKeep*pipsize
    ENDIF
    
    IF breakevenLevel>0 THEN
    EXITSHORT AT breakevenLevel STOP
    ENDIF
    
    #110317 quote
    Nicolas
    Keymaster
    Master

    il ne sort plus de positon

    c’est à dire ? Il en crée et il ne sort pas de position ? (sortir = fermer la position)

    #110318 quote
    Sebastien Boissel
    Participant
    New

    Bonjour, il attend forcement de toucher le stop ou le breakeven. plus de sorti avec les conditions. pour la création tous fonction bien

    #110321 quote
    Nicolas
    Keymaster
    Master

    il faut regarder dans les ordres rejetés (liste des ordres dans la plateforme). Quel est l’instrument ? La distance au stop n’est peut être pas respecté, 0.2 * pointsize ça revient à 0.2 points sur le DAX par exemple ..

    #110322 quote
    Sebastien Boissel
    Participant
    New

    je travail sur le dax et le dow.

    #110324 quote
    Sebastien Boissel
    Participant
    New

    je ne c pas vraiment comment l’interpréter.

    Sans-titre-1.pdf
Viewing 15 posts - 16 through 30 (of 33 total)
  • You must be logged in to reply to this topic.

prise de position au dépassement de la Mèche


ProOrder : Trading Automatique & Backtests

New Reply
Author
Summary

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

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 09/28/2019
Status: Active
Attachments: 2 files
Logo Logo
Loading...