coder un pourcentage de meches

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #193225 quote
    Marlaynicolas
    Participant
    New

    Bonjour,

    Voici ce j’essaie d’intégrer dans ma stratégie

    je voudrais sur une stratégie unité de temps 5minutes indexé dans mon algo la prise en compte le pourcentage des mèches haute et basse par rapport au corps.

    Exemple si la mèche haute dépasse un certains pourcentage par rapport au corps je passe à la vente et pareil pour l’achat.

    Dans l’attente de vous lire

    merci

    #193243 quote
    Nicolas
    Keymaster
    Master

    ratio de la mèche haute vis à vis du corps:

    ratioHaut = (high-max(open,close)) / abs(open-close)
    #193262 quote
    Marlaynicolas
    Participant
    New

    merci nicolas

    pourrais tu me dire comment l’intégrer dans ma stratégie je débute dans les algos je me débrouille mais je suis encore loin de vos qualités.

    je voudrais mettre par exemple si la mèche haute est entre 55% et 80% plus grosse que le corps de la bougies je passe à la vente et l’inverse si la mèche basse est entre 55 et 80% .

    c’est ce que je voudrais insérer dans ma stratégie parce que j’ai remarqué que j’avais des prises de positions perdante suite à ce que j’ai pu voir.

    merci de ton retour

    #193264 quote
    Marlaynicolas
    Participant
    New

    je voudrais te partager la stratégie mais mon partage n’apparait pas. désolé de te déranger excuse moi d’avance.

    #193267 quote
    Nicolas
    Keymaster
    Master

    C’est une division entre (la distance entre le High et le plus haut entre le Open ou Close de la bougie) et (la taille du corps de la bougie), soit un ratio, tu peux le multiplier par 100 si tu préfères une valeur en pourcentage.

    Voilà ce que ça pourrait donner pour la vente :

    ratioHaut = (high-max(open,close)) / abs(open-close)
    
    if ratiohaut > .5 and ratiohaut < .8 and not shortonmarket then 
     sellshort 1 contract at market 
    endif

    et pour l’achat avec la mèche basse :

    ratioBas = (min(open,close)-low) / abs(open-close) 
    
    if ratiobas > .5 and ratiobas < .8 and not longonmarket then 
     buy 1 contract at market 
    endif
    Marlaynicolas thanked this post
    #193296 quote
    Marlaynicolas
    Participant
    New

    Bonjour nicolas,

    Merci pour ton retour . Je vais tester cela . merci pour ton travail et ton dévouement pour les personnes comme moi.

    #193347 quote
    Marlaynicolas
    Participant
    New

    Voici mon algo avec ichimokou sur grah 5 à l’achat sur le nasdaq. J’avais esseyé d’intégrer des prises à la vente mais le résultat était pas bon.

    Je voudrais améliorer sa rentabilité et avec tes connaissances je pense que d’intégrer le pourcentage de mèches avec le corps pourrait améliorer le résultat mais je voudrais avoir ton avis

    Ici le résultat est meilleur si tu désactives le defparam flatafter 23000.

    Comme tu vas voir dans le backtest il y a les pertes que je voudrais simplement réduire. Si tu pouvais apporter ton génie dessus.

    Merci encore pour ce site déchange c’est vraiment très agréable de pouvoir échanger autant avec des personnes doués.

    Ah oui j’allais oublié j’ai un algo construit sur le rsi en graph 30 sec qui m’a l’air assez performant sur 7 jours mais je voudrais pouvoir voir sur un mois ou deux et je ne peux pas je dois noter tout à la main. Est ce que je peux te l’envoyer afin de travailler dessus pour également réduire la perte dessus?

    // Définition des paramètres du code
    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    // Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"
    DEFPARAM FLATAFTER = 223000
    
    // Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position avant l'heure spécifiée
    noEntryBeforeTime = 153000
    timeEnterBefore = time >= noEntryBeforeTime
    
    // Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position après l'heure spécifiée
    noEntryAfterTime = 223000
    timeEnterAfter = time < noEntryAfterTime
    
    // Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Conditions pour ouvrir une position acheteuse
    indicator1 = SenkouSpanB[9,26,52]
    c1 = (close CROSSES OVER indicator1)
    indicator2 = SenkouSpanA[9,26,52]
    c2 = (close CROSSES OVER indicator2)
    
    IF (c1 AND c2) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    
    
    // Stops et objectifs
    SET STOP pTRAILING 200
    SET TARGET pPROFIT 190
    IF Not OnMarket THEN
    //
    // when NOT OnMarket reset values to default values
    //
    TrailStart    = 90          //30     Start trailing profits from this point
    BasePerCent   = 0.000       //20.0%  Profit percentage to keep when setting BerakEven
    StepSize      = 10          //10     Pip chunks to increase Percentage
    PerCentInc    = 0.100       //10.0%  PerCent increment after each StepSize chunk
    BarNumber     = 10          //10     Add further % so that trades don't keep running too long
    BarPerCent    = 0.100       //10%    Add this additional percentage every BarNumber bars
    RoundTO       = -0.5        //-0.5   rounds always to Lower integer,   +0.4 rounds always to Higher integer,     0 defaults PRT behaviour
    PriceDistance = 7 * pipsize //7      minimun distance from current price
    y1            = 0           //reset to 0
    y2            = 0           //reset to 0
    ProfitPerCent = BasePerCent //reset to desired default value
    TradeBar      = BarIndex
    ELSIF LongOnMarket AND close > (TradePrice + (y1 * pipsize)) THEN                              //LONG positions
    //
    // compute the value of the Percentage of profits, if any, to lock in for LONG trades
    //
    x1 = (close - tradeprice) / pipsize                                     //convert price to pips
    IF x1 >= TrailStart THEN                                                //    go ahead only if N+ pips
    Diff1         = abs(TrailStart - x1)                                 //difference from current profit and TrailStart
    Chunks1       = max(0,round((Diff1 / StepSize) + RoundTO))           //number of STEPSIZE chunks
    ProfitPerCent = BasePerCent + (BasePerCent * (Chunks1 * PerCentInc)) //compute new size of ProfitPerCent
    // compute number of bars elapsed and add an additionl percentage
    // (this percentage is different from PerCentInc, since it's a direct percentage, not a Percentage of BasePerCent)
    // (if BasePerCent is 20% and this is 10%, the whole percentage will be 30%, not 22%)
    BarCount      = BarIndex - TradeBar
    IF BarCount MOD BarNumber = 0 THEN
    ProfitPerCent = ProfitPerCent + BarPerCent
    ENDIF
    //
    ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))         //make sure ProfitPerCent doess not exceed 100%
    y1 = max(x1 * ProfitPerCent, y1)                                     //y1 = % of max profit
    ENDIF
    ELSIF ShortOnMarket AND close < (TradePrice - (y2 * pipsize)) THEN                             //SHORT positions
    //
    // compute the value of the Percentage of profits, if any, to lock in for SHORT trades
    //
    x2 = (tradeprice - close) / pipsize                                     //convert price to pips
    IF x2 >= TrailStart THEN                                                //      go ahead only if N+ pips
    Diff2         = abs(TrailStart - x2)                                 //difference from current profit and TrailStart
    Chunks2       = max(0,round((Diff2 / StepSize) + RoundTO))           //number of STEPSIZE chunks
    ProfitPerCent = BasePerCent + (BasePerCent * (Chunks2 * PerCentInc)) //compute new size of ProfitPerCent
    // compute number of bars elapsed and add an additionl percentage
    // (this percentage is different from PerCentInc, since it's a direct percentage, not a Percentage of BasePerCent)
    // (if BasePerCent is 20% and this is 10%, the whole percentage will be 30%, not 22%)
    BarCount      = BarIndex - TradeBar
    IF BarCount MOD BarNumber = 0 THEN
    ProfitPerCent = ProfitPerCent + BarPerCent
    ENDIF
    //
    ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))         //make sure ProfitPerCent doess not exceed 100%
    y2 = max(x2 * ProfitPerCent, y2)                                     //y2 = % of max profit
    ENDIF
    ENDIF
    IF y1 THEN                                                                 //Place pending STOP order when y1 > 0   (LONG positions)
    SellPrice = Tradeprice + (y1 * pipsize)                                 //convert pips to price
    //
    // check the minimun distance between ExitPrice and current price
    //
    IF abs(close - SellPrice) > PriceDistance THEN
    //
    // place either a LIMIT or STOP pending order according to current price positioning
    //
    IF close >= SellPrice THEN
    SELL AT SellPrice STOP
    ELSE
    SELL AT SellPrice LIMIT
    ENDIF
    ELSE
    //
    //sell AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price
    //
    SELL AT Market
    ENDIF
    ENDIF
    IF y2 THEN                                                                 //Place pending STOP order when y2 > 0   (SHORT positions)
    ExitPrice = Tradeprice - (y2 * pipsize)                                 //convert pips to price
    //
    // check the minimun distance between ExitPrice and current price
    //
    IF abs(close - ExitPrice) > PriceDistance THEN
    //
    // place either a LIMIT or STOP pending order according to current price positioning
    //
    IF close <= ExitPrice THEN
    EXITSHORT AT ExitPrice STOP
    ELSE
    EXITSHORT AT ExitPrice LIMIT
    ENDIF
    ELSE
    //
    //ExitShort AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price
    //
    EXITSHORT AT Market
    ENDIF
    ENDIF
    #193350 quote
    Marlaynicolas
    Participant
    New

    merci pour ton break even que j’ai intégré à la formule.

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

coder un pourcentage de meches


ProOrder : Trading Automatique & Backtests

New Reply
Author
Summary

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

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 05/16/2022
Status: Active
Attachments: No files
Logo Logo
Loading...