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

//@version=5

strategy(title='BlueWave', calc_on_order_fills=false,
default_qty_type=strategy.percent_of_equity, default_qty_value=100, overlay=false,
commission_type=strategy.commission.percent, commission_value=.05,
initial_capital=10000)

leverage = input.float(1, 'Leverage', group='Base Settings')


baseTimeframe = input.int(180, 'Base Timeframe', group='Base Settings')

loss_threshold = input.int(12, 'Stop loss %', group='Exits')


profit_threshold = input.int(12, 'Take profit %', group='Exits')
loss_threshold_short = input.int(12, 'Stop loss % - short', group='Exits')
profit_threshold_short = input.int(12, 'Take profit % - short', group='Exits')

wtChannelLen = input.int(11, 'WT Channel Length', group='WaveTrend')


wtAverageLen = input.int(13, 'WT Average Length', group='WaveTrend')
wtMALen = input.int(5, 'WT MA Length', group='WaveTrend')

wtChannelLenShort = input.int(11,'Short WT Channel Length', group='WaveTrend')


wtAverageLenShort = input.int(13, 'Short WT Average Length', group='WaveTrend')
wtMALenShort = input.int(5, 'Short WT MA Length', group='WaveTrend')

smaShortEntry = input.int(21, 'SMA short entry')


smaShortClose = input.int(25, 'SMA short close')
smaLongEntry = input.int(7, 'SMA long entry')

rsiLength = input.int(10, 'RSI Length')


overbought = input.int(70, 'Overbought Level')
oversold = input.int(30, 'Oversold Level')

colorWT1 = #90caf9
colorWT2 = #0d47a1

user_defined_loss_threshold = loss_threshold
user_defined_profit_threshold = profit_threshold
user_defined_loss_threshold_short = loss_threshold_short
user_defined_profit_threshold_short = profit_threshold_short
user_defined_baseTimeframe = baseTimeframe
user_defined_wtChannelLen = wtChannelLen
user_defined_wtAverageLen = wtAverageLen
user_defined_wtMALen = wtMALen
user_defined_wtChannelLenShort = wtChannelLenShort
user_defined_wtAverageLenShort = wtAverageLenShort
user_defined_wtMALenShort = wtMALenShort
user_defined_smaShortEntry = smaShortEntry
user_defined_smaShortClose = smaShortClose
user_defined_smaLongEntry = smaLongEntry
user_defined_rsiLength = rsiLength
user_defined_overbought = overbought
user_defined_oversold = oversold

if (str.contains(syminfo.tickerid, 'ETH'))
loss_threshold := 30
profit_threshold := 8
loss_threshold_short := 17
profit_threshold_short := 16
baseTimeframe := 180
wtChannelLen := 21
wtAverageLen := 10
wtMALen := 5
wtChannelLenShort := 34
wtAverageLenShort := 34
wtMALenShort := 3
smaShortEntry := 23
smaShortClose := 20
smaLongEntry := 6
rsiLength := 26
overbought := 57
oversold := 50

if (str.contains(syminfo.tickerid, 'BTC'))
loss_threshold := 20
profit_threshold := 5
loss_threshold_short := 15
profit_threshold_short := 12
baseTimeframe := 150
wtChannelLen := 12
wtAverageLen := 5
wtMALen := 15
wtChannelLenShort := 11
wtAverageLenShort := 30
wtMALenShort := 3
smaShortEntry := 24
smaShortClose := 17
smaLongEntry := 11
rsiLength := 10
overbought := 70
oversold := 20

if (str.contains(syminfo.tickerid, 'SOL'))
loss_threshold := 20
profit_threshold := 20
loss_threshold_short := 23
profit_threshold_short := 5
baseTimeframe := 198
wtChannelLen := 9
wtAverageLen := 26
wtMALen := 5
wtChannelLenShort := 10
wtAverageLenShort := 42
wtMALenShort := 4
smaShortEntry := 34
smaShortClose := 26
smaLongEntry := 3
rsiLength := 8
overbought := 134
oversold := 45

