STOP LOSS non respecté

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #20027 quote
    HCHC
    Participant
    Average

    Bonjour,

    Testant, une stratégie simple sur le Brent en 15 minutes

    Croissement DIplus, stop suiveur (code Proreal de Nicolas sur Forum), et stoploss en tout état de cause à 80, des positions ne sont pas stoper à 80.

    Sur 1 an, j’ai des pertes maximum de -255, j’ai 7 positions qui dépasse les 80 (je ne compte pas les 88 ou proche de 80)

    A regardant quand cela ne produit, il n’y a ni de gap, ni de position en fin de semaine, rien qui parait rationnellement extraordinaire.

    Ma question et interrogation : pourquoi un stoploss peut ne pas etre respecté ? (le stoploss, vient dans mon cas, en supplément du stop suiveur)

    
    // Conditions pour ouvrir une position acheteuse
    indicator1 = DIplus[14](close)
    indicator2 = DIminus[14](close)
    c1 = (indicator1 CROSSES OVER indicator2)
    
    
    
    IF c1  THEN
    BUY 1 CONTRACT AT MARKET
    SET STOP PLOSS 80
    ENDIF
    
    //trailing stop function
    trailingstart = 20 //trailing will start @trailinstart points profit
    trailingstep = 4 //trailing step to move the "stoploss"
    
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
    
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
    
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
    
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    #20079 quote
    NicolasNicolas
    Keymaster
    Legend

    En ajoutant cette ligne au début du code, ton problème devrait être réglé:

    defparam cumulateorders=false

    Si il y a plusieurs ordres au marché, alors le stoploss devient celui du prix moyen et non celui de l’ordre individuel, en tout cas avec probacktest.

    HC thanked this post
    #20117 quote
    HCHC
    Participant
    Average

    Absolument

    Avec

    defparam cumulateorders=false

    Que j’avais oublié, j’ai des pertes limitées à 80, et un meilleur gain, et surtout un meilleurs % de positions gagnante.

    Merci

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

STOP LOSS non respecté


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
HC @hc Participant
Summary

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

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