Predictum Light
Predictum Light
Predictum Light
0
at https://mozilla.org/MPL/2.0/
// © moneymovesalgo
//@version=5
strategy(title="Predictum Light",shorttitle="Predictum
Light",overlay=true,pyramiding=0, commission_type=strategy.commission.percent,
commission_value=0.0, slippage=0,
initial_capital=100000,default_qty_type=strategy.percent_of_equity,default_qty_valu
e=100,calc_on_every_tick=false)
// ------------------------------------------
// GLOBAL INPUTS
// ------------------------------------------
asset = input.string(title="Strategies", defval = "E100", options=[
"E100",
"E101",
"E102",
"E103",
"E104",
"E105",
"E106",
"E107",
"E108",
"E109",
"E110",
"E111",
"E112",
"E113",
"E114",
"E115",
"E116",
"E117",
"E118",
"E119",
"E120",
"E121",
"E122",
"E123",
"E124",
"E125",
"E126",
"E127",
"E128",
"E129"
])
ma_choice = "EMA"
ma_period = 500
leverage = input.int(title="Leverage", defval=20, minval=1, maxval=125)
number_trades_statistics = 25
// ------------------------------------------
// LONG INPUTS
// ------------------------------------------
std_deviation_period_long = 15
std_deviation_coefficient_long = 0.5
atr_period_long = 14
atr_parameter_long = 0.5
long_entry_ma_distance_perc = 0.5
// ------------------------------------------
// SHORT INPUTS
// ------------------------------------------
std_deviation_period_short = 14
std_deviation_coefficient_short = 0.5
atr_period_short = 14
atr_parameter_short = .5
short_entry_ma_distance_perc = 0.5
//
//
// ---------------------------------------------------
// CRYPTO
// ---------------------------------------------------
if asset == "E100"
ma_period := 1
ma_choice := "VWAP"
std_deviation_period_long := 14
std_deviation_coefficient_long := 0.8
atr_period_long := 14
atr_parameter_long := 1.4
long_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 0.8
atr_period_short := 14
atr_parameter_short := 1.4
short_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
if asset == "E101"
ma_period := 350
ma_choice := "HMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1
atr_period_long := 14
atr_parameter_long := 1.3
long_entry_ma_distance_perc := 1.1
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 2
atr_period_short := 14
atr_parameter_short := 1.7
short_entry_ma_distance_perc := 1.7
stop_price_perc := 4.5
if asset == "E102"
ma_period := 200
ma_choice := "SMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.2
atr_period_long := 14
atr_parameter_long := 1.1
long_entry_ma_distance_perc := 1.1
stop_price_perc := 4.5
std_deviation_period_short := 7
std_deviation_coefficient_short := 1
atr_period_short := 14
atr_parameter_short := 1
short_entry_ma_distance_perc := 1
stop_price_perc := 4.5
if asset == "E103"
ma_period := 350
ma_choice := "HMA"
std_deviation_period_long := 7
std_deviation_coefficient_long := 0.8
atr_period_long := 7
atr_parameter_long := 1.3
long_entry_ma_distance_perc := 1.3
stop_price_perc := 4.5
std_deviation_period_short := 8
std_deviation_coefficient_short := 1
atr_period_short := 14
atr_parameter_short := 1.5
short_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
if asset == "E104"
ma_period := 1
ma_choice := "VWAP"
std_deviation_period_long := 14
std_deviation_coefficient_long := 0.8
atr_period_long := 14
atr_parameter_long := 1.6
long_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 0.8
atr_period_short := 14
atr_parameter_short := 1.5
short_entry_ma_distance_perc := 1.4
stop_price_perc := 4.5
if asset == "E105"
ma_period := 230
ma_choice := "VWMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.3
atr_period_long := 9
atr_parameter_long := 1
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 13
std_deviation_coefficient_short := 1.3
atr_period_short := 9
atr_parameter_short := 1.5
short_entry_ma_distance_perc := 1.3
stop_price_perc := 4.5
if asset == "E106"
ma_period := 300
ma_choice := "VWMA"
std_deviation_period_long := 17
std_deviation_coefficient_long := 1.6
atr_period_long := 11
atr_parameter_long := 2
long_entry_ma_distance_perc := 2.1
stop_price_perc := 4.5
std_deviation_period_short := 12
std_deviation_coefficient_short := 1.2
atr_period_short := 14
atr_parameter_short := 1.5
short_entry_ma_distance_perc := 1
stop_price_perc := 4.5
if asset == "E107"
ma_period := 400
ma_choice := "HMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.5
atr_period_long := 10
atr_parameter_long := 1.5
long_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
std_deviation_period_short := 10
std_deviation_coefficient_short := 1.7
atr_period_short := 14
atr_parameter_short := 1.7
short_entry_ma_distance_perc := 1.3
stop_price_perc := 4.5
if asset == "E108"
ma_period := 300
ma_choice := "VWMA"
std_deviation_period_long := 9
std_deviation_coefficient_long := 0.9
atr_period_long := 7
atr_parameter_long := 1
long_entry_ma_distance_perc := 0.7
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 1
atr_period_short := 14
atr_parameter_short := 1.5
short_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
if asset == "E109"
ma_period := 400
ma_choice := "HMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.2
atr_period_long := 14
atr_parameter_long := 1
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 10
std_deviation_coefficient_short := 1.7
atr_period_short := 14
atr_parameter_short := 1.7
short_entry_ma_distance_perc := 1.3
stop_price_perc := 4.5
if asset == "E110"
ma_period := 400
ma_choice := "HMA"
std_deviation_period_long := 13
std_deviation_coefficient_long := 0.7
atr_period_long := 14
atr_parameter_long := 0.7
long_entry_ma_distance_perc := 0.6
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 1
atr_period_short := 14
atr_parameter_short := 1.1
short_entry_ma_distance_perc := 1
stop_price_perc := 4.5
if asset == "E111"
ma_period := 120
ma_choice := "VWMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1
atr_period_long := 14
atr_parameter_long := 1.6
long_entry_ma_distance_perc := 1.6
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 2
atr_period_short := 14
atr_parameter_short := 2.4
short_entry_ma_distance_perc := 1.9
stop_price_perc := 4.5
if asset == "E112"
ma_period := 300
ma_choice := "VWMA"
std_deviation_period_long := 7
std_deviation_coefficient_long := 0.5
atr_period_long := 14
atr_parameter_long := 1
long_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 0.5
atr_period_short := 10
atr_parameter_short := 0.9
short_entry_ma_distance_perc := 0.9
stop_price_perc := 4.5
if asset == "E113"
ma_period := 300
ma_choice := "VWMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1
atr_period_long := 14
atr_parameter_long := 1
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 11
std_deviation_coefficient_short := 0.5
atr_period_short := 14
atr_parameter_short := 1.1
short_entry_ma_distance_perc := 1.4
stop_price_perc := 4.5
if asset == "E114"
ma_period := 300
ma_choice := "VWMA"
std_deviation_period_long := 11
std_deviation_coefficient_long := 0.8
atr_period_long := 7
atr_parameter_long := 1.1
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 0.4
atr_period_short := 13
atr_parameter_short := 1.1
short_entry_ma_distance_perc := 1.3
stop_price_perc := 4.5
if asset == "E115"
ma_period := 200
ma_choice := "SMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 0.4
atr_period_long := 14
atr_parameter_long := 2.8
long_entry_ma_distance_perc := 2.6
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 1.3
atr_period_short := 14
atr_parameter_short := 1.3
short_entry_ma_distance_perc := 1
stop_price_perc := 4.5
if asset == "E116"
ma_period := 300
ma_choice := "VWMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1
atr_period_long := 14
atr_parameter_long := 1.3
long_entry_ma_distance_perc := 0.8
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 0.9
atr_period_short := 14
atr_parameter_short := 1.2
short_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
if asset == "E117"
ma_period := 300
ma_choice := "HMA"
std_deviation_period_long := 12
std_deviation_coefficient_long := 0.5
atr_period_long := 10
atr_parameter_long := 0.6
long_entry_ma_distance_perc := 0.9
stop_price_perc := 4.5
std_deviation_period_short := 13
std_deviation_coefficient_short := 1.3
atr_period_short := 11
atr_parameter_short := 1.2
short_entry_ma_distance_perc := 1
stop_price_perc := 4.5
if asset == "E118"
ma_period := 1
ma_choice := "VWAP"
std_deviation_period_long := 14
std_deviation_coefficient_long := 0.8
atr_period_long := 14
atr_parameter_long := 1.6
long_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
std_deviation_period_short := 10
std_deviation_coefficient_short := 1.2
atr_period_short := 14
atr_parameter_short := 1.5
short_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
if asset == "E119"
ma_period := 1
ma_choice := "VWAP"
std_deviation_period_long := 14
std_deviation_coefficient_long := 0.8
atr_period_long := 14
atr_parameter_long := 1.6
long_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
std_deviation_period_short := 10
std_deviation_coefficient_short := 0.8
atr_period_short := 14
atr_parameter_short := 1.5
short_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
if asset == "E120"
ma_period := 1
ma_choice := "VWAP"
std_deviation_period_long := 14
std_deviation_coefficient_long := 0.8
atr_period_long := 14
atr_parameter_long := 1.5
long_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 0.8
atr_period_short := 14
atr_parameter_short := 1.2
short_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
if asset == "E121"
ma_period := 250
ma_choice := "VWMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.1
atr_period_long := 14
atr_parameter_long := 1.2
long_entry_ma_distance_perc := 1.2
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 1
atr_period_short := 14
atr_parameter_short := 1.1
short_entry_ma_distance_perc := 1
stop_price_perc := 4.5
if asset == "E122"
ma_period := 350
ma_choice := "HMA"
std_deviation_period_long := 11
std_deviation_coefficient_long := 1
atr_period_long := 14
atr_parameter_long := 1.3
long_entry_ma_distance_perc := 1.4
stop_price_perc := 4.5
std_deviation_period_short := 12
std_deviation_coefficient_short := 1
atr_period_short := 14
atr_parameter_short := 1.5
short_entry_ma_distance_perc := 1.1
stop_price_perc := 4.5
if asset == "E123"
ma_period := 400
ma_choice := "HMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.8
atr_period_long := 8
atr_parameter_long := 1.4
long_entry_ma_distance_perc := 1.1
stop_price_perc := 4.5
std_deviation_period_short := 11
std_deviation_coefficient_short := 1
atr_period_short := 7
atr_parameter_short := 1.5
short_entry_ma_distance_perc := 1.1
stop_price_perc := 4.5
if asset == "E124"
ma_period := 380
ma_choice := "HMA"
std_deviation_period_long := 7
std_deviation_coefficient_long := 1.2
atr_period_long := 14
atr_parameter_long := 1.4
long_entry_ma_distance_perc := 1.2
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 1.6
atr_period_short := 14
atr_parameter_short := 1.6
short_entry_ma_distance_perc := 1.4
stop_price_perc := 4.5
if asset == "E125"
ma_period := 1
ma_choice := "VWAP"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.5
atr_period_long := 14
atr_parameter_long := 1.6
long_entry_ma_distance_perc := 1.6
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 0.8
atr_period_short := 14
atr_parameter_short := 1.5
short_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
if asset == "E126"
ma_period := 1
ma_choice := "VWAP"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.1
atr_period_long := 11
atr_parameter_long := 1.5
long_entry_ma_distance_perc := 1.6
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 0.8
atr_period_short := 14
atr_parameter_short := 1.5
short_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
if asset == "E127"
ma_period := 300
ma_choice := "HMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 0.3
atr_period_long := 14
atr_parameter_long := 1
long_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
std_deviation_period_short := 13
std_deviation_coefficient_short := 1
atr_period_short := 14
atr_parameter_short := 1.4
short_entry_ma_distance_perc := 1.2
stop_price_perc := 4.5
if asset == "E128"
ma_period := 350
ma_choice := "HMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1
atr_period_long := 14
atr_parameter_long := 1.5
long_entry_ma_distance_perc := 1.4
stop_price_perc := 4.5
std_deviation_period_short := 11
std_deviation_coefficient_short := 1.8
atr_period_short := 14
atr_parameter_short := 1.7
short_entry_ma_distance_perc := 1.6
stop_price_perc := 4.5
if asset == "E129"
ma_period := 200
ma_choice := "SMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.2
atr_period_long := 14
atr_parameter_long := 1.1
long_entry_ma_distance_perc := 1.1
stop_price_perc := 4.5
std_deviation_period_short := 7
std_deviation_coefficient_short := 1
atr_period_short := 14
atr_parameter_short := 1
short_entry_ma_distance_perc := 1
stop_price_perc := 4.5
if asset == "E130"
ma_period := 400
ma_choice := "HMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 0.9
atr_period_long := 14
atr_parameter_long := 1
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 1.5
atr_period_short := 14
atr_parameter_short := 1
short_entry_ma_distance_perc := 1
stop_price_perc := 4.5
if asset == "E131"
ma_period := 300
ma_choice := "HMA"
std_deviation_period_long := 9
std_deviation_coefficient_long := 0.5
atr_period_long := 14
atr_parameter_long := 1.5
long_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
std_deviation_period_short := 12
std_deviation_coefficient_short := 1
atr_period_short := 14
atr_parameter_short := 1
short_entry_ma_distance_perc := 1.2
stop_price_perc := 4.5
if asset == "E132"
ma_period := 230
ma_choice := "VWMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.3
atr_period_long := 9
atr_parameter_long := 1
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 13
std_deviation_coefficient_short := 1.3
atr_period_short := 9
atr_parameter_short := 1.5
short_entry_ma_distance_perc := 1.3
stop_price_perc := 4.5
if asset == "E133"
ma_period := 300
ma_choice := "VWMA"
std_deviation_period_long := 17
std_deviation_coefficient_long := 1.6
atr_period_long := 11
atr_parameter_long := 2
long_entry_ma_distance_perc := 2.1
stop_price_perc := 4.5
std_deviation_period_short := 12
std_deviation_coefficient_short := 1.2
atr_period_short := 14
atr_parameter_short := 1.5
short_entry_ma_distance_perc := 1
stop_price_perc := 4.5
if asset == "E134"
ma_period := 330
ma_choice := "HMA"
std_deviation_period_long := 11
std_deviation_coefficient_long := 1.1
atr_period_long := 7
atr_parameter_long := 1.6
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 10
std_deviation_coefficient_short := 1.7
atr_period_short := 14
atr_parameter_short := 1.6
short_entry_ma_distance_perc := 1.6
stop_price_perc := 4.5
if asset == "E135"
ma_period := 200
ma_choice := "SMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.3
atr_period_long := 14
atr_parameter_long := 1.2
long_entry_ma_distance_perc := 0.8
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 1.1
atr_period_short := 14
atr_parameter_short := 1
short_entry_ma_distance_perc := 0.6
stop_price_perc := 4.5
if asset == "E136"
ma_period := 400
ma_choice := "HMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.5
atr_period_long := 10
atr_parameter_long := 1.5
long_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
std_deviation_period_short := 11
std_deviation_coefficient_short := 1.7
atr_period_short := 14
atr_parameter_short := 1.7
short_entry_ma_distance_perc := 1.3
stop_price_perc := 4.5
if asset == "E137"
ma_period := 250
ma_choice := "VWMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1
atr_period_long := 14
atr_parameter_long := 1
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 12
std_deviation_coefficient_short := 0.5
atr_period_short := 14
atr_parameter_short := 0.5
short_entry_ma_distance_perc := 0.5
stop_price_perc := 4.5
if asset == "E138"
ma_period := 400
ma_choice := "HMA"
std_deviation_period_long := 7
std_deviation_coefficient_long := 1.9
atr_period_long := 9
atr_parameter_long := 1.8
long_entry_ma_distance_perc := 2.1
stop_price_perc := 4.5
std_deviation_period_short := 10
std_deviation_coefficient_short := 1.6
atr_period_short := 14
atr_parameter_short := 1.7
short_entry_ma_distance_perc := 1.3
stop_price_perc := 4.5
if asset == "E139"
ma_period := 200
ma_choice := "VWMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 0.8
atr_period_long := 14
atr_parameter_long := 1
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 11
std_deviation_coefficient_short := 0.6
atr_period_short := 9
atr_parameter_short := 0.8
short_entry_ma_distance_perc := 0.5
stop_price_perc := 4.5
if asset == "E140"
ma_period := 300
ma_choice := "VWMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1
atr_period_long := 14
atr_parameter_long := 1
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 11
std_deviation_coefficient_short := 0.5
atr_period_short := 14
atr_parameter_short := 1.1
short_entry_ma_distance_perc := 1.4
stop_price_perc := 4.5
if asset == "E141"
ma_period := 200
ma_choice := "VWMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 0.8
atr_period_long := 14
atr_parameter_long := 0.8
long_entry_ma_distance_perc := 0.8
stop_price_perc := 4.5
std_deviation_period_short := 11
std_deviation_coefficient_short := 0.5
atr_period_short := 9
atr_parameter_short := 0.8
short_entry_ma_distance_perc := 0.6
stop_price_perc := 4.5
if asset == "E142"
ma_period := 200
ma_choice := "SMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 0.4
atr_period_long := 14
atr_parameter_long := 2.8
long_entry_ma_distance_perc := 2.6
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 1.3
atr_period_short := 14
atr_parameter_short := 1.3
short_entry_ma_distance_perc := 1
stop_price_perc := 4.5
if asset == "E144"
ma_period := 190
ma_choice := "SMA"
std_deviation_period_long := 7
std_deviation_coefficient_long := 0.4
atr_period_long := 7
atr_parameter_long := 2
long_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
std_deviation_period_short := 13
std_deviation_coefficient_short := 1.8
atr_period_short := 9
atr_parameter_short := 1.7
short_entry_ma_distance_perc := 1.7
stop_price_perc := 4.5
if asset == "E145"
ma_period := 100
ma_choice := "VWMA"
std_deviation_period_long := 12
std_deviation_coefficient_long := 0.5
atr_period_long := 10
atr_parameter_long := 0.5
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 11
std_deviation_coefficient_short := 1
atr_period_short := 14
atr_parameter_short := 1
short_entry_ma_distance_perc := 1
stop_price_perc := 4.5
if asset == "E146"
ma_period := 300
ma_choice := "HMA"
std_deviation_period_long := 12
std_deviation_coefficient_long := 0.5
atr_period_long := 10
atr_parameter_long := 0.6
long_entry_ma_distance_perc := 0.9
stop_price_perc := 4.5
std_deviation_period_short := 13
std_deviation_coefficient_short := 1.3
atr_period_short := 11
atr_parameter_short := 1.2
short_entry_ma_distance_perc := 1
stop_price_perc := 4.5
if asset == "E147"
ma_period := 300
ma_choice := "HMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 0.3
atr_period_long := 9
atr_parameter_long := 1
long_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
std_deviation_period_short := 11
std_deviation_coefficient_short := 1
atr_period_short := 14
atr_parameter_short := 1.1
short_entry_ma_distance_perc := 1.1
stop_price_perc := 4.5
if asset == "E148"
ma_period := 250
ma_choice := "VWMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1
atr_period_long := 9
atr_parameter_long := 1
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 0.5
atr_period_short := 14
atr_parameter_short := 0.5
short_entry_ma_distance_perc := 0.5
stop_price_perc := 4.5
if asset == "E149"
ma_period := 200
ma_choice := "SMA"
std_deviation_period_long := 11
std_deviation_coefficient_long := 1.3
atr_period_long := 14
atr_parameter_long := 1.4
long_entry_ma_distance_perc := 1.1
stop_price_perc := 4.5
std_deviation_period_short := 14
std_deviation_coefficient_short := 1.8
atr_period_short := 7
atr_parameter_short := 1
short_entry_ma_distance_perc := 0.8
stop_price_perc := 4.5
if asset == "E150"
ma_period := 300
ma_choice := "HMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 0.3
atr_period_long := 14
atr_parameter_long := 1.7
long_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
std_deviation_period_short := 11
std_deviation_coefficient_short := 1
atr_period_short := 14
atr_parameter_short := 1.1
short_entry_ma_distance_perc := 1.1
stop_price_perc := 4.5
if asset == "E151"
ma_period := 300
ma_choice := "HMA"
std_deviation_period_long := 11
std_deviation_coefficient_long := 0.4
atr_period_long := 7
atr_parameter_long := 0.6
long_entry_ma_distance_perc := 0.9
stop_price_perc := 4.5
std_deviation_period_short := 9
std_deviation_coefficient_short := 1.5
atr_period_short := 9
atr_parameter_short := 1.6
short_entry_ma_distance_perc := 1.5
stop_price_perc := 4.5
if asset == "E152"
ma_period := 400
ma_choice := "HMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.8
atr_period_long := 10
atr_parameter_long := 1.7
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 11
std_deviation_coefficient_short := 1.9
atr_period_short := 14
atr_parameter_short := 1.7
short_entry_ma_distance_perc := 1.3
stop_price_perc := 4.5
if asset == "E153"
ma_period := 200
ma_choice := "VWMA"
std_deviation_period_long := 13
std_deviation_coefficient_long := 1
atr_period_long := 14
atr_parameter_long := 0.9
long_entry_ma_distance_perc := 1
stop_price_perc := 4.5
std_deviation_period_short := 11
std_deviation_coefficient_short := 0.6
atr_period_short := 9
atr_parameter_short := 0.8
short_entry_ma_distance_perc := 0.5
stop_price_perc := 4.5
if asset == "E154"
ma_period := 300
ma_choice := "HMA"
std_deviation_period_long := 9
std_deviation_coefficient_long := 1
atr_period_long := 14
atr_parameter_long := 2
long_entry_ma_distance_perc := 2
stop_price_perc := 4.5
std_deviation_period_short := 7
std_deviation_coefficient_short := 0.9
atr_period_short := 14
atr_parameter_short := 1
short_entry_ma_distance_perc := 1
stop_price_perc := 4.5
if asset == "E155"
ma_period := 120
ma_choice := "VWMA"
std_deviation_period_long := 14
std_deviation_coefficient_long := 1.9
atr_period_long := 9
atr_parameter_long := 1.8
long_entry_ma_distance_perc := 1.6
stop_price_perc := 4.5
std_deviation_period_short := 12
std_deviation_coefficient_short := 2.3
atr_period_short := 12
atr_parameter_short := 2.2
short_entry_ma_distance_perc := 1.9
stop_price_perc := 4.5
// ------------------------------------------
// GLOBAL CALCULATIONS
// ------------------------------------------
ma_value = 0.0
if ma_choice == "EMA"
ma_value := ta.ema(close, 300)
if ma_choice == "HMA"
ma_value := ta.hma(close, 300)
if ma_choice == "RMA"
ma_value := ta.rma(close, 300)
if ma_choice == "SMA"
ma_value := ta.sma(close, 300)
if ma_choice == "VWAP"
ma_value := ta.vwap(close)
if ma_choice == "VWMA"
ma_value := ta.vwma(close, 300)
if ma_choice == "WMA"
ma_value := ta.wma(close, 300)
// ------------------------------------------
// LONG CALCULATIONS
// ------------------------------------------
stdev_long = ta.stdev(close, std_deviation_period_long)
stdev_long_value = stdev_long * std_deviation_coefficient_long
atr_long_value = ta.atr(atr_period_long) * atr_parameter_long
long_entry_ma_value_trigger = ma_value * (1 + (long_entry_ma_distance_perc / 100))
+ atr_long_value + stdev_long_value
// ------------------------------------------
// SHORT CALCULATIONS
// ------------------------------------------
stdev_short = ta.stdev(close, std_deviation_period_short)
stdev_short_value = stdev_short * std_deviation_coefficient_short
atr_short_value = ta.atr(atr_period_short) * atr_parameter_short
short_entry_ma_value_trigger = ma_value * (1 - (short_entry_ma_distance_perc /
100)) - atr_short_value - stdev_short_value
// ------------------------------------------
// LONG TRADE
// ------------------------------------------
if (ta.crossover(strategy.position_size, 0))
ath := high
peak_profit_long := (((ath - strategy.position_avg_price) /
strategy.position_avg_price) * 100) * leverage
peak_profit_string_long := str.tostring(math.round(peak_profit_long, 2))
positionMaxLabel_long := label.new(bar_index , ath, text ="Maximum Profit " +
peak_profit_string_long + "%", textcolor = color.white, color =
color.new(color.green,30), style = label.style_label_down)
firstOrderPlaced_long := true
drawdown_long := close
peak_drawdown_long := (((drawdown_long - strategy.position_avg_price) /
strategy.position_avg_price) * 100) * leverage
// ------------------------------------------
// SHORT TRADE
// ------------------------------------------
if (ta.crossunder(strategy.position_size, 0))
atl := low
peak_profit_short := -(((atl - strategy.position_avg_price) /
strategy.position_avg_price) * 100) * leverage
peak_profit_string_short := str.tostring(math.round(peak_profit_short, 2))
positionMaxLabel_short := label.new(bar_index , atl, text ="Peak Profit " +
peak_profit_string_short + "%", textcolor = color.white, color =
color.new(color.red,30), style = label.style_label_up)
firstOrderPlaced_short := true
drawdown_short := close
peak_drawdown_short := -(((drawdown_short - strategy.position_avg_price) /
strategy.position_avg_price) * 100) * leverage
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
n = bar_index
// ------------------------------------------
// PLOT
// ------------------------------------------
// Plot Entry Short/Long Points
plot((barstate.islast or barstate.islastconfirmedhistory) and
strategy.position_size >= 0 ? short_entry_ma_value_trigger : na, title = "Next
Entry Short", style=plot.style_cross, color=color.red, linewidth=6, offset=1,
show_last=1)
plot((barstate.islast or barstate.islastconfirmedhistory) and
strategy.position_size <= 0 ? long_entry_ma_value_trigger : na, title = "Next Entry
Long", style=plot.style_cross, color=color.green, linewidth=6, offset=1,
show_last=1)
plot(strategy.position_avg_price, style=plot.style_circles,
color=color.new(color.blue,40), linewidth=1)
labelTpSl(y, txt, color) =>
label labelTpSl = stop_price_perc != 0 ? label.new(bar_index + 1, y, txt,
xloc.bar_index, yloc.price, color, label.style_label_left, color.white,
size.normal) : na
label.delete(labelTpSl[1])
labelTpSl(strategy.position_avg_price, "Entry: " +
str.tostring(math.round_to_mintick(strategy.position_avg_price)),
color.new(color.blue, 40))
labelTpSl(color_stop_loss_price , "Stop Loss: " +
str.tostring(math.round_to_mintick(color_stop_loss_price)), bullsl)
labelTpSl(strategy.position_size > 0 ? tp1_price_long : tp1_price_short, "Take
Profit 1: " + str.tostring(math.round_to_mintick(strategy.position_size > 0 ?
tp1_price_long : tp1_price_short)), bulltp)
labelTpSl(strategy.position_size > 0 ? tp3_price_long : tp3_price_short, "Take
Profit 2: " + str.tostring(math.round_to_mintick(strategy.position_size > 0 ?
tp3_price_long : tp3_price_short)), bulltp)
labelTpSl(strategy.position_size > 0 ? tp4_price_long : tp4_price_short, "Take
Profit 3: " + str.tostring(math.round_to_mintick(strategy.position_size > 0 ?
tp4_price_long : tp4_price_short)), bulltp)
labelTpSl(strategy.position_size > 0 ? tp5_price_long : tp5_price_short, "Take
Profit 4: " + str.tostring(math.round_to_mintick(strategy.position_size > 0 ?
tp5_price_long : tp5_price_short)), bulltp)
labelTpSl(strategy.position_size > 0 ? tp7_price_long : tp7_price_short, "Take
Profit 5: " + str.tostring(math.round_to_mintick(strategy.position_size > 0 ?
tp7_price_long : tp7_price_short)), bulltp)
labelTpSl(strategy.position_size > 0 ? tp8_price_long : tp8_price_short, "Take
Profit 6: " + str.tostring(math.round_to_mintick(strategy.position_size > 0 ?
tp8_price_long : tp8_price_short)), bulltp)
// Background Color
bullbg = input.color(color.new(color.green, 80), "Bull Color", group =
"background", inline = "cadn1")
bearbg = input.color(color.new(color.red, 80), "Bear Color", group = "background",
inline = "cadn1")
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
// STATISTICS
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
// ------------------------------------------------------------------
// Cumulative (Long AND Short)
// ------------------------------------------------------------------
// Function for defining the Peak Profit Percentage of a specific past closed trade
tradePercentPossible(trade_num) =>
endP = strategy.closedtrades.entry_price(trade_num) *
math.abs(strategy.closedtrades.size(trade_num))
prof = strategy.closedtrades.max_runup(trade_num)
possibleInPercent = prof / endP *100
// Function for defining the Peak Drawdown Percentage of a specific past closed
trade
drawdownPercentPossible(trade_num) =>
money = strategy.closedtrades.entry_price(trade_num) *
math.abs(strategy.closedtrades.size(trade_num))
dd = strategy.closedtrades.max_drawdown(trade_num)
dd_possibleInPercent = dd / money *100
// Function for defining the average Peak Profit of the last N trades
average_max_profit(N, leverage) =>
start = strategy.closedtrades
float sum_peak = 0.0
float result = 0.0
if barstate.islast or barstate.islastconfirmedhistory
for i = (start - 1) to (start - N)
sum_peak := sum_peak + tradePercentPossible(i)
result := sum_peak * leverage / N
math.round(result,2)
// Function for defining the average Peak Drawdown of the last N trades
average_max_drawdown(N, leverage) =>
start = strategy.closedtrades
float sum_peak = 0.0
float result = 0.0
if barstate.islast or barstate.islastconfirmedhistory
for i = (start - 1) to (start - N)
sum_peak := sum_peak + drawdownPercentPossible(i)
result := sum_peak * leverage / N
math.round(result,2)
// Function which gives the % of times a certain Peak Profit Percentage has been
achieved for the last N trades
tpWinRate(_numTrade, _prof)=>
float perc = 0
int count = 0
start = strategy.closedtrades
if barstate.islast or barstate.islastconfirmedhistory
for i = start - 1 to (start - _numTrade)
prof = tradePercentPossible(i)
if prof >= _prof
count += 1
perc := count*100 / _numTrade
perc
// ------------------------------------------------------------------
// Specific (Long OR Short)
// ------------------------------------------------------------------
// Function computing the winrate for a specific %TP and a specific kind of
position (L or S)
tp_winrate(type, tp_perc, num_tr) =>
start = strategy.closedtrades
float perc = 0
int count = 0
int short_counted = 0
int long_counted = 0
if barstate.islast or barstate.islastconfirmedhistory
for i = start - 1 to 0
if type == "short" and strategy.closedtrades.size(i) < 0 and
short_counted < num_tr
prof = tradePercentPossible(i)
short_counted += 1
if prof >= tp_perc
count += 1
if barstate.islast or barstate.islastconfirmedhistory
for i = start - 1 to 0
if type == "short" and strategy.closedtrades.size(i) < 0 and
short_counted < num_tr
sum_peak := sum_peak + tradePercentPossible(i)
short_counted += 1
if type == "long" and strategy.closedtrades.size(i) > 0 and
long_counted < num_tr
sum_peak := sum_peak + tradePercentPossible(i)
long_counted += 1
math.round(result,2)
if barstate.islast or barstate.islastconfirmedhistory
for i = start - 1 to 0
if type == "short" and strategy.closedtrades.size(i) < 0 and
short_counted < num_tr
sum_peak := sum_peak + drawdownPercentPossible(i)
short_counted += 1
math.round(result,2)
// ------------------------------------------------------------------
// Cumulative Results
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// TABLE LONG vs SHORT
// ------------------------------------------------------------------
if show_table
stats_table := table.new(dash_pos, 4, 20, border_width=1)
// Compute the averages for Max Profit, R/R Factor, and Drawdown
avg_max_profit = (max_profit("long", number_trades_statistics, leverage) +
max_profit("short", number_trades_statistics, leverage)) / 2
avg_rr = (rr_long + rr_short) / 2
avg_drawdown = (max_drawdown("long", number_trades_statistics, leverage) +
max_drawdown("short", number_trades_statistics, leverage)) / 2
if show_table
table.merge_cells(stats_table, 0, 0, 1, 0)