Converta o script abaixo em um indicador do MT4: É necessário adicionar uma Notificação para celular a cada rompimento da tendencia.
Além disso, se possível, adicione uma opção de notificação se a vela no rompimento for uma engulfing bar.
************
// This source code is subject to the terms of the Mozilla Public License 2.0 at ************
// © **********
//@version=5
indicator("RSI Trendlines with Breakouts [HG]", precision = 2, max_labels_count = 500, max_lines_count = 500)
import **********/SimpleTrendlines/3 as tl
g_trendlines = 'Trendline Settings', g_conditions = 'Conditions', g_styling = 'Styling', g_timeframe = 'Timeframe'
input_timeframe = ************(defval = '', title = 'Timeframe', group = g_timeframe)
input_pLen = ************(defval = 4, title = 'Lookback Range', minval = 1, group = g_trendlines, tooltip = 'How many bars to determine when a swing high/low is detected.')
input_rLen = ************(defval = 14, title = 'RSI Length' , minval = 1, group = g_trendlines)
input_rSrc = ************(defval = close, title = 'RSI Source', group = g_trendlines)
input_repaint = ************(defval = 'On', title = 'Repainting', group = g_conditions, options = ['On', 'Off: Bar Confirmation'], tooltip = 'Bar Confirmation: Generates alerts when candle closes. (1 Candle Later)')
input_rsiDiff = ************(defval = 3, title = 'RSI Difference', group = g_conditions, tooltip = 'The difference between the current RSI value and the breakout value.\n\nHow much higher in value should the current RSI be compared to the breakout value in order to detect a breakout?')
input_rsiCol = ************(defval = ************, title = 'RSI Color', group = g_styling)
input_width = ************(defval = 2, title = 'Line Width', minval = 1, group = g_styling)
input_lblType = ************(defval = 'Simple', title = 'Label Type', group = g_styling, options = ['Full', 'Simple'])
input_lblSize = ************(defval = ************, title = 'Label Size', group = g_styling, options = [************, ************, ************, ************, ************])
input_pLowCol = ************(defval = ************, title = 'Pivot Low', inline = 'col', group = g_styling)
input_pHighCol = ************(defval = #089981, title = 'Pivot High', inline = 'col', group = g_styling)
input_override = ************(defval = false, title = 'Override Text Color', group = g_styling, inline = 'override')
input_overCol = ************(defval = ************, title = ' ', group = g_styling, inline = 'override')
lblText = switch input_lblType
'Simple' => 'Br'
'Full' => 'Break'
repaint = switch input_repaint
'On' => true
'Off: Bar Confirmation' => false
rsi_v = ************(input_rSrc, input_rLen)
rsi = input_timeframe == '' ? rsi_v : ************(************, input_timeframe, rsi_v, lookahead = ************_on)
pl = fixnan(************(rsi, 1, input_pLen))
ph = fixnan(************(rsi, 1, input_pLen))
pivot(float pType) =>
pivot = pType == pl ? pl : ph
xAxis = ************(************(pivot), bar_index, 0) - ************(************(pivot), bar_index, 1)
prevPivot = ************(************(pivot), pivot, 1)
pivotCond = ************(pivot) and (pType == pl ? pivot > prevPivot : pivot < prevPivot)
pData = ************(x_axis = xAxis, offset = input_pLen, strictMode = true, strictType = pType == pl ? 0 : 1)
************(pivotCond, prevPivot, pivot, rsi)
pData
breakout(************ this, float pType) =>
var bool hasCrossed = false
if ************(************_y1())
hasCrossed := false
************(not hasCrossed)
condType = (pType == pl ? rsi < ************_y2() - input_rsiDiff : rsi > ************_y2() + input_rsiDiff) and not hasCrossed
condition = repaint ? condType : condType and ************
if condition
hasCrossed := true
************_xy2(************_x2(), ************_y2())
************_xy2(na, na)
************()
************(
bar_index,
************_y2(),
text = lblText, color = pType == pl ? ************(input_pLowCol, 50) : ************(input_pHighCol, 50),
size = input_lblSize, style = pType == pl ? ************_label_lower_left : ************_label_upper_left,
textcolor = pType == pl ? (input_override ? input_overCol : input_pLowCol) : input_override ? input_overCol : input_pHighCol)
hasCrossed
method style(************ this, color col) =>
************_color(col)
************_width(input_width)
************_color(col)
************_width(input_width)
************_style(************_dashed)
plData = pivot(pl)
phData = pivot(ph)
************(input_pLowCol)
************(input_pHighCol)
cu = breakout(plData, pl)
co = breakout(phData, ph)
hline(70, title = 'Overbought', color = input_pHighCol, linestyle = ************_dotted)
hline(30, title = 'Oversold', color = input_pLowCol, linestyle = ************_dotted)
plot(rsi, title = 'Relative Strength Index', linewidth = 2, color = input_rsiCol)
alertcondition(************(************_y1()), 'New Pivot Low Trendline')
alertcondition(************(cu) and cu, 'Pivot Low Breakout')
alertcondition(************(************_y1()), 'New Pivot High Trendline')
alertcondition(************(co) and co, 'Pivot High Breakout')
Você conhece alguém que se encaixa bem no projeto? Ganhe comissão indicando freelancers! Por cada inscrição você ganha 5 € diretamente na sua conta e quando o freelancer é contratado pela plataforma você ganha 2% dos ganhos deste freelancer!
Preencha os detalhes do profissional que você gostaria de recomendar:
Quando o freelancer aceitar o convite, ele será automaticamente adicionado à sua rede e você ganhará 2% a mais todos os ganhos deste freelancer através da plataforma. Para mais informações consulte nosso Termos e Condições
Nenhum freelancer interessado ainda
{{item.displayDisciplines}}
Você tem uma conta stand-by e já respondeu a 1 projeto neste período de assinatura.
Atualize sua conta agora com apenas 1 clique e responda a projetos ilimitados.