Stop and reverse

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #157523 quote
    Guibourse
    Participant
    Average

    Bonjour à tous,

    J’aimerais créer une fonction stop and reverse et n’ai trouvé la fonction nulle part pour l’instant. Elle consiste à ouvrir un ordre inverse immédiatement après qu’un ordre est fermé. Pour ma part le code est dans le sens des ordres longs : il s’agirait donc d’ouvrir des ordres courts à chaque fois que mes ordres longs sont fermés, jusqu’à ce qu’un ordre long soit ouvert par l’algorithme. Si vous pouviez m’aider je vous en serait reconnaissant. Merci d’avance !

    #157539 quote
    Nicolas
    Keymaster
    Master

    Comment sont fermés les ordres longs par l’algorithme en question ?

    #157543 quote
    Guibourse
    Participant
    Average

    Ils sont fermés par croisement (oscillateur Rex) sous condition (variable) + SL.

    Code :

    indicator4, indicator5 = CALL “Rex oscillateur”
    c3 = (indicator4 CROSSES UNDER indicator5)
    indicator6, ignored = CALL “Rex oscillateur”
    c4 = (indicator6 > a)

    IF c3 AND c4 THEN
    SELL AT MARKET
    ENDIF
    set stop ptrailing s

    #157550 quote
    Guibourse
    Participant
    Average
    // Conditions pour fermer une position acheteuse
    indicator4, indicator5 = CALL "Rex oscillateur"
    c3 = (indicator4 CROSSES UNDER indicator5)
    indicator6, ignored = CALL "Rex oscillateur"
    c4 = (indicator6 > a)
    
    IF c3 AND c4 THEN
    SELL AT MARKET
    ENDIF
    set stop ploss s
    #157562 quote
    Nicolas
    Keymaster
    Master

    Donc autant lancer un ordre SELLSHORT au lieu de fermer l’ordre d’achat, cela le fermera automatiquement :

    IF LONGONMARKET AND c3 AND c4 THEN
     SELLSHORT AT MARKET
    ENDIF
    Guibourse thanked this post
    #160663 quote
    pavix
    Participant
    Average

    Donc autant lancer un ordre SELLSHORT au lieu de fermer l’ordre d’achat, cela le fermera automatiquement :

    de l’importance de lire l’ensemble des messages !!!

    cette nuance m’était inconnue et explique mon souci actuel sur une stratégie !!

    merci encore

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

Stop and reverse


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
Guibourse @guibourse Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by pavix
5 years, 1 month ago.

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