Mostrar en indicador o grafico el profit acumulado de 2 estrategias

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #229039 quote
    gustavobpgustavobp
    Participant
    New

    Buenas tardes amigos!!

    Vereis, tengo 2 estrategias en fase de pruebas en modo Paper Trading, y al final del dia realizan un monton de operaciones, muchas de ellas rentables y otras muy perdedoras, las 2 estrategias son muy similares pero no iguales e intento realizar un indicador que me muestre en modo histograma la evolucion del profit (positivo o negativo) de cada de las 2:

    Mi idea de codigo es la siguiente:

    Once ProfitEstrategia1 = 0

    Once ProfitEstrategia2 = 0

    IF Estrategia1 THEN

    BUY 1 CONTRACTS AT MARKET

    SumaEstrategia1 = 1

    ENDIF

    IF S1 and SumaEstrategia = 1 THEN

    SELL 1 CONTRACT AT MARKET

    ProfitEstrategia1 = (AQUI NO SE COMO PODRIA CALCULAR EL PROFIT ACUMULADO POR LA ESTRATEGIA 1 ¿usar StrategyProfit o PositionPerf?)

    ENDIF

    Y una vez sumada las ganancias de cada estrategia, ¿¿Podria mostrar el total de cada estrategia en el grafico de alguna manera o mostrarla como indicador de histograma o lineal??

    Muchas muchas muchas graciasssss!!!!!

    #229327 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Utilice este código (no lo he probado):

    Once ProfitEstrategia1 = 0
    Once ProfitEstrategia2 = 0
    Once SumaEstrategia    = 0
    
    IF StrategyProfit <> StrategyProfit[1] THEN
       miganancia = StrategyProfit - StrategyProfit[1]
       IF SumaEstrategia = 1 THEN
          ProfitEstrategia1 = ProfitEstrategia1 + miganancia
       ELSIF SumaEstrategia = 2 THEN
          ProfitEstrategia2 = ProfitEstrategia1 + miganancia
       ENDIF
    ENDIF
    
    IF Estrategia1 THEN
       BUY 1 CONTRACTS AT MARKET
       SumaEstrategia = 1
    ENDIF
    
    IF Estrategia2 THEN
       BUY 1 CONTRACTS AT MARKET
       SumaEstrategia = 2
    ENDIF
    
    IF S1 and SumaEstrategia = 1 THEN
       SELL 1 CONTRACT AT MARKET
    ENDIF
    
    IF S2 and SumaEstrategia = 2 THEN
       SELL 1 CONTRACT AT MARKET
    ENDIF
    
    GRAPH ProfitEstrategia1
    GRAPH ProfitEstrategia2
Viewing 2 posts - 1 through 2 (of 2 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

Mostrar en indicador o grafico el profit acumulado de 2 estrategias


ProOrder: Trading Automático y Backtesting

New Reply
Author
author-avatar
gustavobp @gustavobp Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
2 years, 6 months ago.

Topic Details
Forum: ProOrder: Trading Automático y Backtesting
Language: Spanish
Started: 03/01/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...