Définir taille de position maximum dans une martingale

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #115311 quote
    Melio33
    Participant
    New

    Bonjour j’aimerais limiter la taille de position d’une martingale, (en partant de 1 aller jusqu’a 8 max). Je sais que c’est possible de mettre une taille de position max de 8 lorsque l’on lance le système, cependant je cherche un bout de code qui pourrait faire de même afin de pouvoir backtest.

    Voici les lignes importantes du code :

    //La prise de position :

    BUY ordersize CONTRACT AT MARKET

    //A la fin du code

    IF Barindex = ExitIndex + 1 THEN
    ExitIndex = 0
    IF PositionPerf(1) < 0 THEN
    OrderSize = OrderSize * 2
    //REMSi le dernier trade était perdant, alors on double la taille de la position
    ELSIF PositionPerf(1) > 0 THEN
    OrderSize = 1
    ENDIF

     

     

    Merci d’avance

    #115313 quote
    robertogozzi
    Moderator
    Master

    Vous pouvez remplacer votre commande BUY par ceci:

    BUY min(8,ordersize) CONTRACT AT MARKET
    #115316 quote
    Melio33
    Participant
    New

    Merci beaucoup !

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

Définir taille de position maximum dans une martingale


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
Melio33 @melio33 Participant
Summary

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

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