0% found this document useful (0 votes)
39 views6 pages

OTTO FX Trading Indicator Setup

The document describes a technical analysis indicator for trading that includes: 1) Three moving averages (fast, slow, and trend) with customizable periods and averages. 2) Inputs to customize properties of the moving averages like color and visibility. 3) Plot shapes to identify buy and sell signals based on criteria involving the moving averages and candle patterns.

Uploaded by

Arisuguts
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views6 pages

OTTO FX Trading Indicator Setup

The document describes a technical analysis indicator for trading that includes: 1) Three moving averages (fast, slow, and trend) with customizable periods and averages. 2) Inputs to customize properties of the moving averages like color and visibility. 3) Plot shapes to identify buy and sell signals based on criteria involving the moving averages and candle patterns.

Uploaded by

Arisuguts
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

instrument {

name = 'OTTO FX',


short_name = 'SMA',
icon = 'indicators:BB',
overlay = true
}

MaFast_period = input(3,"Ma Fast period",[Link],1,1000,1)


MaFast_average = input(4,"Ma Fast average", input.string_selection,[Link])
MaFast_title = input(1,"Ma Fast title", input.string_selection,[Link])

MaSlow_period = input(50,"Ma Slow period",[Link],1,1000,1)


MaSlow_average = input(4,"Ma Slow average", input.string_selection,[Link])
MaSlow_title = input(1,"Ma Slow title", input.string_selection,[Link])

MaTrend_period = input(100,"Ma Trend period",[Link],1,1000,5)


MaTrend_average = input(2,"Ma Trend average",
input.string_selection,[Link])
MaTrend_title = input(1,"Ma Trend title", input.string_selection,[Link])

input_group {
"Ma Fast Line",
colorFast = input { default = "White", type = [Link] },
widthFast = input { default = 1, type = input.line_width},
visibleFast = input { default = true, type = input.plot_visibility }
}

input_group {
"Ma Slow Line",
colorSlow = input { default = "purple", type = [Link] },
widthSlow = input { default = 2, type = input.line_width},
visibleSlow = input { default = true, type = input.plot_visibility }
}

input_group {
"Buy Outside Bar",
colorBuy2 = input { default = "GREEN", type = [Link] },
visibleBuy2 = input { default = true, type = input.plot_visibility }
}

input_group {
"Sell Outside Bar",
colorSell2 = input { default = "RED", type = [Link] },
visibleSell2 = input { default = true, type = input.plot_visibility }
}

local avgFast = averages[MaFast_average]


local titleFast = inputs[MaFast_title]

local avgSlow = averages[MaSlow_average]


local titleSlow = inputs[MaSlow_title]

local avgTrend = averages[MaTrend_average]


local titleTrend = inputs[MaTrend_title]

if visibleFast == true then


plot(avgFast(titleFast,MaFast_period),"Ma Fast",colorFast,widthFast)
end

if visibleSlow == true then


plot(avgSlow(titleSlow,MaSlow_period),"Ma Slow",colorSlow,widthSlow)
end

if visibleTrend == true then


plot(avgTrend(titleTrend,MaTrend_period),"Ma Trend",colorTrend,widthTrend)
end