if (str.contains(syminfo.tickerid, 'ADA'))
loss_threshold := 32
profit_threshold := 8
loss_threshold_short := 14
profit_threshold_short := 21
baseTimeframe := 180
wtChannelLen := 15
wtAverageLen := 14
wtMALen := 4
wtChannelLenShort := 8
wtAverageLenShort := 16
wtMALenShort := 5
smaShortEntry := 13
smaShortClose := 33
smaLongEntry := 6
rsiLength := 80
overbought := 130
oversold := 30

if (str.contains(syminfo.tickerid, 'MATIC'))
loss_threshold := 50
profit_threshold := 55
loss_threshold_short := 29
profit_threshold_short := 24
baseTimeframe := 156
wtChannelLen := 16
wtAverageLen := 8
wtMALen := 9
wtChannelLenShort := 14
wtAverageLenShort := 5
wtMALenShort := 8
smaShortEntry := 22
smaShortClose := 26
smaLongEntry := 5
rsiLength := 62
overbought := 130
oversold := 37

if (str.contains(syminfo.tickerid, 'AVAX'))
loss_threshold := 35
profit_threshold := 25
loss_threshold_short := 23
profit_threshold_short := 10
baseTimeframe := 180
wtChannelLen := 11
wtAverageLen := 17
wtMALen := 26
wtChannelLenShort := 12
wtAverageLenShort := 14
wtMALenShort := 6
smaShortEntry := 33
smaShortClose := 33
smaLongEntry := 24
rsiLength := 7
overbought := 101
oversold := 44

if (str.contains(syminfo.tickerid, 'DOT'))
loss_threshold := 23
profit_threshold := 15
loss_threshold_short := 14
profit_threshold_short := 22
baseTimeframe := 159
wtChannelLen := 16
wtAverageLen := 7
wtMALen := 6
wtChannelLenShort := 33
wtAverageLenShort := 24
wtMALenShort := 3
smaShortEntry := 45
smaShortClose := 38
smaLongEntry := 7
rsiLength := 5
overbought := 70
oversold := 40

if (str.contains(syminfo.tickerid, 'FTM'))
loss_threshold := 20
profit_threshold := 26
loss_threshold_short := 18
profit_threshold_short := 8
baseTimeframe := 170
wtChannelLen := 6
wtAverageLen := 15
wtMALen := 5
wtChannelLenShort := 28
wtAverageLenShort := 30
wtMALenShort := 3
smaShortEntry := 28
smaShortClose := 39
smaLongEntry := 7
rsiLength := 11
overbought := 55
oversold := 30

if (str.contains(syminfo.tickerid, 'RUNE'))
loss_threshold := 18
profit_threshold := 8
loss_threshold_short := 15
profit_threshold_short := 5
baseTimeframe := 103
wtChannelLen := 14
wtAverageLen := 9
wtMALen := 13
wtChannelLenShort := 27
wtAverageLenShort := 25
wtMALenShort := 3
smaShortEntry := 7
smaShortClose := 11
smaLongEntry := 11
rsiLength := 11
overbought := 60
oversold := 46

if (str.contains(syminfo.tickerid, 'FET'))
loss_threshold := 41
profit_threshold := 13
loss_threshold_short := 11
profit_threshold_short := 20
baseTimeframe := 140
wtChannelLen := 23
wtAverageLen := 12
wtMALen := 25
wtChannelLenShort := 15
wtAverageLenShort := 40
wtMALenShort := 3
smaShortEntry := 38
smaShortClose := 29
smaLongEntry := 24
rsiLength := 26
overbought := 55
oversold := 50

if (str.contains(syminfo.tickerid, 'RNDR'))
loss_threshold := 38
profit_threshold := 5
loss_threshold_short := 12
profit_threshold_short := 5
baseTimeframe := 180
wtChannelLen := 8
wtAverageLen := 26
wtMALen := 5
wtChannelLenShort := 12
wtAverageLenShort := 7
wtMALenShort := 5
smaShortEntry := 33
smaShortClose := 5
smaLongEntry := 9
rsiLength := 5
overbought := 55
oversold := 30

