Predictum Light

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 29

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.

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

stop_price_perc = input.float(title="Stop Loss %", defval=1.5, minval=0,


maxval=100, group="tp/sl")

show_table = input.bool(true, "Show Status Table", "Enables/Disables Status Table",


group = "Table Parameters")
table_txt_bg_color = input.color(color.new(color.gray, 80), "Background", inline =
"2", group = "Table Parameters")
table_txt_color = input.color( color.new(color.white, 25), "Text", inline = "2",
group = "Table Parameters")
table_txt_size = input.string("auto", "Text Size", inline = "2", options = ["auto",
"tiny", "small", "normal", "large", "huge"], group = "Table Parameters")
table_position = input.string("Top Right", "Position", ["Top Right", "Top Middle",
"Top Left", "Center Right", "Center", "Center Left", "Bottom Right", "Bottom
Middle", "Bottom Left"], "Change the Position Of your dashboard", "t3", "Table
Parameters")
//table_size = input.string("auto", "Table Size", inline = "t3", options =
["auto", "tiny", "small", "normal", "large", "huge"], group = "Table Parameters")

dash_pos = table_position == "Top Right" ? position.top_right : table_position ==


"Top Middle" ? position.top_center : table_position == "Top Left" ?
position.top_left : table_position == "Center Right" ? position.middle_right :
table_position == "Center" ? position.middle_center : table_position == "Center
Left" ? position.middle_left : table_position == "Bottom Right" ?
position.bottom_right : table_position == "Bottom Middle" ? position.bottom_center
: position.bottom_left

//

bgShow = input.bool(true, "Background Assistance", group = "background")

//

showCandle = input.bool(true, "Show Barcolors", group = "bar coloring")

// ---------------------------------------------------
// 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

tp1_price_long = strategy.position_avg_price * (1 + 0.005/1.0)


tp2_price_long = strategy.position_avg_price * (1 + 0.008/1.0)
tp3_price_long = strategy.position_avg_price * (1 + 0.013/1.0)
tp4_price_long = strategy.position_avg_price * (1 + 0.021/1.0)
tp5_price_long = strategy.position_avg_price * (1 + 0.034/1.0)
tp6_price_long = strategy.position_avg_price * (1 + 0.055/1.0)
tp7_price_long = strategy.position_avg_price * (1 + 0.089/1.0)
tp8_price_long = strategy.position_avg_price * (1 + 0.144/1.0)

//long_stop_price = strategy.position_avg_price * (1 - (stop_price_perc / 100)/1.0)


//long_stop_trade = close <= long_stop_price
long_start_trade = close >= long_entry_ma_value_trigger

// ------------------------------------------
// 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

tp1_price_short = strategy.position_avg_price * (1 - 0.005/1.0)


tp2_price_short = strategy.position_avg_price * (1 - 0.008/1.0)
tp3_price_short = strategy.position_avg_price * (1 - 0.013/1.0)
tp4_price_short = strategy.position_avg_price * (1 - 0.021/1.0)
tp5_price_short = strategy.position_avg_price * (1 - 0.034/1.0)
tp6_price_short = strategy.position_avg_price * (1 - 0.055/1.0)
tp7_price_short = strategy.position_avg_price * (1 - 0.089/1.0)
tp8_price_short = strategy.position_avg_price * (1 - 0.144/1.0)

//short_stop_price = strategy.position_avg_price * (1 + (stop_price_perc /


100)/1.0)
//short_stop_trade = close >= short_stop_price
short_start_trade = close <= short_entry_ma_value_trigger

// ------------------------------------------
// LONG TRADE
// ------------------------------------------

var label pre_entry_label_long = na


var label positionMaxLabel_long = na
var firstOrderPlaced_long = false
var ath = high
var peak_profit_long = 0.0
var string peak_profit_string_long = na

var drawdown_long = close


var peak_drawdown_long = 0.0

if close >= long_entry_ma_value_trigger * 0.8


strategy.entry("operation_long", strategy.long,
stop=long_entry_ma_value_trigger, comment="Long")

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

else if strategy.position_size > 0


if (ath < high)
ath := high
peak_profit_long := (((ath - strategy.position_avg_price) /
strategy.position_avg_price) * 100) * leverage // The last value is the leverage
peak_profit_string_long := str.tostring(math.round(peak_profit_long, 2))
if (firstOrderPlaced_long)
label.set_x(positionMaxLabel_long, bar_index)
label.set_y(positionMaxLabel_long, ath)
label.set_text(positionMaxLabel_long, "Peak Profit " +
peak_profit_string_long + "%")

