Objectif de profit pour une quantite precise

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #217560 quote
    trading2
    Participant
    Junior

    Bonjour à tous,

    Novice en programmation je cherche dans le cadre d’une stratégie automatique sur future avec IB à programmer un take profit mais sur une quantite précise.

    Par exemple soit une position prise avec une quantité de 6 contrats sortir avec un take profit de 10 points mais uniquement sur 3 contrats et laisser courir les 3 autres contrats pour sortir sous une autre condition

     

    Je vois bien l’instruction SET TARGET pPROFIT 10 mais je ne vois pas comment preciser sur uniquement 3 contrats.

    Vous remerciant à l’avance

    #217769 quote
    Nicolas
    Keymaster
    Master

    Pour cela, on doit exécuter une sortie partielle, dans ton cas précis voici le code à adapter à ta stratégie :

    if not onmarket then 
     partial = 0 //reset état sortie partielle
    endif 
    
    if not partial and close-tradeprice>=10*pointsize then 
     //sortir avec un take profit de 10 points mais uniquement sur 3 contrats
     sell 3 contracts at market 
     partial = 1 //sortie partielle faite ! 
    endif
    #217805 quote
    trading2
    Participant
    Junior

    Super, Merci beaucoup Nicolas,  🙂

    Je vais essayer cela

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

Objectif de profit pour une quantite precise


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
trading2 @trading2 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by trading2
2 years, 7 months ago.

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