You are on page 1of 3

instrument {overlay = true,

name = 'Script MHI',


icon="indicators:ADX"}

exibir_doji = input (1, "Exibir No realizado por Doji?", input.string_selection,


{"SI","NO"} )
tipo_mhi = input (1, "cual tipo de MHI utilizar", input.integer, 1, 3, 1) - 1

input_group { "CALL - WIN", call_color = input { default="green", type =


input.color } }
input_group { "PUT - WIN", put_color = input { default="red", type =
input.color } }
input_group { "LOST", loss_color = input { default="gray", type = input.color } }
input_group { "OP. No dealizado devido Dolly", doji_color = input
{ default="white", type = input.color } }

function cores(open, close)


cor = 'd'
if open > close then
cor = 'r'

elseif open < close then


cor = 'g'

end

return cor .. ' '


end

sec = security(current_ticker_id, '5m')


ca=0

m2=iff(minute[ca]==2 or minute[ca]==12 or minute[ca]==22 or minute[ca]==32 or


minute[ca]==42 or minute[ca]==52,true,false)

m3=iff(minute[ca]==3 or minute[ca]==13 or minute[ca]==23 or minute[ca]==33 or


minute[ca]==43 or minute[ca]==53,true,false)

m4=iff(minute[ca]==4 or minute[ca]==14 or minute[ca]==24 or minute[ca]==34 or


minute[ca]==44 or minute[ca]==54,true,false)

m7=iff(minute[ca]==7 or minute[ca]==17 or minute[ca]==27 or minute[ca]==37 or


minute[ca]==47 or minute[ca]==57,true,false)

m8=iff(minute[ca]==8 or minute[ca]==18 or minute[ca]==28 or minute[ca]==38 or


minute[ca]==48 or minute[ca]==58,true,false)

m9=iff(minute[ca]==9 or minute[ca]==19 or minute[ca]==29 or minute[ca]==39 or


minute[ca]==49 or minute[ca]==59,true,false)

if m2==true or m7==true or m3==true or m8==true or m4==true or m9==true then

TD=iff(open>close,"red",iff(open<close,"lime","gray"))

pt=true

else
TD=nil

pt=false

end

plot_candle (open, high, low, close, "WRB", TD)

plot_shape(m4==true or
m9==true,"MHI",shape_style.cross,shape_size.large,rgba(0,0,0,0),shape_location.bott
om,1,"MHI","white")

if sec and (sec.open_time == open_time and tipo_mhi == 0) or (open_time ==


( sec.open_time + (tipo_mhi * 60) ) and tipo_mhi > 0) then

velas_cores = cores(open[1 + tipo_mhi], close[1 + tipo_mhi]) .. cores(open[2 +


tipo_mhi], close[2 + tipo_mhi]) .. cores(open[3 + tipo_mhi], close[3 + tipo_mhi])

_, count_d = string.gsub(velas_cores, 'd', '')

resultado = open_time - close_time

if count_d == 0 then
_, count_g = string.gsub(velas_cores, 'g', '')
_, count_r = string.gsub(velas_cores, 'r', '')

plot_shape((count_g > count_r and (open > close)),


'PUT',
shape_style.triangledown,
shape_size.huge,
put_color,
shape_location.abovebar,
0,
"PUT",
put_color)

plot_shape((count_g < count_r and (open < close)),


'CALL',
shape_style.triangleup,
shape_size.huge,
call_color,
shape_location.belowbar,
0,
"CALL",
call_color)

plot_shape((count_g < count_r and (open >= close)) or (count_g > count_r
and (open <= close)) and resultado <= 1,
'LOSS',
shape_style.xcross,
shape_size.huge,
loss_color,
shape_location.abovebar,
0,
"LOSS",
loss_color)

else
if exibir_doji == 1 then
drop_plot_value("PUT", current_bar_id)
drop_plot_value("CALL", current_bar_id)
drop_plot_value("LOSS", current_bar_id)

plot_shape(1,
'DOJI',
shape_style.circle,
shape_size.huge,
doji_color,
shape_location.abovebar,
0,
"LOSS",
doji_color)

end
end

end

You might also like