AIDE LIGNE DE CODE AUGMENTATION TAILLE POSITION LIMITE A 3 CONTRATS

Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #58946 quote
    LOUIS WILLIAMLOUIS WILLIAM
    Participant
    Junior

    Bonsoir à tous je voudrais avoir la ligne de code pour augmenter la taille des position mais le limiter à 3 contrats.

    Merci par avance pour votre aide.

    #58982 quote
    NicolasNicolas
    Keymaster
    Legend

    Augmenter la taille des contrats en fonction de quoi ?

    #59059 quote
    LOUIS WILLIAMLOUIS WILLIAM
    Participant
    Junior

    Augmenter la taille des contrats en fonction du gain de 25 % par exemple pour 1000 eur de depart

    #59061 quote
    NicolasNicolas
    Keymaster
    Legend

    Donc à chaque fois que l’on gagne 25% donc on ajoute 1 contrat ? Avec un maximum de 3.  Désolé, mais j’aimerai que ce soit précis pour ne pas perdre de temps, merci.

    #59073 quote
    LOUIS WILLIAMLOUIS WILLIAM
    Participant
    Junior

    OUI C BIEN CA LIMITE A  3 CONTRATS QUE JE PEUX CHANGER SI JE VEUX PASSER A 4 OU 5… POUR L’INSTANT JE VOUDRAIS LE LIMITER A 3 CONTRATS

    #59078 quote
    NicolasNicolas
    Keymaster
    Legend

    Ok j’ai compris, mais inutile d’écrire en majuscule 🙂

    Très bien, dans le cas du code suivant il faut indiquer dans la variable “balance”, la taille du compte en argent au lancement de la stratégie. Ici par défaut à 1000€ donc.

    balance = 1000
    Once taille=1
    // ---
    mprofit = balance+strategyprofit
    
    // calcul de la taille du contrat 
    if mprofit>=lastprofit*1.25 then 
     taille = taille+1
     lastprofit=mprofit
    endif 
    
    // stratégie de trading 
    if buycondition then 
     buy min(taille,3) contract at market 
    endif 
    
    

    Je n’ai pas testé, il faudra l’intégrer à une stratégie et visualiser le résultat en backtest. Merci par avance pour le retour.

    #59079 quote
    LOUIS WILLIAMLOUIS WILLIAM
    Participant
    Junior

    OK MERCI JE VAIS L’ESSAYER DE SUITE ET JE TE TIENS AU COURANT

    #59080 quote
    LOUIS WILLIAMLOUIS WILLIAM
    Participant
    Junior

    POUR INFO ENTRE TEMPS J’AI RECUPERER CE CODE QUI POURRAIT FAIRE L’AFFAIRE MAIS LE PROBLEM C’EST QU’ IL Y A PAS DE LIMITE DE CONTRATS, L’IDEAL C JUSTE DE METTRE UNE LIMITE DE CONTRAT QUE L’ON PEUT PARAMETRER, EST CE QUE TU PENSES QUE C FAISABLE ?

    JE SUIS TOUJOURS ENTRAIN D’ESSAYER LE CODE QUE TU M’AS DONNE, C PAS FACILE, IL FAUT QUE J’ARRIVE A L’INTEGRER DANS MON SYSTEME ET ETRE COHERENT

    TaillePosition = max(1,1+ROUND((strategyprofit)/500))
    #59099 quote
    NicolasNicolas
    Keymaster
    Legend

    Ce code ajoute 1 contrat à chaque fois que la stratégie gagne 500 euros.

    #59106 quote
    LOUIS WILLIAMLOUIS WILLIAM
    Participant
    Junior

    J’AI BIEN COMPRIS ET JE SUIS, EST CE QU’ON PEUT LE MODIFIER POUR LE LIMITER A 3 CONTRATS PAR EXEMPLE CAR SI ON LE LAISSE TOURNER IL AUGMENTE LES CONTRATS SANS LIMITE ?

    #59108 quote
    LOUIS WILLIAMLOUIS WILLIAM
    Participant
    Junior

    BONSOIR NICOLAS,

    JE REVIENS VERS TOI POUR LE BACKTEST DU CODE LIMITE A 3 CONTRATS QUE TU M’AS DONNE ET CA MARCHE IMPECCABLE, IL PART DE 1 CONTRACT POUR ETRE LIMITE A 3 CONTRATS COMME JE TE L’AVAIS DEMANDE, MERCI A TOI

    EST CE QUE DANS CE CODE LORSQU’IL SUBIT DES PERTES IL REDESCENDS A 2 CONTRATS OU 1 CONTRAT SI BESOIN ?

    #59143 quote
    NicolasNicolas
    Keymaster
    Legend

    EST CE QUE DANS CE CODE LORSQU’IL SUBIT DES PERTES IL REDESCENDS A 2 CONTRATS OU 1 CONTRAT SI BESOIN ?

    Non, si on ne le demande pas, je le code pas 🙂 Ton clavier est bloqué sur les lettres majuscules on dirait ?

    #59307 quote
    LOUIS WILLIAMLOUIS WILLIAM
    Participant
    Junior

    Bonsoir Nicolas,

    J’aimerais compléter dans le code, lorsqu’il subit des pertes il redescends à 2 contrats ou revenir à un contrat si besoin, est ce que tu peux m’aider à le finaliser ?

    Merci par avance pour ton aide.

    #59545 quote
    NicolasNicolas
    Keymaster
    Legend

    Voilà ce que je peux te proposer rapidement (pas tester, à vérifier dans ta stratégie, merci).

    balance = 1000
    Once taille=1
    // ---
    mprofit = balance+strategyprofit
    
    // calcul de la taille du contrat 
    if mprofit>lastprofit*1.25 then 
     taille = taille+1
     lastprofit=mprofit
    elsif mprofit<lastprofit then 
     taille = taille-1
     taille = max(1,taille)
     lastprofit=mprofit
    endif
    
    // stratégie de trading 
    if buycondition then 
     buy min(taille,3) contract at market 
    endif
    #59546 quote
    InertiaInertia
    Participant
    Master

    Pas mal Nicolas…merci.

Viewing 15 posts - 1 through 15 (of 24 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

AIDE LIGNE DE CODE AUGMENTATION TAILLE POSITION LIMITE A 3 CONTRATS


ProOrder : Trading Automatique & Backtests

New Reply
Author
Summary

This topic contains 23 replies,
has 3 voices, and was last updated by LOUIS WILLIAMLOUIS WILLIAM
8 years, 9 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 01/11/2018
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...