if drawdown_long > low


drawdown_long := low
peak_drawdown_long := (((drawdown_long - strategy.position_avg_price) /
strategy.position_avg_price) * 100) * leverage

if short_start_trade and strategy.position_size > 0


strategy.close("operation_long", comment="Close Long due to Short Signal")

// ------------------------------------------
// SHORT TRADE
// ------------------------------------------

var label pre_entry_label_short = na


var label positionMaxLabel_short = na
var firstOrderPlaced_short = false
var atl = low
var peak_profit_short = 0.0
var string peak_profit_string_short = na

var drawdown_short = close


var peak_drawdown_short = 0.0

if close <= short_entry_ma_value_trigger * 1.2


strategy.entry("operation_short", strategy.short,
stop=short_entry_ma_value_trigger, comment="Short")

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

else if strategy.position_size < 0


if (atl > low)
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))
if (firstOrderPlaced_short)
label.set_x(positionMaxLabel_short, bar_index)
label.set_y(positionMaxLabel_short, atl)
label.set_text(positionMaxLabel_short, "Peak Profit " +
peak_profit_string_short + "%")

if drawdown_short < high


drawdown_short := high
peak_drawdown_short := -(((drawdown_short - strategy.position_avg_price) /
strategy.position_avg_price) * 100) * leverage

if long_start_trade and strategy.position_size < 0


strategy.close("operation_short", comment="Close Short due to Long Signal")

///////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////

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 Relevant Levels