if (str.contains(syminfo.tickerid, 'KAS'))
loss_threshold := 17
profit_threshold := 12
loss_threshold_short := 14
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 12
wtAverageLen := 10
wtMALen := 8
wtChannelLenShort := 60
wtAverageLenShort := 24
wtMALenShort := 3
smaShortEntry := 16
smaShortClose := 35
smaLongEntry := 19
rsiLength := 33
overbought := 55
oversold := 30

if (str.contains(syminfo.tickerid, 'IMX'))
loss_threshold := 47
profit_threshold := 17
loss_threshold_short := 5
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 23
wtAverageLen := 53
wtMALen := 8
wtChannelLenShort := 39
wtAverageLenShort := 26
wtMALenShort := 3
smaShortEntry := 14
smaShortClose := 7
smaLongEntry := 22
rsiLength := 11
overbought := 60
oversold := 50

if (str.contains(syminfo.tickerid, 'FIL'))
loss_threshold := 53
profit_threshold := 12
loss_threshold_short := 32
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 9
wtAverageLen := 15
wtMALen := 36
wtChannelLenShort := 12
wtAverageLenShort := 39
wtMALenShort := 5
smaShortEntry := 8
smaShortClose := 37
smaLongEntry := 32
rsiLength := 10
overbought := 70
oversold := 40

if (str.contains(syminfo.tickerid, 'WIF'))
loss_threshold := 100
profit_threshold := 8
loss_threshold_short := 14
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 11
wtAverageLen := 24
wtMALen := 36
wtChannelLenShort := 6
wtAverageLenShort := 40
wtMALenShort := 8
smaShortEntry := 13
smaShortClose := 6
smaLongEntry := 19
rsiLength := 5
overbought := 55
oversold := 30

if (str.contains(syminfo.tickerid, 'DOGE'))
loss_threshold := 71
profit_threshold := 55
loss_threshold_short := 17
profit_threshold_short := 5
baseTimeframe := 141
wtChannelLen := 11
wtAverageLen := 29
wtMALen := 11
wtChannelLenShort := 7
wtAverageLenShort := 9
wtMALenShort := 8
smaShortEntry := 31
smaShortClose := 29
smaLongEntry := 5
rsiLength := 27
overbought := 55
oversold := 30

if (str.contains(syminfo.tickerid, 'WLD'))
loss_threshold := 15
profit_threshold := 12
loss_threshold_short := 12
profit_threshold_short := 12
baseTimeframe := 160
wtChannelLen := 24
wtAverageLen := 14
wtMALen := 20
wtChannelLenShort := 11
wtAverageLenShort := 13
wtMALenShort := 5
smaShortEntry := 21
smaShortClose := 25
smaLongEntry := 7
rsiLength := 10
overbought := 70
oversold := 70

if (str.contains(syminfo.tickerid, 'SEI'))
loss_threshold := 55
profit_threshold := 65
loss_threshold_short := 95
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 23
wtAverageLen := 10
wtMALen := 26
wtChannelLenShort := 40
wtAverageLenShort := 13
wtMALenShort := 31
smaShortEntry := 24
smaShortClose := 25
smaLongEntry := 5
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'AAVE'))
loss_threshold := 12
profit_threshold := 95
loss_threshold_short := 12
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 8
wtAverageLen := 13
wtMALen := 5
wtChannelLenShort := 24
wtAverageLenShort := 19
wtMALenShort := 5
smaShortEntry := 40
smaShortClose := 18
smaLongEntry := 7
rsiLength := 10
overbought := 70
oversold := 30
if (str.contains(syminfo.tickerid, 'GRT'))
loss_threshold := 92
profit_threshold := 20
loss_threshold_short := 10
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 59
wtAverageLen := 33
wtMALen := 19
wtChannelLenShort := 11
wtAverageLenShort := 25
wtMALenShort := 37
smaShortEntry := 25
smaShortClose := 24
smaLongEntry := 41
rsiLength := 10
overbought := 55
oversold := 30

if (str.contains(syminfo.tickerid, 'THETA'))
loss_threshold := 12
profit_threshold := 55
loss_threshold_short := 23
profit_threshold_short := 5
baseTimeframe := 180
wtChannelLen := 11
wtAverageLen := 22
wtMALen := 5
wtChannelLenShort := 14
wtAverageLenShort := 21
wtMALenShort := 5
smaShortEntry := 55
smaShortClose := 12
smaLongEntry := 8
rsiLength := 5
overbought := 70
oversold := 40

