Title = StrFormat("Porfolio Equity = %.2f", C); EQ = C; MaxEQ = Highest( EQ ); DD = 100 * ( Eq - MaxEQ ) / MaxEq; MaxDD = Lowest( DD ); MDD = strFormat("Máximo DD = %.2f",MaxDD); PlotText( MDD, 10, 10, colorWhite, bkcolor = colorDefault, yoffset = 0 ); SetChartOptions( 1, chartShowDates | chartLogarithmic ); SetGradientFill( colorLightOrange, colorPaleGreen ); Plot( C, "Portfolio Equity", ColorBlend( colorPaleGreen, colorBlack ), styleGradient | styleLine, Null, Null, 0, -1 ); for( i = 0; i < BarCount; i++ ) { if( i==0) { Current_high_high[i] = C[i] ; } else { if(C[i] > Current_high_high[i-1]) { Current_high_high[i] = C[i] ; } else { Current_high_high[i] =Current_high_high[i-1]; } } } Plot(Current_high_high,"Highest high", colorGold , styleLine, Null, Null, 0, -1 ); PlotOHLC( Current_high_high, Current_high_high, C, C, "", colorRed,styleCloud, Null, Null, 0, -1 ); spy = Foreign("^GSPC","C"); spy_returns = (SPY-Ref(SPY,-1))/Ref(SPY,-1); for( i = 0; i < BarCount; i++ ) { if( i == 0 ) { Equity_benchmark[i] = C[0]; } else { Equity_benchmark[i] = Equity_benchmark[i-1]*(1+spy_returns[i]); } } Plot(Equity_benchmark,"S&P 500",colorBlue,1,null, Null, 0,0, 1.5);