Objectif de profit pour une quantite precise

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #217560 quote
    trading2trading2
    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
    NicolasNicolas
    Keymaster
    Legend

    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
    trading2trading2
    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 trading2trading2
3 years, 4 months ago.

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