Tp et SL +/- 1 Point/pips

Viewing 9 posts - 16 through 24 (of 24 total)
  • Author
    Posts
  • #114762 quote
    Ramahu
    Participant
    Senior

    De meme qu’il y a un probleme ici de TP .. le decalage est plus qu’enorme.. Est ce normal pour toi ? Merci

    Sans-titre-6.png Sans-titre-6.png
    #114768 quote
    Nicolas
    Keymaster
    Master

    Tu as peut être mal réorganisé le code dans ta stratégie, dans le doute voici ma version:

    defparam cumulateorders=false
    
    //ACHAT
    conditionachat= rsi[14] crosses over 50
    
    if conditionachat then
     stoploss = low[0]-1*pointsize //niveau prix du SL
     buy at market
     sell at stoploss stop
     set target profit (close-(low[0]-1*pointsize))*2
    endif
    if longonmarket then 
     sell at stoploss stop 
     set target profit (positionprice-stoploss)*2
    endif
    
    //VENTE 
    conditionvente= rsi[14] crosses under 50
    
    if conditionvente then
     stoploss = high[0]+1*pointsize //niveau prix du SL
     sellshort at market
     sell at stoploss stop
     set target profit ((high[0]+1*pointsize)-close)*2
    endif
    if shortonmarket then 
     exitshort at stoploss stop 
     set target profit (stoploss-positionprice)*2
    endif
    
    graphonprice stoploss coloured(255,0,0)

    (Non testé).

    #114773 quote
    Ramahu
    Participant
    Senior

    Alors oui ca y est les TP ont l’air tous respectés BUY comme SHORT, mais les SL bougent et certains sont fermé bcp tro tot ..

    exemple en photo

    Sans-titre-7.png Sans-titre-7.png
    #114775 quote
    Ramahu
    Participant
    Senior

    Je te donne mon code Short, si tu vois une incohérence.

    // Définition des paramètres du code
    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    // Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".
    DEFPARAM FLATBEFORE = 080000
    // Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"
    DEFPARAM FLATAFTER = 120000
    
    // Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Conditions pour ouvrir une position en vente à découvert
    indicator12 = RSI[13](close)
    indicator13 = Average[7](indicator12)
    c7 = (indicator12 CROSSES UNDER indicator13)
    indicator14 = RSI[13](close)
    c8 = (indicator14 < indicator14[1])
    indicator15 = Average[7](RSI[13](close))
    indicator16 = indicator15
    c9 = (indicator15 < indicator16[1])
    indicator17 = Average[35](RSI[13](close))
    indicator18 = indicator17
    c10 = (indicator17 < indicator18[1])
    indicator19 = Average[7](RSI[13](close))
    indicator20 = Average[35](RSI[13](close))
    c11 = (indicator19[1] < indicator20[1])
    indicator21 = RSI[13](close)
    indicator22 = Average[35](indicator21)
    c12 = (indicator21[1] < indicator22[1])
    
    IF (c7 AND c8 AND c9 AND c10 AND c11 AND c12) AND not daysForbiddenEntry THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions pour fermer une position en vente à découvert
    if (c7 AND c8 AND c9 AND c10 AND c11 AND c12) AND not daysForbiddenEntry THEN
    stoploss = high[0]+1*pointsize //niveau prix du SL
    sellshort at market
    sell at stoploss stop
    set target profit ((high[0]+1*pointsize)-close)*2
    endif
    if shortonmarket then
    exitshort at stoploss stop
    set target profit (stoploss-positionprice)*2
    endif
     
    
    #114795 quote
    Nicolas
    Keymaster
    Master

    En effet, on recalcule le stoploss même si on est déjà au marché, il faut vérifier qu’on ne l’ai pas avant. Par contre dans ton code tu passes 2 fois l’instruction pour lancer un ordre, inutile.

    // Définition des paramètres du code
    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    // Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".
    DEFPARAM FLATBEFORE = 080000
    // Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"
    DEFPARAM FLATAFTER = 120000
    
    // Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Conditions pour ouvrir une position en vente à découvert
    indicator12 = RSI[13](close)
    indicator13 = Average[7](indicator12)
    c7 = (indicator12 CROSSES UNDER indicator13)
    indicator14 = RSI[13](close)
    c8 = (indicator14 < indicator14[1])
    indicator15 = Average[7](RSI[13](close))
    indicator16 = indicator15
    c9 = (indicator15 < indicator16[1])
    indicator17 = Average[35](RSI[13](close))
    indicator18 = indicator17
    c10 = (indicator17 < indicator18[1])
    indicator19 = Average[7](RSI[13](close))
    indicator20 = Average[35](RSI[13](close))
    c11 = (indicator19[1] < indicator20[1])
    indicator21 = RSI[13](close)
    indicator22 = Average[35](indicator21)
    c12 = (indicator21[1] < indicator22[1])
    
    // Conditions pour fermer une position en vente à découvert
    if not shortonmarket and (c7 AND c8 AND c9 AND c10 AND c11 AND c12) AND not daysForbiddenEntry THEN
     stoploss = high[0]+1*pointsize //niveau prix du SL
     SELLSHORT 1 CONTRACT AT MARKET
     exitshort at stoploss stop
     set target profit ((high[0]+1*pointsize)-close)*2
    endif
    if shortonmarket then
     exitshort at stoploss stop
     set target profit (stoploss-positionprice)*2
    endif
    #114816 quote
    Ramahu
    Participant
    Senior

    Parfait !! (y) tout est ok pour ce code. tout est respecté les SL, les TP X2 (+spread) etc ..

    Qu’est ce qui cloche avec l’achat du coup s’il te plait ?

    D’un jour à l’autre, d’une position à une autre il respecte tout puis plus rien ..

     

    // Définition des paramètres du code
    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    // Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".
    DEFPARAM FLATBEFORE = 080000
    // Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"
    DEFPARAM FLATAFTER = 120000
    
    // Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Conditions pour ouvrir une position acheteuse
    indicator1 = RSI[13](close)
    indicator2 = Average[7](indicator1)
    c1 = (indicator1 CROSSES OVER indicator2)
    indicator3 = RSI[13](close)
    c2 = (indicator3 > indicator3[1])
    indicator4 = Average[7](RSI[13](close))
    indicator5 = indicator4
    c3 = (indicator4 > indicator5[1])
    indicator6 = Average[35](RSI[13](close))
    indicator7 = indicator6
    c4 = (indicator6 > indicator7[1])
    indicator8 = Average[7](RSI[13](close))
    indicator9 = Average[35](RSI[13](close))
    c5 = (indicator8[1] > indicator9[1])
    indicator10 = RSI[13](close)
    indicator11 = Average[35](indicator10)
    c6 = (indicator10[1] > indicator11[1])
    
    IF (c1 AND c2 AND c3 AND c4 AND c5 AND c6) AND not daysForbiddenEntry THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions pour fermer une position acheteuse
    if (c1 AND c2 AND c3 AND c4 AND c5 AND c6) AND not daysForbiddenEntry then
    stoploss = low[0]-1*pointsize //niveau prix du SL
    buy at market
    sell at stoploss stop
    set target profit (close-(low[0]-1*pointsize))*2
    endif
    if longonmarket then
    sell at stoploss stop
    set target profit (positionprice-stoploss)*2
    endif
     
    
    #115119 quote
    Ramahu
    Participant
    Senior

    Salut, J’ai essayé de me débrouiller seul, en cherchant sur le forum et inversant les mots etc .. c’est pire qu’avant ^^ mon code BUY n,’est pas du tout au point..

    Si tu passe par la je t’en remercie d’avance.

    #115174 quote
    Nicolas
    Keymaster
    Master

    A tester cette version pour les achats: (au passage j’ai corrigé une petite coquille dans la version vente dans mon dernier message).

    // Définition des paramètres du code
    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    // Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".
    DEFPARAM FLATBEFORE = 080000
    // Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"
    DEFPARAM FLATAFTER = 120000
    
    // Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Conditions pour ouvrir une position acheteuse
    indicator1 = RSI[13](close)
    indicator2 = Average[7](indicator1)
    c1 = (indicator1 CROSSES OVER indicator2)
    indicator3 = RSI[13](close)
    c2 = (indicator3 > indicator3[1])
    indicator4 = Average[7](RSI[13](close))
    indicator5 = indicator4
    c3 = (indicator4 > indicator5[1])
    indicator6 = Average[35](RSI[13](close))
    indicator7 = indicator6
    c4 = (indicator6 > indicator7[1])
    indicator8 = Average[7](RSI[13](close))
    indicator9 = Average[35](RSI[13](close))
    c5 = (indicator8[1] > indicator9[1])
    indicator10 = RSI[13](close)
    indicator11 = Average[35](indicator10)
    c6 = (indicator10[1] > indicator11[1])
    
    
    if not longonmarket and (c1 AND c2 AND c3 AND c4 AND c5 AND c6) AND not daysForbiddenEntry then
    stoploss = low[0]-1*pointsize //niveau prix du SL
    BUY 1 CONTRACT AT MARKET
    sell at stoploss stop
    set target profit (close-(low[0]-1*pointsize))*2
    endif
    if longonmarket then
    sell at stoploss stop
    set target profit (positionprice-stoploss)*2
    endif
    #115266 quote
    Ramahu
    Participant
    Senior

    Ca à l’air de fonctionner correctement pour le BUY super (y), pour le short aussi c’est fou comme les résultats ont changés (en mieux) rien qu’avec cette correction sans pour autant jouer sur les trades .. je ne comprends pas

Viewing 9 posts - 16 through 24 (of 24 total)
  • You must be logged in to reply to this topic.

Tp et SL +/- 1 Point/pips


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
Ramahu @ramahu Participant
Summary

This topic contains 23 replies,
has 2 voices, and was last updated by Ramahu
6 years, 2 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 12/07/2019
Status: Active
Attachments: 10 files
Logo Logo
Loading...