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!!!!!
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