(Crypto-Scalping) EXTREME Profit Strategy
(Crypto-Scalping) EXTREME Profit Strategy
// Входные параметры
res = input.timeframe('15', 'TIMEFRAME', group="NON REPAINT")
useRes = input(true, 'Use Alternate Signals')
intRes = input(10, 'Multiplier for Alernate Signals')
basisType = input.string('ALMA', 'MA Type: ', options=['TEMA', 'HullMA', 'ALMA'])
basisLen = input.int(50, 'MA Period', minval=1)
offsetSigma = input.int(5, 'Offset for LSMA / Sigma for ALMA', minval=0)
offsetALMA = input.float(2, 'Offset for ALMA', minval=0, step=0.01)
scolor = input(false, 'Show coloured Bars to indicate Trend?')
delayOffset = input.int(0, 'Delay Open/Close MA', minval=0, step=1, tooltip='Forces
Non-Repainting')
tradeType = input.string('BOTH', 'What trades should be taken : ', options=['LONG',
'SHORT', 'BOTH', 'NONE'])
h = input(false, 'Signals for Heikin Ashi Candles')
swing_length = input.int(10, 'Swing High/Low Length', group='Settings', minval=1,
maxval=50)
history_of_demand_to_keep = input.int(20, 'History To Keep', minval=5, maxval=50)
box_width = input.float(2.5, 'Supply/Demand Box Width', group='Settings', minval=1,
maxval=10, step=0.5)
show_zigzag = input.bool(false, 'Show Zig Zag', group='Visual Settings',
inline='1')
show_price_action_labels = input.bool(false, 'Show Price Action Labels',
group='Visual Settings', inline='2')
supply_color = input.color(#00000000, 'Supply', group='Visual Settings',
inline='3')
supply_outline_color = input.color(#00000000, 'Outline', group='Visual Settings',
inline='3')
demand_color = input.color(#00000000, 'Demand', group='Visual Settings',
inline='4')
demand_outline_color = input.color(#00000000, 'Outline', group='Visual Settings',
inline='4')
bos_label_color = input.color(#00000000, 'BOS Label', group='Visual Settings',
inline='5')
poi_label_color = input.color(#00000000, 'POI Label', group='Visual Settings',
inline='7')
poi_border_color = input.color(#00000000, 'POI border', group='Visual Settings',
inline='7')
swing_type_color = input.color(#00000000, 'Price Action Label', group='Visual
Settings', inline='8')
zigzag_color = input.color(#00000000, 'Zig Zag', group='Visual Settings',
inline='9')
// Функции
f_array_add_pop(array, new_value_to_add) =>
array.unshift(array, new_value_to_add)
array.pop(array)
f_extend_box_endpoint(box_array) =>
for i = 0 to array.size(box_array) - 1
box.set_right(array.get(box_array, i), bar_index + 100)
// Расчеты
stratRes = timeframe.ismonthly ? str.tostring(timeframe.multiplier * intRes,
'###M') :
timeframe.isweekly ? str.tostring(timeframe.multiplier * intRes, '###W')
:
timeframe.isdaily ? str.tostring(timeframe.multiplier * intRes,
'###D') :
timeframe.isintraday ? str.tostring(timeframe.multiplier * intRes,
'####') :
'60'
src = h ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period,
close, lookahead=barmerge.lookahead_off) : close
// Расчет ATR
atrValue = ta.atr(50)
// Расчет зигзагов
swing_high = ta.pivothigh(high, swing_length, swing_length)
swing_low = ta.pivotlow(low, swing_length, swing_length)
// Новый зигзаг
if not na(swing_high)
f_array_add_pop(swing_high_values, swing_high)
f_array_add_pop(swing_high_bns, bar_index[swing_length])
if show_price_action_labels
f_sh_sl_labels(swing_high_values, 1)
f_supply_demand(swing_high_values, swing_high_bns, current_supply_box,
current_supply_poi, 1, atrValue)
switch
leTrigger and condition[1] <= 0.0 => condition := 1.0
seTrigger and condition[1] >= 0.0 => condition := -1.0
tp3Long and condition[1] == 1.2 => condition := 1.3
tp3Short and condition[1] == -1.2 => condition := -1.3
tp2Long and condition[1] == 1.1 => condition := 1.2
tp2Short and condition[1] == -1.1 => condition := -1.2
tp1Long and condition[1] == 1.0 => condition := 1.1
tp1Short and condition[1] == -1.0 => condition := -1.1
f_cross(low, slLine, false) and condition[1] >= 1.0 => condition := 0.0
f_cross(high, slLine, true) and condition[1] <= -1.0 => condition := 0.0
leTrigger and condition[1] >= 1.0 => condition := 0.0
seTrigger and condition[1] <= -1.0 => condition := 0.0
longE = leTrigger and condition[1] <= 0.0 and condition == 1.0
shortE = seTrigger and condition[1] >= 0.0 and condition == -1.0
longX = leTrigger and condition[1] >= 1.0 and condition == 0.0
shortX = seTrigger and condition[1] <= -1.0 and condition == 0.0
longSL = f_cross(low, slLine, false) and condition[1] >= 1.0 and condition == 0.0
shortSL = f_cross(high, slLine, true) and condition[1] <= -1.0 and condition == 0.0
longTP3 = tp3Long and condition[1] == 1.2 and condition == 1.3
shortTP3 = tp3Short and condition[1] == -1.2 and condition == -1.3
longTP2 = tp2Long and condition[1] == 1.1 and condition == 1.2
shortTP2 = tp2Short and condition[1] == -1.1 and condition == -1.2
longTP1 = tp1Long and condition[1] == 1.0 and condition == 1.1
shortTP1 = tp1Short and condition[1] == -1.0 and condition == -1.1
// Стратегия
if (tradeType == 'LONG' or tradeType == 'BOTH') and longE
strategy.entry('Long', strategy.long)
strategy.exit('Long TP1', from_entry='Long', qty_percent=i_lxQtyTP1,
limit=tp1Line, stop=slLine)
strategy.exit('Long TP2', from_entry='Long', qty_percent=i_lxQtyTP2,
limit=tp2Line, stop=slLine)
strategy.exit('Long TP3', from_entry='Long', qty_percent=i_lxQtyTP3,
limit=tp3Line, stop=slLine)