if (str.contains(syminfo.tickerid, 'SAND'))
loss_threshold := 38
profit_threshold := 65
loss_threshold_short := 12
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 11
wtAverageLen := 13
wtMALen := 5
wtChannelLenShort := 6
wtAverageLenShort := 21
wtMALenShort := 5
smaShortEntry := 13
smaShortClose := 22
smaLongEntry := 12
rsiLength := 10
overbought := 70
oversold := 45

if (str.contains(syminfo.tickerid, 'AXS'))
loss_threshold := 50
profit_threshold := 8
loss_threshold_short := 10
profit_threshold_short := 5
baseTimeframe := 180
wtChannelLen := 11
wtAverageLen := 26
wtMALen := 5
wtChannelLenShort := 7
wtAverageLenShort := 13
wtMALenShort := 5
smaShortEntry := 13
smaShortClose := 30
smaLongEntry := 7
rsiLength := 41
overbought := 80
oversold := 30

if (str.contains(syminfo.tickerid, 'RSR'))
loss_threshold := 5
profit_threshold := 65
loss_threshold_short := 12
profit_threshold_short := 12
baseTimeframe := 170
wtChannelLen := 11
wtAverageLen := 22
wtMALen := 5
wtChannelLenShort := 37
wtAverageLenShort := 13
wtMALenShort := 5
smaShortEntry := 25
smaShortClose := 6
smaLongEntry := 7
rsiLength := 27
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'SNX'))
loss_threshold := 5
profit_threshold := 65
loss_threshold_short := 12
profit_threshold_short := 10
baseTimeframe := 170
wtChannelLen := 16
wtAverageLen := 22
wtMALen := 25
wtChannelLenShort := 22
wtAverageLenShort := 13
wtMALenShort := 6
smaShortEntry := 17
smaShortClose := 12
smaLongEntry := 36
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'STX'))
loss_threshold := 80
profit_threshold := 8
loss_threshold_short := 14
profit_threshold_short := 10
baseTimeframe := 170
wtChannelLen := 10
wtAverageLen := 7
wtMALen := 29
wtChannelLenShort := 25
wtAverageLenShort := 13
wtMALenShort := 6
smaShortEntry := 7
smaShortClose := 37
smaLongEntry := 22
rsiLength := 26
overbought := 55
oversold := 50

if (str.contains(syminfo.tickerid, '1INCH'))
loss_threshold := 30
profit_threshold := 12
loss_threshold_short := 15
profit_threshold_short := 10
baseTimeframe := 180
wtChannelLen := 40
wtAverageLen := 13
wtMALen := 5
wtChannelLenShort := 15
wtAverageLenShort := 13
wtMALenShort := 5
smaShortEntry := 21
smaShortClose := 25
smaLongEntry := 7
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'ARKM'))
loss_threshold := 20
profit_threshold := 26
loss_threshold_short := 17
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 12
wtAverageLen := 35
wtMALen := 7
wtChannelLenShort := 33
wtAverageLenShort := 44
wtMALenShort := 37
smaShortEntry := 40
smaShortClose := 27
smaLongEntry := 8
rsiLength := 10
overbought := 55
oversold := 30

if (str.contains(syminfo.tickerid, 'MEME'))
loss_threshold := 25
profit_threshold := 90
loss_threshold_short := 12
profit_threshold_short := 12
baseTimeframe := 150
wtChannelLen := 10
wtAverageLen := 39
wtMALen := 5
wtChannelLenShort := 28
wtAverageLenShort := 30
wtMALenShort := 8
smaShortEntry := 35
smaShortClose := 39
smaLongEntry := 7
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'EGLD'))
loss_threshold := 40
profit_threshold := 20
loss_threshold_short := 23
profit_threshold_short := 8
baseTimeframe := 210
wtChannelLen := 11
wtAverageLen := 42
wtMALen := 5
wtChannelLenShort := 11
wtAverageLenShort := 22
wtMALenShort := 19
smaShortEntry := 40
smaShortClose := 24
smaLongEntry := 9
rsiLength := 2
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'VET'))
loss_threshold := 20
profit_threshold := 95
loss_threshold_short := 20
profit_threshold_short := 8
baseTimeframe := 168
wtChannelLen := 11
wtAverageLen := 25
wtMALen := 5
wtChannelLenShort := 11
wtAverageLenShort := 13
wtMALenShort := 5
smaShortEntry := 45
smaShortClose := 41
smaLongEntry := 9
rsiLength := 10
overbought := 70
oversold := 45

