Если Вы хотите заказать советник или индикатор, то публикуйте в эту группу тех. задание. Если Ваш заказ не очень сложный, то велика вероятность, что Вам его смогут сделать даже бесплатно
Программистам MQL: подпишитесь на группу, чтобы получать уведомления о заказах.
Комментарии (2)
23 poker Автор Сообщений: 876
strategy('ALGOX v22-Supertrend OPT', overlay=true, pyramiding=0, default_qty_type=strategy.percent_of_equity, default_qty_value=50, initial_capital=5000, commission_type=strategy.commission.percent, commission_value=0.02, max_bars_back=500)
// === INPUTS ===
group_general = «General Settings»
allow_longs = input.bool(true, 'Allow Longs', group=group_general)
allow_shorts = input.bool(true, 'Allow Shorts', group=group_general)
series_count = input.int(20, «Series Count», group=group_general)
lot_step = input.float(0.01, «Lot Step», group=group_general)
show_stats = input.bool(true, «Show Statistics», group=group_general)
group_atr = «ATR/Trend Settings»
atr_period = input.int(55, 'ATR Period', group=group_atr)
atr_factor = input.float(3, 'ATR Factor', group=group_atr)
atr_grid_mult = input.float(1.0, «ATR Grid Multiplier», group=group_atr)
atr_tp_mult = input.float(5.0, «ATR TP Multiplier», group=group_atr)
// === HEIKIN-ASHI PRICES (single security call for all OHLC) ===
ha = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, [open, high, low, close])
// === ATR Calculation ===
atr = ta.atr(atr_period)
// === SuperTrend Calculation (simplified, non-repainting) ===
upper_band = ha[3] — atr_factor * atr
lower_band = ha[3] + atr_factor * atr
trend_up = na(trend_up[1])? upper_band: math.max(upper_band, trend_up[1])
trend_down = na(trend_down[1])? lower_band: math.min(lower_band, trend_down[1])
trend = ha[3] > trend_down[1]? 1: ha[3] < trend_up[1]? -1: nz(trend[1], 1)
trail = trend == 1? trend_up: trend_down
plot(trail, color=trend == 1? color.green: color.red, title=«SuperTrend Trail»)
// === Entry/Exit Signals ===
long_signal = trend == 1 and trend[1] == -1
short_signal = trend == -1 and trend[1] == 1
plotshape(long_signal, style=shape.triangleup, location=location.belowbar, color=color.lime, size=size.tiny, title=«Long Entry»)
plotshape(short_signal, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny, title=«Short Entry»)
// === ATR Grid and TP Levels ===
grid_step = atr * atr_grid_mult
tp_step = atr * atr_tp_mult
plot(ha[3] + grid_step, color=color.blue, title=«ATR Grid Up»)
plot(ha[3] — grid_step, color=color.orange, title=«ATR Grid Down»)
plot(ha[3] + tp_step, color=color.purple, title=«ATR TP Up»)
plot(ha[3] — tp_step, color=color.yellow, title=«ATR TP Down»)
// === Statistics (optional) ===
if show_stats
var table stats = table.new(position.bottom_right, 1, 1)
table.cell(stats, 0, 0, «Trend: » + str.tostring(trend) + "\nATR: " + str.tostring(atr, "#.##"), text_color=color.white, bgcolor=color.new(color.black, 80))
6 dok-45 Сообщений: 73
Зарегистрируйтесь или авторизуйтесь, чтобы оставить комментарий