candle_time = {"1s", "5s", "10s", "15s", "30s", "1m", "2m", "5m", "10m", "15m",
"30m", "1H", "2H", "4H", "8H", "12H", "1D", "1W", "1M", "1Y"}
candle_time_res = input(6,"Candle check
resolution",input.string_selection,candle_time)

sec = security (current_ticker_id, candle_time[candle_time_res])

filter_source = {"1s", "5s", "10s", "15s", "30s", "1m", "2m", "5m", "10m", "15m",
"30m", "1H", "2H", "4H", "8H", "12H", "1D", "1W", "1M", "1Y"}
filter_pa_index = input(8,"Candle check
resolution",input.string_selection,filter_source)

filter_pa = security (current_ticker_id, filter_source[filter_pa_index])

--print(filter_source[filter_pa_index])

if (sec ~= nil) then

MaFast0 = avgFast(titleFast,MaFast_period) --Ma Fast bar 0


MaFast1 = MaFast0[1] --Ma Fast bar 1

MaSlow0 = avgSlow(titleSlow,MaSlow_period) --Ma Slow bar 0


MaSlow1 = MaSlow0[1]

MaTrend0 = avgTrend(titleTrend,MaTrend_period)
MaTrend1 = MaTrend0[1]

if(visibleBuy == true) then


plot_shape((close > open and close[1] < open[1] and close > MaFast0 and
MaFast0 > MaSlow0 and MaSlow0 > MaTrend0 and close > open[1] and open <= close[1]
and abs(close-open) > abs(close[1]-open[1])),
"COMPRA",
shape_style.arrowup,
shape_size.huge,
colorBuy,
shape_location.belowbar,
0,
"COMPRA",
colorBuy
)
end

if (visibleSell == true) then


plot_shape((close < open and close[1] > open[1] and close < MaFast0 and
MaFast0 < MaSlow0 and MaSlow0 < MaTrend0 and close < open[1] and open >= close[1]
and abs(close-open) > abs(close[1]-open[1])),
"Put",
shape_style.arrowdown,
shape_size.huge,
colorVENDA,
shape_location.abovebar,
0,
"PUT",
colorVENDA
)
end

if(visibleBuy1 == true) then


if(filter_pa.close[1] > filter_pa.open[1] and filter_pa.close[2] <
filter_pa.open[2] and filter_pa.close[1] > filter_pa.open[2] and filter_pa.open[1]
<= filter_pa.close[2] and abs(filter_pa.close[1]-filter_pa.open[1]) >
abs(filter_pa.close[2]-filter_pa.open[2]) ) then
plot_shape((close > open and close[1] < open[1] and close > open[1] and
open <= close[1] and abs(close-open) > abs(close[1]-open[1])),
"COMPRA1",
shape_style.arrowup,
shape_size.huge,
colorBuy1,
shape_location.belowbar,
0,
"COMPRA",
colorBuy1
)
end
end

if (visibleSell1 == true) then


if(filter_pa.close[1] < filter_pa.open[1] and filter_pa.close[2] >
filter_pa.open[2] and filter_pa.close[1] < filter_pa.open[2] and filter_pa.open[1]
>= filter_pa.close[2] and abs(filter_pa.close[1]-filter_pa.open[1]) >
abs(filter_pa.close[2]-filter_pa.open[2]) ) then
plot_shape((close < open and close[1] > open[1] and close < open[1] and
open >= close[1] and abs(close-open) > abs(close[1]-open[1])),
"VENDAt1",
shape_style.arrowdown,
shape_size.huge,
colorSell1,
shape_location.abovebar,
0,
"VENDA",
colorSell1
)
end
end

if(visibleBuy2 == true) then


--if(filter_pa.close[1] > filter_pa.open[1] and filter_pa.close[2] <
filter_pa.open[2] and filter_pa.close[1] > filter_pa.open[2] and filter_pa.open[1]
<= filter_pa.close[2] and abs(filter_pa.close[1]-filter_pa.open[1]) >
abs(filter_pa.close[2]-filter_pa.open[2]) ) then
plot_shape((open[3] < close[3] and open[2] < close[2] and open[1] >
close[1] and close[1] > open[2] and open[1] > open[2] and open < close),
"OTTOFX-COMPRA2",
shape_style.arrowup,
shape_size.huge,
colorBuy2,
shape_location.belowbar,
0,
"OTTOFX-COMPRA",
colorBuy2
)
--end
end

if (visibleSell2 == true) then


--if(filter_pa.close[1] < filter_pa.open[1] and filter_pa.close[2] >
filter_pa.open[2] and filter_pa.close[1] < filter_pa.open[2] and filter_pa.open[1]
>= filter_pa.close[2] and abs(filter_pa.close[1]-filter_pa.open[1]) >
abs(filter_pa.close[2]-filter_pa.open[2]) ) then
plot_shape((open[3] > close[3] and open[2] > close[2] and open[1] <
close[1] and close[1] < open[2] and open[1] < open[2] and open > close),
"OTTOFX-VENDAT2",
shape_style.arrowdown,
shape_size.huge,
colorSell2,
shape_location.abovebar,
0,
"OTTOFX-VENDA",
colorSell2
)
--end
end

if (visibleArea == true) then


fill(MaFast0,MaSlow0,"Area", MaFast0 > MaSlow0 and colorAreaUp or MaFast0 <
MaSlow0 and colorAreaDown )

end

end

MaFast_period = input(3,"Ma Fast period",[Link],1,1000,1)


MaFast_average = input(4,"Ma Fast average", input.string_selection,[Link])
MaFast_title = input(1,"Ma Fast title", input.string_selection,[Link])

MaSlow_period = input(50,"Ma Slow period",[Link],1,1000,1)


MaSlow_average = input(4,"Ma Slow average", input.string_selection,[Link])
MaSlow_title = input(1,"Ma Slow title", input.string_selection,[Link])

MaTrend_period = input(200,"Ma Trend period",[Link],1,1000,5)


MaTrend_average = input(2,"Ma Trend average",
input.string_selection,[Link])
MaTrend_title = input(1,"Ma Trend title", input.string_selection,[Link])

input_group {
"COMPRA Arrow",
colorBuy = input { default = "green", type = [Link] },
visibleBuy = input { default = true, type = input.plot_visibility }
}

input_group {
"VENDA Arrow",
colorSell = input { default = "red", type = [Link] },
visibleSell = input { default = true, type = input.plot_visibility }
}

local avgFast = averages[MaFast_average]


local titleFast = inputs[MaFast_title]

local avgSlow = averages[MaSlow_average]


local titleSlow = inputs[MaSlow_title]

local avgTrend = averages[MaTrend_average]


local titleTrend = inputs[MaTrend_title]

if visibleFast == true then


plot(avgFast(titleFast,MaFast_period),"Ma Fast",colorFast,widthFast)
end

if visibleSlow == true then


plot(avgSlow(titleSlow,MaSlow_period),"Ma Slow",colorSlow,widthSlow)
end

if visibleTrend == true then


plot(avgTrend(titleTrend,MaTrend_period),"Ma Trend",colorTrend,widthTrend)
end

candle_time = {"1s", "5s", "10s", "15s", "30s", "1m", "2m", "5m", "10m", "15m",
"30m", "1H", "2H", "4H", "8H", "12H", "1D", "1W", "1M", "1Y"}
candle_time_res = input(6,"Candle check
resolution",input.string_selection,candle_time)

sec = security (current_ticker_id, candle_time[candle_time_res])

if (sec ~= nil) and (sec.open_time == open_time) then

Mafast0 = avgFast(titleFast,MaFast_period) --Ma Fast bar 0


Mafast1 = Mafast0[1] --Ma Fast bar 1

MaSlow0 = avgSlow(titleSlow,MaSlow_period) --Ma Slow bar 0


MaSlow1 = MaSlow0[1]

MaTrend0 = avgTrend(titleTrend,MaTrend_period)
Matrend1 = MaTrend0[1]

plot_shape((close > open and close[1] < open[1] and close > Mafast0 and close >
MaSlow0 and close > MaTrend0 and close > open[1] and open <= close[1] and
abs(close-open) > abs(close[1]-open[1])),
"COMPRA",
shape_style.arrowup,
shape_size.huge,
colorBuy,
shape_location.belowbar,
0,
"COMPRA",
colorBuy
)

plot_shape((close < open and close[1] > open[1] and close < Mafast0 and close <
MaSlow0 and close < MaTrend0 and close < open[1] and open >= close[1] and
abs(close-open) > abs(close[1]-open[1])),
"VENDA",
shape_style.arrowdown,
shape_size.huge,
colorSell,
shape_location.abovebar,
0,
"VENDA",
colorSell
)

end

You might also like