PROORDER STOP LOSS ATR

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

    Hola.

    Tengo un bot que quiero añadir un stop loss referenciado al ATR. El ATR  esta en diario y quiero que recoja el valor minimo de los ultimos 7 dias. El bot tiene otra temporalidad ( 1h).

    DEFPARAM CumulateOrders = False
    //
    myMACD = MACD[12,26,9](close)
    myRSI = RSI[8](close)
    myDIm = DIminus[14](close)
    myDIp = DIplus[14](close)
    myADX = Adx[14]
    c1 = myMACD CROSSES OVER 0
    c2 = myRSI CROSSES OVER 70
    c3 = myDIp < myDIm
    c4 = myDIp CROSSES UNDER myDIm
    c5 = myADX > myADX[1]
    //
    IF c1 AND Not LongOnMarket THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    //
    IF c2 AND (c3 OR c4) AND c5 AND LongOnMarket THEN
    SELL AT MARKET
    ENDIF

    #244775 quote
    JS
    Participant
    Senior

    Aquí está el sistema con el “Stop Loss” personalizado…

    DefParam CumulateOrders = False
    
    // ATR from daily timeframe
    TimeFrame(Daily, UpdateOnClose)
    myATR = AverageTrueRange[7](close)
    minATR = Lowest[7](myATR)  // Minimum ATR of the last 7 days
    
    TimeFrame(Default)  // Return to 1-hour time frame
    // Indicators
    myMACD = MACD[12,26,9](close)
    myRSI = RSI[8](close)
    myDIm = DIminus[14](close)
    myDIp = DIplus[14](close)
    myADX = Adx[14]
    
    c1 = myMACD Crosses Over 0
    c2 = myRSI Crosses Over 70
    c3 = myDIp < myDIm
    c4 = myDIp Crosses Under myDIm
    c5 = myADX > myADX[1]
    
    // ATR-based stop loss
    StopLoss = minATR
    
    If c1 and NOT LongOnMarket then
    Buy 1 Contract at Market
    Set Stop Loss StopLoss
    EndIf
    
    If c2 AND (c3 OR c4) AND c5 AND LongOnMarket Then
    Sell at Market
    EndIf
    
    Graph StopLoss
    robertogozzi and Iván González thanked this post
    #244825 quote
    Jankarl
    Participant
    New
    He creado este otro bot parecido con el ATR de stop loss.
    DEFPARAM CumulateOrders = False // Acumulación de posiciones desactivada // Impide al sistema crear nuevas órdenes para entrar al mercado a aumentar el tamaño de la posición antes de una hora precisa noEntryBeforeTime = 090000 timeEnterBefore = time >= noEntryBeforeTime // Impide al sistema lanzar nuevas órdenes para entrar al mercado o aumentar el tamaño de la posición después de una hora precisa noEntryAfterTime = 183000 timeEnterAfter = time < noEntryAfterTime // ATR from daily timeframe TimeFrame(Daily, UpdateOnClose) myATR = AverageTrueRange[3](close) minATR = Lowest[7](myATR) // Minimum ATR of the last 7 days timeframe (15 mn) // Condiciones para entrada de posiciones cortas A = TIME = 090000 B = TIME = 183000 // ATR-based stop loss StopLoss = minATR If A and NOT LongOnMarket then sellshort 1 Contract at Market EndIf //condiciones de salida if B then exitshort AT MARKET ENDIF // Trailing Stop basado en el ATR de los últimos 7 días if shortonmarket then if close < positionprice- minATR then exitshort at market endif endif
    Ahora quiero que el stop loss sea Trailing Stop. como puedo modificarlo?.
    Muchas gracias
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

PROORDER STOP LOSS ATR


ProOrder: Trading Automático y Backtesting

New Reply
Author
author-avatar
Jankarl @jankarl Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Jankarl
11 months, 4 weeks ago.

Topic Details
Forum: ProOrder: Trading Automático y Backtesting
Language: Spanish
Started: 03/09/2025
Status: Active
Attachments: No files
Logo Logo
Loading...