if (str.contains(syminfo.tickerid, 'WAVES'))
loss_threshold := 12
profit_threshold := 20
loss_threshold_short := 11
profit_threshold_short := 12
baseTimeframe := 189
wtChannelLen := 13
wtAverageLen := 14
wtMALen := 5
wtChannelLenShort := 6
wtAverageLenShort := 18
wtMALenShort := 5
smaShortEntry := 13
smaShortClose := 45
smaLongEntry := 6
rsiLength := 11
overbought := 55
oversold := 30

if (str.contains(syminfo.tickerid, 'CHZ'))
loss_threshold := 12
profit_threshold := 100
loss_threshold_short := 5
profit_threshold_short := 35
baseTimeframe := 180
wtChannelLen := 37
wtAverageLen := 39
wtMALen := 5
wtChannelLenShort := 11
wtAverageLenShort := 13
wtMALenShort := 37
smaShortEntry := 36
smaShortClose := 22
smaLongEntry := 18
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'ZRX'))
loss_threshold := 12
profit_threshold := 45
loss_threshold_short := 12
profit_threshold_short := 12
baseTimeframe := 190
wtChannelLen := 11
wtAverageLen := 13
wtMALen := 26
wtChannelLenShort := 11
wtAverageLenShort := 13
wtMALenShort := 5
smaShortEntry := 21
smaShortClose := 28
smaLongEntry := 12
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'ID'))
loss_threshold := 12
profit_threshold := 12
loss_threshold_short := 5
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 19
wtAverageLen := 39
wtMALen := 33
wtChannelLenShort := 17
wtAverageLenShort := 12
wtMALenShort := 33
smaShortEntry := 10
smaShortClose := 26
smaLongEntry := 9
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'SXP'))
loss_threshold := 100
profit_threshold := 70
loss_threshold_short := 20
profit_threshold_short := 5
baseTimeframe := 180
wtChannelLen := 9
wtAverageLen := 20
wtMALen := 5
wtChannelLenShort := 11
wtAverageLenShort := 13
wtMALenShort := 5
smaShortEntry := 37
smaShortClose := 9
smaLongEntry := 6
rsiLength := 10
overbought := 70
oversold := 40

if (str.contains(syminfo.tickerid, 'PERP'))
loss_threshold := 65
profit_threshold := 5
loss_threshold_short := 11
profit_threshold_short := 5
baseTimeframe := 210
wtChannelLen := 5
wtAverageLen := 25
wtMALen := 5
wtChannelLenShort := 20
wtAverageLenShort := 19
wtMALenShort := 26
smaShortEntry := 5
smaShortClose := 26
smaLongEntry := 7
rsiLength := 5
overbought := 55
oversold := 30

if (str.contains(syminfo.tickerid, 'NEO'))
loss_threshold := 12
profit_threshold := 12
loss_threshold_short := 50
profit_threshold_short := 5
baseTimeframe := 180
wtChannelLen := 22
wtAverageLen := 12
wtMALen := 5
wtChannelLenShort := 10
wtAverageLenShort := 18
wtMALenShort := 5
smaShortEntry := 21
smaShortClose := 22
smaLongEntry := 7
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'ONT'))
loss_threshold := 12
profit_threshold := 60
loss_threshold_short := 25
profit_threshold_short := 85
baseTimeframe := 180
wtChannelLen := 18
wtAverageLen := 13
wtMALen := 5
wtChannelLenShort := 19
wtAverageLenShort := 13
wtMALenShort := 5
smaShortEntry := 35
smaShortClose := 33
smaLongEntry := 7
rsiLength := 15
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'ALICE'))
loss_threshold := 10
profit_threshold := 70
loss_threshold_short := 8
profit_threshold_short := 8
baseTimeframe := 180
wtChannelLen := 15
wtAverageLen := 14
wtMALen := 5
wtChannelLenShort := 8
wtAverageLenShort := 7
wtMALenShort := 7
smaShortEntry := 36
smaShortClose := 8
smaLongEntry := 5
rsiLength := 40
overbought := 50
oversold := 30

