Buenos días.
Mi pregunta es si se puede indicar en la ventana superior que representa el gráfico de precios el valor de los indicadores de manera similar al gráfico adjunto (En este caso la parte superior derecha, también sirve cualquier otro lugar de la ventana que representa el gráfico de precios).
Muchas gracias por adelantado.
Ahí tienes:
DEFPARAM DrawOnLastBarOnly = True
adxP = 14
rsiP = 14
atrP = 14
myADX = ADX[adxP]
myATR = AverageTrueRange[atrP](close)
myRSI = Rsi[rsiP](close)
//--------------------------------------------------------------------------------------------------------------------
drawrectangle(-120,0,-10,-20) anchor(TopRight) coloured("Yellow",20) bordercolor("Green") style(line,2)
drawtext ("RSI(#rsiP#) #myRSI#", -66 ,-10, Dialog, Bold, 11) anchor(TopRight) coloured("Red")
//
drawrectangle(-120,-20,-10,-40) anchor(TopRight) coloured("Yellow",20) bordercolor("Green") style(line,2)
drawtext ("ATR(#atrP#) #myATR#", -68 ,-30, Dialog, Bold, 11) anchor(TopRight) coloured("Red")
//
drawrectangle(-120,-40,-10,-60) anchor(TopRight) coloured("Yellow",20) bordercolor("Green") style(line,2)
drawtext ("ADX(#adxP#) #myADX#", -69 ,-50, Dialog, Bold, 11) anchor(TopRight) coloured("Red")
return
Hola,
sería posible representar esos datos ordenados por valor, por ejemplo descendente?
Aquí está, es un poco complicado:
DEFPARAM DrawOnLastBarOnly = True
SortOrder = 0 //1=Ascending order, Any other Value=Descending order
MaxElements = 3
adxP = 14
rsiP = 14
atrP = 14
myADX = ADX[adxP]
myATR = AverageTrueRange[atrP](close)
myRSI = Rsi[rsiP](close)
$myVAL[1] = myADX
$myIND[1] = 1 //1=ADX
$myVAL[2] = myATR
$myIND[2] = 2 //2=ATR
$myVAL[3] = myRSI
$myIND[3] = 3 //3=RSI
IF SortOrder = 1 THEN
//////////////////////////////////////////////////////////////////
// (Bubble Sort) - ASCENDING order
FOR i = 1 TO MaxElements - 1
FOR j = 1 TO MaxElements - i
IF $myVAL[j] >= $myVAL[j + 1] THEN
// swap data
temp = $myVAL[j]
$myVAL[j] = $myVAL[j + 1]
$myVAL[j + 1] = temp
// swap labels
temp = $myIND[j]
$myIND[j] = $myIND[j + 1]
$myIND[j + 1] = temp
ENDIF
NEXT
NEXT
ELSE
//////////////////////////////////////////////////////////////////
// (Bubble Sort) - DESCENDING order
FOR i = 1 TO MaxElements - 1
FOR j = 1 TO MaxElements - i
IF $myVAL[j] < $myVAL[j + 1] THEN
// swap data
temp = $myVAL[j]
$myVAL[j] = $myVAL[j + 1]
$myVAL[j + 1] = temp
// swap labels
temp = $myIND[j]
$myIND[j] = $myIND[j + 1]
$myIND[j + 1] = temp
ENDIF
NEXT
NEXT
ENDIF
//////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------------------------------------------------
drawrectangle(-120,0,-10,-20) anchor(TopRight) coloured("Yellow",20) bordercolor("Green") style(line,2)
FOR i = 1 TO 3
//myValue = $myVAL[i]
IF i = 1 THEN
x = -66
y = -10
ELSIF i = 2 THEN
x = -68
y = -30
ELSIF i = 3 THEN
x = -69
y = -50
ENDIF
IF $myIND[i] = 3 THEN
drawtext ("RSI(#rsiP#) #myRSI#",x,y,Dialog,Bold, 11) anchor(TopRight) coloured("Red")
ELSIF $myIND[i] = 2 THEN
drawrectangle(-120,-20,-10,-40) anchor(TopRight) coloured("Yellow",20) bordercolor("Green") style(line,2)
drawtext ("ATR(#atrP#) #myATR#",x,y,Dialog,Bold, 11) anchor(TopRight) coloured("Red")
ELSIF $myIND[i] = 1 THEN
drawrectangle(-120,-40,-10,-60) anchor(TopRight) coloured("Yellow",20) bordercolor("Green") style(line,2)
drawtext ("ADX(#adxP#) #myADX#",x,y,Dialog,Bold, 11) anchor(TopRight) coloured("Red")
ENDIF
NEXT
return
Muchísimas gracias, gran trabajo