Código funciona en ProBacktest y no en ProOrder

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

    Hola Tengo en siguiente código que en ProBacktest en la cuenta demo funciona bien, pero cuando lo pongo en ProOrder en real al hacer la entrada me pone una orden de venta medio punto o un punto por debajo de la entrada y me da perdida.

    Se supone que el código identifica las ondas 1,2,3 de la teoría de elliot y cuando hace una entrada pone el stop debajo de la segunda onda con la instrucción SET STOP PRICE stopPrecio y establece el profit con la instrucción  SET TARGET PRICE TakeProfit. Pero no lo hace bien y nada mas entrar al moverse el precio salta una orden de venta por debajo del precio de entrada dándome una perdida de 1$ o 2$. ¿Qué puede estar pasando? en la cuenta demo funciona bien. Si necesitais cualquier aclaración estaré encantado de ayudaros. Muchas gracias.

    El código es el siguiente:

    // Número de contratos
    contratos = 1
    
    // Inicializar startPoint
    startPoint = 0
    
    // Precio de entrada
    entryPrice = 0
    
    // Encontrar mínimos
    minPrice = lowest[10]
    
    // Encontrar máximos
    maxPrice = highest[10]
    
    // Valores previos
    prevMin = 0
    prevMax = 0
    
    // Contador de ondas
    waveCount = 1
    
    // Calcular ATR
    ATR = AverageTrueRange[10](Close)
    
    IF (Month = 5 AND Day = 1) OR (Month = 12 AND (Day = 24 OR Day = 25 OR Day = 26 OR Day = 30 OR Day = 31)) THEN
    TradingDay = 0
    ELSE
    TradingDay = 1
    ENDIF
    
    // Detectar nuevo mínimo
    IF minPrice <> prevMin THEN
    
    // Actualizar valor previo
    prevMin = minPrice
    
    // Reiniciar conteo de ondas
    waveCount = 1
    
    ENDIF
    
    // Detectar nuevo máximo
    IF maxPrice <> prevMax THEN
    
    // Actualizar valor previo
    prevMax = maxPrice
    
    // Reiniciar conteo de ondas
    waveCount = 1
    
    ENDIF
    
    // Identificar onda 1
    IF waveCount = 1 AND prevMax > startPoint THEN
    wave1End = prevMax
    waveCount = 2
    ENDIF
    
    // Identificar onda 2
    IF waveCount = 2 AND prevMin < wave1End THEN
    wave2End = prevMin
    waveCount = 3
    ENDIF
    
    // Entrar en onda 3
    IF waveCount = 3 AND prevMax > wave2End THEN
    
    EntryPrice = High[1] + ATR[10] // Entrada por encima de onda 2
    
    // Guardar precio de entrada
    entryPrice = EntryPrice
      
    stopPrecio = Low[1] - ATR[10] // Stop por debajo de onda 2
       
    TakeProfit = EntryPrice * 1.618 // Take profit basado en extensión de Fibonacci
    IF NOT LONGONMARKET AND TradingDay = 1 THEN
    BUY contratos CONTRACT AT EntryPrice STOP
    SET STOP PRICE stopPrecio
    SET TARGET PRICE TakeProfit
    ENDIF
      
    ENDIF
    
    // Nivel del 61.8% de onda 3
    takeProfit = entryPrice * 0.618
    
    // Una vez alcanzado el 61.8%, mover stop
    IF Close >= takeProfit THEN
    SET STOP PRICE entryPrice + 2 * PointValue
    ENDIF
    #221317 quote
    robertogozzi
    Moderator
    Master

    Estás utilizando STOP órdenes pendientes. Asegúrese de que DETENER sea la opción correcta o use LIMIT si es necesario.

    Además, asegúrese de que Stop Loss y Take Profit estén a una distancia lo suficientemente grande como para cumplir con los requisitos del corredor.

    MysteryTrader thanked this post
    Pending-LIMIT-Orders-Ordini-Pendenti.jpg Pending-LIMIT-Orders-Ordini-Pendenti.jpg
    #221365 quote
    MysteryTrader
    Participant
    New

    Hola! estas ordenes serian correctas. Lo he probado en Probacktest y funciona pero soy novato y no se si funcionarian en Proorder en real.

    Muchas gracias por tu ayuda!!

    IF NOT LONGONMARKET AND TradingDay = 1 THEN
    BUY contratos CONTRACT AT entryPrice STOP
    TakeProfit = entryPrice * 1.618 // Take profit basado en extensión de Fibonacci
    ENDIF
    
    IF LONGONMARKET AND TradingDay = 1 THEN
    SELL contratos SHARE AT TakeProfit LIMIT
    ENDIF
    
    SET STOP $LOSS 10
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Código funciona en ProBacktest y no en ProOrder


ProOrder: Trading Automático y Backtesting

New Reply
Author
Summary

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

Topic Details
Forum: ProOrder: Trading Automático y Backtesting
Language: Spanish
Started: 09/20/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...