if (str.contains(syminfo.tickerid, 'GMX'))
loss_threshold := 12
profit_threshold := 12
loss_threshold_short := 15
profit_threshold_short := 5
baseTimeframe := 160
wtChannelLen := 11
wtAverageLen := 31
wtMALen := 5
wtChannelLenShort := 5
wtAverageLenShort := 15
wtMALenShort := 5
smaShortEntry := 21
smaShortClose := 38
smaLongEntry := 8
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'DEFI'))
loss_threshold := 15
profit_threshold := 12
loss_threshold_short := 12
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 10
wtAverageLen := 16
wtMALen := 33
wtChannelLenShort := 11
wtAverageLenShort := 9
wtMALenShort := 5
smaShortEntry := 39
smaShortClose := 9
smaLongEntry := 8
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'IOTX'))
loss_threshold := 95
profit_threshold := 45
loss_threshold_short := 12
profit_threshold_short := 5
baseTimeframe := 180
wtChannelLen := 19
wtAverageLen := 11
wtMALen := 5
wtChannelLenShort := 14
wtAverageLenShort := 13
wtMALenShort := 5
smaShortEntry := 21
smaShortClose := 17
smaLongEntry := 7
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'TLM'))
loss_threshold := 15
profit_threshold := 55
loss_threshold_short := 35
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 11
wtAverageLen := 19
wtMALen := 5
wtChannelLenShort := 40
wtAverageLenShort := 13
wtMALenShort := 22
smaShortEntry := 37
smaShortClose := 21
smaLongEntry := 7
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'NMR'))
loss_threshold := 100
profit_threshold := 12
loss_threshold_short := 12
profit_threshold_short := 12
baseTimeframe := 120
wtChannelLen := 11
wtAverageLen := 29
wtMALen := 9
wtChannelLenShort := 14
wtAverageLenShort := 36
wtMALenShort := 5
smaShortEntry := 21
smaShortClose := 25
smaLongEntry := 7
rsiLength := 17
overbought := 50
oversold := 110

if (str.contains(syminfo.tickerid, 'COMBO'))
loss_threshold := 12
profit_threshold := 20
loss_threshold_short := 12
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 39
wtAverageLen := 22
wtMALen := 5
wtChannelLenShort := 16
wtAverageLenShort := 28
wtMALenShort := 5
smaShortEntry := 35
smaShortClose := 7
smaLongEntry := 7
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'DODOX'))
loss_threshold := 12
profit_threshold := 100
loss_threshold_short := 12
profit_threshold_short := 5
baseTimeframe := 160
wtChannelLen := 11
wtAverageLen := 13
wtMALen := 5
wtChannelLenShort := 11
wtAverageLenShort := 13
wtMALenShort := 5
smaShortEntry := 33
smaShortClose := 5
smaLongEntry := 7
rsiLength := 10
overbought := 70
oversold := 30

if (str.contains(syminfo.tickerid, 'AUCTION'))
loss_threshold := 14
profit_threshold := 45
loss_threshold_short := 14
profit_threshold_short := 12
baseTimeframe := 180
wtChannelLen := 17
wtAverageLen := 13
wtMALen := 5
wtChannelLenShort := 11
wtAverageLenShort := 38
wtMALenShort := 13
smaShortEntry := 22
smaShortClose := 48
smaLongEntry := 8
rsiLength := 10
overbought := 55
oversold := 30

if (str.contains(syminfo.tickerid, 'NTRN'))
loss_threshold := 12
profit_threshold := 5
loss_threshold_short := 12
profit_threshold_short := 12
baseTimeframe := 100
wtChannelLen := 32
wtAverageLen := 31
wtMALen := 5
wtChannelLenShort := 14
wtAverageLenShort := 27
wtMALenShort := 5
smaShortEntry := 10
smaShortClose := 38
smaLongEntry := 7
rsiLength := 10
overbought := 5
oversold := 30