bulltp = input.color(color.new(color.green,40), "TP Color(s)", group = "tp
coloring", inline = "can11")
bullsl = input.color(color.new(color.red, 40), "SL Color(s)", group = "tp
coloring", inline = "can11")

// This is just the SL level


long_stop_price = strategy.position_avg_price * (1 - (stop_price_perc / 100)/1.0)
short_stop_price = strategy.position_avg_price * (1 + (stop_price_perc / 100)/1.0)

color_stop_loss_price = strategy.position_size < 0 ? short_stop_price :


long_stop_price
plot(color_stop_loss_price, style=plot.style_circles, color=bullsl, linewidth=1)

plot(strategy.position_size > 0 ? tp1_price_long : na, style=plot.style_circles,


color=bulltp, linewidth=1)
plot(strategy.position_size > 0 ? tp3_price_long : na, style=plot.style_circles,
color=bulltp, linewidth=1)
plot(strategy.position_size > 0 ? tp4_price_long : na, style=plot.style_circles,
color=bulltp, linewidth=1)
plot(strategy.position_size > 0 ? tp5_price_long : na, style=plot.style_circles,
color=bulltp, linewidth=1)
plot(strategy.position_size > 0 ? tp7_price_long : na, style=plot.style_circles,
color=bulltp, linewidth=1)
plot(strategy.position_size > 0 ? tp8_price_long : na, style=plot.style_circles,
color=bulltp, linewidth=1)

plot(strategy.position_size < 0 ? tp1_price_short : na, style=plot.style_circles,


color=bulltp, linewidth=1)
plot(strategy.position_size < 0 ? tp3_price_short : na, style=plot.style_circles,
color=bulltp, linewidth=1)
plot(strategy.position_size < 0 ? tp4_price_short : na, style=plot.style_circles,
color=bulltp, linewidth=1)
plot(strategy.position_size < 0 ? tp5_price_short : na, style=plot.style_circles,
color=bulltp, linewidth=1)
plot(strategy.position_size < 0 ? tp7_price_short : na, style=plot.style_circles,
color=bulltp, linewidth=1)
plot(strategy.position_size < 0 ? tp8_price_short : na, style=plot.style_circles,
color=bulltp, linewidth=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")

backgroundColor = strategy.position_size < 0 ? bearbg : strategy.position_size >


0 ? bullbg : na
bgcolor(bgShow ? backgroundColor : na)

bullBar = input.color(color.new(color.green, 0), "Bullish Candles", group = "bar


coloring", inline = "can1")
bearBar = input.color(color.new(color.red, 0), "Bearish Candles", group = "bar
coloring", inline = "can1")

upCandle = strategy.position_size < 0 ? bearBar : strategy.position_size > 0 ?


bullBar : na

barcolor(showCandle ? upCandle : na)

///////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
// 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

perc := count*100 / num_tr

if type == "long" and strategy.closedtrades.size(i) > 0 and


long_counted < num_tr
prof = tradePercentPossible(i)
long_counted += 1
if prof >= tp_perc
count += 1

perc := count*100 / num_tr


math.round(perc, 0)

// Function computing the max profit for N specific positions (L or S)


max_profit(type, num_tr, leverage) =>
start = strategy.closedtrades
float sum_peak = 0.0
float result = 0.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
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

result := sum_peak * leverage / num_tr

math.round(result,2)

// Function computing the max drawdown for N specific positions (L or S)


max_drawdown(type, num_tr, leverage) =>
start = strategy.closedtrades
float sum_peak = 0.0
float result = 0.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
sum_peak := sum_peak + drawdownPercentPossible(i)
short_counted += 1

if type == "long" and strategy.closedtrades.size(i) > 0 and


long_counted < num_tr
sum_peak := sum_peak + drawdownPercentPossible(i)
long_counted += 1

result := sum_peak * leverage / num_tr

math.round(result,2)

// ------------------------------------------------------------------
// Cumulative Results
// ------------------------------------------------------------------

tp1WR_50 = tpWinRate(50, 0.5/1.0)


tp3WR_50 = tpWinRate(50, 1.3/1.0)
tp4WR_50= tpWinRate(50, 2.1/1.0)
tp5WR_50 = tpWinRate(50, 3.4/1.0)
tp7WR_50 = tpWinRate(50, 8.9/1.0)
tp8WR_50= tpWinRate(50, 14.4/1.0)

// ------------------------------------------------------------------
// TABLE LONG vs SHORT
// ------------------------------------------------------------------

// Initialize stats_table with type 'na'


var table stats_table = na

if show_table
stats_table := table.new(dash_pos, 4, 20, border_width=1)

// Your other code for calculations remains unchanged...


// Combines the long and short things into one lol
rr_long = max_profit("long", number_trades_statistics, leverage) /
max_drawdown("long", number_trades_statistics, leverage)
rr_short = max_profit("short", number_trades_statistics, leverage) /
max_drawdown("short", number_trades_statistics, leverage)

// 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.cell(stats_table, 0, 0, text="LIGHT ALGO", width=5, height=5,


text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 1, 0, text="", width=5, height=5,
text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 0, 1, text= "TP 1: " , width=5, height=5,
text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 1, 1, text= str.tostring(math.floor(tp1WR_50)) + "%" +
"\n", width=5, height=5, text_valign=text.align_center,
text_halign=text.align_center, bgcolor=table_txt_bg_color,
text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 0, 2, text= "TP 2: " , width=5, height=5,
text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 1, 2, text= str.tostring(math.floor(tp3WR_50)) + "%" +
"\n", width=5, height=5, text_valign=text.align_center,
text_halign=text.align_center, bgcolor=table_txt_bg_color,
text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 0, 3, text= "TP 3: " , width=5, height=5,
text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 1, 3, text= str.tostring(math.floor(tp4WR_50)) + "%" +
"\n", width=5, height=5, text_valign=text.align_center,
text_halign=text.align_center, bgcolor=table_txt_bg_color,
text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 0, 4, text= "TP 4: " , width=5, height=5,
text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 1, 4, text= str.tostring(math.floor(tp5WR_50)) + "%" +
"\n", width=5, height=5, text_valign=text.align_center,
text_halign=text.align_center, bgcolor=table_txt_bg_color,
text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 0, 5, text= "TP 5: " , width=5, height=5,
text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 1, 5, text= str.tostring(math.floor(tp7WR_50)) + "%" +
"\n", width=5, height=5, text_valign=text.align_center,
text_halign=text.align_center, bgcolor=table_txt_bg_color,
text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 0, 6, text= "TP 6: " , width=5, height=5,
text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 1, 6, text= str.tostring(math.floor(tp8WR_50)) + "%" +
"\n", width=5, height=5, text_valign=text.align_center,
text_halign=text.align_center, bgcolor=table_txt_bg_color,
text_color=table_txt_color, text_size=size.normal)

table.merge_cells(stats_table, 0, 0, 1, 0)

table.cell(stats_table, 0, 7, text= "Max Profit |" , width=6, height=5,


text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 1, 7, text= str.tostring(avg_max_profit) + "%" + "\n",
width=5, height=5, text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 0, 8, text= "Drawdown |" , width=6, height=5,
text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 1, 8, text= str.tostring(avg_drawdown) + "%" + "\n",
width=5, height=5, text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 0, 9, text= "R/R Factor |" , width=6, height=5,
text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)
table.cell(stats_table, 1, 9, text= str.tostring(math.round(avg_rr,2)),
width=6, height=5, text_valign=text.align_center, text_halign=text.align_center,
bgcolor=table_txt_bg_color, text_color=table_txt_color, text_size=size.normal)

You might also like