Aucun ordre d’achat passé

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #139383 quote
    Yvan63
    Participant
    Senior

    Bonsoir,

    Dans le code ci-dessous, si je laisse le bloc

    //Sortie du TRADE si TP atteint
    if Close-TRADEPRICE(1)>TP then
    SELL AT MARKET
    ENDIF

    aucun ordre n’est passé  !!
    Je n’ai jamais rencontré ce genre de problème…
    C’est à y perdre son latin !

    // UT = 15 minutes
    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    
    TP = 10 // Take profit
    SL = 20// Stop loss
    
    //RS = RSI[10](close)
    //sto = Stochastic[10,3](close)
    
    // Conditions pour ouvrir une position acheteuse #1
    
    c1 = open > close[1] and open < close // Un open de bougie verte > close bouge précédente
    
    c2 = close[1] < open[1] and close[1]-low[1] > 9 // Bougie précédente rouge avec une mèche de 10 points
    
    C3 = C1 and C2 and NOT LongOnMarket
    
    IF C3  THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    //Sortie du TRADE si TP atteint
    if Close-TRADEPRICE(1)>TP then
    SELL AT MARKET
    ENDIF
    
    SET STOP pLOSS SL // Protection
    #139385 quote
    robertogozzi
    Moderator
    Master

    Changez la ligne 23 avec celle-ci:

    if Close-TRADEPRICE(1)>TP AND OnMArket then

    car lorsque votre stratégie commencera, TRADEPRICE (1) sera égal à 0, donc CLOSE-TRADEPRICE (1) sera TOUJOURS > TP et il n’entrera jamais dans une transaction.

    Yvan63 thanked this post
    #139397 quote
    Yvan63
    Participant
    Senior

    Cela fonctionne, merci !!!
    Mais je ne comprends pas pourquoi cela empêchait l’achat ?

    #139403 quote
    robertogozzi
    Moderator
    Master

    À votre version originale, ajoutez à la fin

    Graph Close-TRADEPRICE(1)

    et observez le résultat bougie par bougie pour voir si> TP.

    #139422 quote
    Yvan63
    Participant
    Senior

    Je vais tester cela ce soir dés que possible.
    Par contre, pour la compréhension, en quoi ce bloc d’instructions bloque l’achat qui est indépendant ??
    Visiblement non …

    #139426 quote
    robertogozzi
    Moderator
    Master

    Car lorsque votre stratégie commencera, TRADEPRICE (1) sera égal à 0, donc CLOSE-TRADEPRICE (1) sera TOUJOURS > TP et il n’entrera jamais dans une transaction.

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

Aucun ordre d’achat passé


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
Yvan63 @yvan63 Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by robertogozzi
5 years, 8 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 07/15/2020
Status: Active
Attachments: No files
Logo Logo
Loading...