if (str.contains(syminfo.tickerid, 'GLMU'))
loss_threshold := 89
profit_threshold := 12
loss_threshold_short := 8
profit_threshold_short := 12
baseTimeframe := 102
wtChannelLen := 17
wtAverageLen := 23
wtMALen := 11
wtChannelLenShort := 7
wtAverageLenShort := 11
wtMALenShort := 8
smaShortEntry := 28
smaShortClose := 5
smaLongEntry := 14
rsiLength := 10
overbought := 55
oversold := 30
if (str.contains(syminfo.tickerid, 'GLMR'))
loss_threshold := 89
profit_threshold := 12
loss_threshold_short := 12
profit_threshold_short := 12
baseTimeframe := 171
wtChannelLen := 25
wtAverageLen := 49
wtMALen := 60
wtChannelLenShort := 10
wtAverageLenShort := 5
wtMALenShort := 5
smaShortEntry := 19
smaShortClose := 22
smaLongEntry := 7
rsiLength := 8
overbought := 55
oversold := 45

if (str.contains(syminfo.tickerid, 'ILV'))
loss_threshold := 29
profit_threshold := 12
loss_threshold_short := 11
profit_threshold_short := 12
baseTimeframe := 186
wtChannelLen := 11
wtAverageLen := 23
wtMALen := 9
wtChannelLenShort := 40
wtAverageLenShort := 8
wtMALenShort := 5
smaShortEntry := 5
smaShortClose := 33
smaLongEntry := 10
rsiLength := 5
overbought := 55
oversold := 0

if (user_defined_loss_threshold != 12)
loss_threshold := user_defined_loss_threshold

if (user_defined_profit_threshold != 12)
profit_threshold := user_defined_profit_threshold

if (user_defined_loss_threshold_short != 12)
loss_threshold_short := user_defined_loss_threshold_short

if (user_defined_profit_threshold_short != 12)
profit_threshold_short := user_defined_profit_threshold_short

if (user_defined_baseTimeframe != 180)
baseTimeframe := user_defined_baseTimeframe

if (user_defined_wtChannelLen != 11)
wtChannelLen := user_defined_wtChannelLen

if (user_defined_wtAverageLen != 13)
wtAverageLen := user_defined_wtAverageLen
if (user_defined_wtChannelLenShort != 11)
wtChannelLenShort := user_defined_wtChannelLenShort

if (user_defined_wtAverageLenShort != 13)
wtAverageLenShort := user_defined_wtAverageLenShort

if (user_defined_wtMALen != 5)
wtMALen := user_defined_wtMALen

if (user_defined_wtMALenShort != 5)
wtMALenShort := user_defined_wtMALenShort

if (user_defined_smaShortEntry != 21)
smaShortEntry := user_defined_smaShortEntry

if (user_defined_smaShortClose != 25)
smaShortClose := user_defined_smaShortClose

if (user_defined_smaLongEntry != 7)
smaLongEntry := user_defined_smaLongEntry

if (user_defined_rsiLength != 10)
rsiLength := user_defined_rsiLength

if (user_defined_overbought != 70)
overbought := user_defined_overbought

if (user_defined_oversold != 30)
oversold := user_defined_oversold

// Timeframe ajustments
loss_threshold := loss_threshold / 100
profit_threshold := profit_threshold / 100
loss_threshold_short := loss_threshold_short / 100
profit_threshold_short := profit_threshold_short / 100
wtChannelLen := wtChannelLen * baseTimeframe / timeframe.multiplier
wtAverageLen := wtAverageLen * baseTimeframe / timeframe.multiplier
wtMALen := wtMALen * baseTimeframe / timeframe.multiplier
wtChannelLenShort := wtChannelLenShort * baseTimeframe / timeframe.multiplier
wtAverageLenShort := wtAverageLenShort * baseTimeframe / timeframe.multiplier
wtMALenShort := wtMALenShort * baseTimeframe / timeframe.multiplier
smaShortEntry := smaShortEntry * baseTimeframe / timeframe.multiplier
smaShortClose := smaShortClose * baseTimeframe / timeframe.multiplier
smaLongEntry := smaLongEntry * baseTimeframe / timeframe.multiplier
rsiLength := rsiLength * baseTimeframe / timeframe.multiplier

