Compréhension stop

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #137010 quote
    @Dax30T
    Blocked
    Senior

    Bonjour, j’ai un petit souci sur un algo et je ne comprends pas . c’est sur le stop win, qui est prévue à 100 points. il se met bien en clôture( algo en m1) seulement si sur exemple d’une vente le prix baisse le stop s’adapte toutes les minutes, MAIS, si le prix remonte, le stop remonte aussi. il arrive même qu’il se replace au stop d’origine, après le 1 er BE, si les prix remonte soit a moins de 100 points, je me retrouve avec un trade non protéger. j’aimerait juste comprendre mon erreur. Merci

    stop-win-.png stop-win-.png win-2.png win-2.png
    #137023 quote
    Nicolas
    Keymaster
    Master

    Je ne connais pas le code ni le comportement du trailing stop / breakeven que tu utilises, mais je dirai que ça ressemble à une modification du niveau de sortie peu importe où il se situe actuellement. Je pense qu’il doit manquer quelquepart un test qui permet de ne pas autoriser la modification du niveau de stop si le nouveau niveau n’est pas favorable (comme dans le cas de ta vente où tu ne souhaites bien sûr pas qu’il remonte).

    #137024 quote
    @Dax30T
    Blocked
    Senior
    DEFPARAM CumulateOrders = false
    DEFPARAM Preloadbars = 3000
    daysForbiddenEntry = OpenDayOfWeek = 2
    TIMEFRAME (DEFAULT)//(15 minutes)
    indicator1 = CALL "992-GT3-RSR-SIGNAL"(close)
    c1 = (indicator1 > 0.5)
    indicator2 = AverageTrueRange[14](close)
    c2 = (indicator2 >= 10)
    TIMEFRAME (20 minutes)
    dGreen, dRed, dGrey = Call "992-SPYDER-COLOR-ind"(close)
    d1green = dGreen
    d1red = dRed
    d1grey = dGrey
    d1red=d1red
    d1grey=d1grey
    TIMEFRAME (15 minutes)
    IF (c1 AND c2 ) AND dgreen and d1green and not daysForbiddenEntry THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    TIMEFRAME (15 minutes)
    indicator4 = CALL "R-992-RS"
    c4 = (close < indicator4)
    IF c4 THEN
    SELL AT MARKET
    ENDIF
    indicator5 = CALL "992-GT3-RSR-SIGNAL"(close)
    c5 = (indicator5 <= -0.5)
    indicator6 = AverageTrueRange[14](close)
    c6 = (indicator6 >= 12)
    TIMEFRAME(15 minutes)
    IF (c5 AND c6 ) AND dRed and d1red AND not daysForbiddenEntry  THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    TIMEFRAME(15 minutes)
    indicator8 = CALL "R-992-RS"
    c8 = (close > indicator8)
    IF c8 THEN
    EXITSHORT AT MARKET
    ENDIF
    //*****************************************
    
    
    IF Not OnMarket THEN
    TrailStart    = 100//BreakEven après TRAILSTART (en Pips)
    BasePerCent   = 0.100//20.0% verrouiller  bénéfices
    StepSize      = 1  //10  STOP suiveur % Pips
    PerCentInc    = 0.100       //10.0%  PerCent increment after each StepSize chunk
    RoundTO       = -0.5        //-0.5   rounds always to Lower integer,   +0.4 rounds always to Higher integer,     0 defaults PRT behaviour
    PriceDistance = 30 * pipsize //12 minimun distance from current price
    y1            = 0           //reset to 0
    y2            = 0           //reset to 0
    ProfitPerCent = BasePerCent //reset to desired default value
    ELSIF LongOnMarket AND close > (TradePrice + (y1 * pipsize)) THEN                              //LONG positions
    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
    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
    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
    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
    if close[0] crosses under average[200] and BARINDEX-TRADEINDEX(1)<5 then
    sell at market//35//150
    endif
    
    
    IF longonmarket THEN
    IF OpenDayOfWeek = 5 AND time >= 210000 THEN
    sell at market
    ENDIF
    ENDIF
    SET STOP %LOSS 1.4//1.7
    SET TARGET %PROFIT 3.1//2.1
    
    
    IF shortonmarket THEN
    IF OpenDayOfWeek = 5 AND time >= 210000 THEN
    exitshort at market
    ENDIF
    ENDIF

    j espère que j ai bien ajouté le code, Merci Nicolas

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

Compréhension stop


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
@Dax30T @dax30t Blocked
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by @Dax30T
5 years, 8 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 06/24/2020
Status: Active
Attachments: 2 files
Logo Logo
Loading...