f_wavetrend(chlen, avg, malen) =>


esa = ta.ema(close, chlen)
de = ta.ema(math.abs(close - esa), chlen)
ci = (close - esa) / (0.015 * de)
wt1 = ta.ema(ci, avg)
wt2 = ta.sma(wt1, malen)
wtCross = ta.cross(wt1, wt2)
wtCrossUp = wt2 - wt1 <= 0
wtCrossDown = wt2 - wt1 >= 0
[wt1, wt2, wtCross, wtCrossUp, wtCrossDown]

[wt1, wt2, wtCross, wtCrossUp, wtCrossDown] = f_wavetrend(wtChannelLen,


wtAverageLen, wtMALen)
[wt1Short, wt2Short, wtCrossShort, wtCrossUpShort, wtCrossDownShort] =
f_wavetrend(wtChannelLenShort, wtAverageLenShort, wtMALenShort)

signalColor = wt2 - wt1 > 0 ? color.red : color.lime


signalColorShort = wt1Short - wt2Short > 0 ? color.lime : color.red

plot(wt1, style = plot.style_line, title = 'WT Wave 1', color =


color.new(color.blue, 0), linewidth = 3)
plot(wt2, style = plot.style_line, title = 'WT Wave 2', color =
color.new(color.teal, 20), linewidth = 3)

plot(wt1Short, style = plot.style_line, title = 'WT Wave 1 short', color =


color.new(color.red, 0), linewidth = 3)
plot(wt2Short, style = plot.style_line, title = 'WT Wave 2 short', color =
color.new(color.orange, 20), linewidth = 3)

waveBuySignal = wtCross and wtCrossUp


waveSellSignal = wtCross and wtCrossDown

waveBuySignalShort = wtCrossShort and wtCrossDownShort


waveSellSignalShort = wtCrossShort and wtCrossUpShort

// RSI

smaSE = ta.sma(close, smaShortEntry)


smaLE = ta.sma(close, smaLongEntry)
smaSC = ta.sma(close, smaShortClose)

// RSI Filter
rsiValue = ta.rsi(close, rsiLength)

openShort = waveBuySignalShort and close < smaSE and wt1Short > -80 and rsiValue >
oversold
openLong = waveBuySignal and close > smaLE and wt1 < 80 and rsiValue < overbought
closeLong = waveSellSignal or (openShort and close > smaSC)
closeShort = waveSellSignalShort or (strategy.position_size < 0 and close > smaSC)

// Prevent double order on same transaction that could be recieved in reverse order
doubleOrderToLong = closeShort and openLong
doubleOrderToShort = closeLong and openShort

roi = strategy.position_size > 0 ? (strategy.position_avg_price - close) /


strategy.position_avg_price : strategy.position_size < 0 ? (close -
strategy.position_avg_price) / strategy.position_avg_price : 0.0

stopLoss = roi < 0 and math.abs(roi) >= loss_threshold


takeProfit = roi > 0 and math.abs(roi) >= profit_threshold

stopLossShort = roi < 0 and math.abs(roi) >= loss_threshold_short


takeProfitShort = roi > 0 and math.abs(roi) >= profit_threshold_short

if (closeLong or stopLoss or takeProfit or openShort)


strategy.close(id="Long", comment=doubleOrderToShort ? 'ignore' : '')

if (closeShort or stopLossShort or takeProfitShort or openLong)


strategy.close(id="Short", comment=doubleOrderToLong ? 'ignore' : '')
position_size = strategy.equity * leverage / close

if (openLong)
strategy.entry('Long', strategy.long, position_size)

if (openShort)
strategy.entry('Short', strategy.short, position_size)

barcolor=color.new(color.gray, 100)

if (strategy.position_size > 0)
barcolor := color.new(#064E3B, 80)

if (strategy.position_size < 0)
barcolor := color.new(#7F1D1D, 80)

bgcolor(barcolor)

You might also like