Looking for an Expert to convert TTS EMA STC strategy to MT5

Работа завершена

Время выполнения 4 дня

Техническое задание

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Hiubris_Indicators

//@version=5
strategy(title = "TTS EMA STC Strategy", overlay = true, default_qty_value = 100, initial_capital=100000,default_qty_type=strategy.percent_of_equity, pyramiding=0, process_orders_on_close=true)

// TTS
Length     = input.int(21, minval=1, group=' Trend Trader')
Multiplier = input.float(3, minval=0.000001, group=' Trend Trader')

tts(Length, Multiplier) =>
    avgTR = ta.wma(ta.atr(1), Length)
    highestC = ta.highest(Length)
    lowestC = ta.lowest(Length)
    hiLimit = highestC[1] - avgTR[1] * Multiplier
    loLimit = lowestC[1] + avgTR[1] * Multiplier
    ret = 0.0
    poz = 0.0
    iff_1 = close < loLimit and close < hiLimit ? loLimit : nz(ret[1], close)
    ret := close > hiLimit and close > loLimit ? hiLimit : iff_1
    iff_2 = close < ret ? -1 : nz(poz[1], 0)
    poz := close > ret ? 1 : iff_2
    ret
    
TTS = tts(Length, Multiplier)
//barcolor(poz == -1 ? color.red : poz == 1 ? color.green : color.blue)
plot(TTS, color=color.new(color.blue, 0), title='Trend Trader Line')



// MA
ribbon_grp = "MA"
ma(source, length, type) =>
    type == "SMA" ? ta.sma(source, length) : 
     type == "EMA" ? ta.ema(source, length) :
     type == "SMMA (RMA)" ? ta.rma(source, length) : 
     type == "WMA" ? ta.wma(source, length) :
     type == "VWMA" ? ta.vwma(source, length) :
     na
    
ma1_type   = input.string("EMA"  , "MA"     , inline="MA #1", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group=ribbon_grp)
ma1_source = input.source(close  , ""     , inline="MA #1", group=ribbon_grp)
ma1_length = input.int   (200    , ""     , inline="MA #1", minval=1, group=ribbon_grp)
ma1 = ma(ma1_source, ma1_length, ma1_type)
plot(ma1, color = color.white, title="MA")


// STC
EEEEEE  = input(12, 'Length', group='STC')
BBBB    = input(26, 'FastLength', group='STC')
BBBBB   = input(50, 'SlowLength', group='STC')
max_stc_change = input(7, title="Max STC Slope Change")
min_stc_bars = input(2, title='Min STC Squeeze')

AAAA(BBB, BBBB, BBBBB) =>
    fastMA = ta.ema(BBB, BBBB)
    slowMA = ta.ema(BBB, BBBBB)
    AAAA = fastMA - slowMA
    AAAA

AAAAA(EEEEEE, BBBB, BBBBB) =>
    AAA = input(0.5)
    var CCCCC = 0.0
    var DDD = 0.0
    var DDDDDD = 0.0
    var EEEEE = 0.0
    BBBBBB = AAAA(close, BBBB, BBBBB)
    CCC = ta.lowest(BBBBBB, EEEEEE)
    CCCC = ta.highest(BBBBBB, EEEEEE) - CCC
    CCCCC := CCCC > 0 ? (BBBBBB - CCC) / CCCC * 100 : nz(CCCCC[1])
    DDD := na(DDD[1]) ? CCCCC : DDD[1] + AAA * (CCCCC - DDD[1])
    DDDD = ta.lowest(DDD, EEEEEE)
    DDDDD = ta.highest(DDD, EEEEEE) - DDDD
    DDDDDD := DDDDD > 0 ? (DDD - DDDD) / DDDDD * 100 : nz(DDDDDD[1])
    EEEEE := na(EEEEE[1]) ? DDDDDD : EEEEE[1] + AAA * (DDDDDD - EEEEE[1])
    EEEEE

stc = AAAAA(EEEEEE, BBBB, BBBBB)
mColor = stc > stc[1] ? color.new(color.green, 20) : color.new(color.red, 20)
//plot(stc, color=mColor, title='STC', linewidth=2)

check_all_prev(formula, length) =>
    check = false
    for i=0 to length-1
        check := check or formula[i]
    check


stc_change = math.abs(stc-stc[1])


// Trading Session
session = input.session("0000-0000", title="Trading Session (Exchange Timezone)")+":1234567"
t = time(timeframe.period, session)
trading_session_filter = na(t) ? 0 : 1


long  = close>TTS and TTS>ma1 and stc>stc[1] and stc[1]<stc[2] and stc[1]<1  and stc_change<=max_stc_change and check_all_prev(stc[1]<1 , min_stc_bars)[1] and trading_session_filter
short = close<TTS and TTS<ma1 and stc<stc[1] and stc[1]>stc[2] and stc[1]>99 and stc_change<=max_stc_change and check_all_prev(stc[1]>99, min_stc_bars)[1] and trading_session_filter


// Position Management Tools
pos = 0.0
pos:= long? 1 : short? -1 : pos[1]

longCond  = long  and (pos[1]!= 1 or na(pos[1]))
shortCond = short and (pos[1]!=-1 or na(pos[1]))


// EXIT FUNCTIONS //
i_sl    = input.float(80.0, title="Stop Loss (Ticks)", minval=0)
i_tp    = input.float(80.0, title="Take Profit (Ticks)", minval=0)
i_tsl   = input.float(40.0, title="Trailing Stop Loss (Ticks)", minval=0)
i_tsltp = input.float(40.0, title="Trailing SL Trigger"   , minval=0, step=0.1)


sl  = i_sl >0? i_sl *syminfo.mintick : 99999
tp  = i_tp >0? i_tp *syminfo.mintick : 99999
tsl = i_tsl>0? i_tsl*syminfo.mintick : 99999

long_entry  = ta.valuewhen(longCond , close, 0)
short_entry = ta.valuewhen(shortCond, close, 0)


// Inprofit
be_long  = ta.valuewhen(longCond , close + i_tsltp*syminfo.mintick, 0)
be_short = ta.valuewhen(shortCond, close - i_tsltp*syminfo.mintick, 0)
inprofit_long  = 0
inprofit_short = 0
inprofit_long  := pos==0 or longCond ? 0 : high>be_long [1]? 1 : inprofit_long[1]
inprofit_short := pos==0 or shortCond? 0 : low <be_short[1]? 1 : inprofit_short[1]


// Trailing Stop Loss
trail_long = 0.0, trail_short = 0.0
trail_long  := longCond? high : high>trail_long[1]? high : pos<1 ? 0  : trail_long[1]
trail_short := shortCond? low : low<trail_short[1]? low : pos>-1 ? 99999  : trail_short[1]
trail_long_final   = inprofit_long  ? trail_long  -tsl : 0
trail_short_final  = inprofit_short ? trail_short +tsl : 99999

// Simple Stop Loss + 2 Take Profits
sl_long0   = long_entry  - sl
sl_short0  = short_entry + sl

tp_long  = long_entry   + tp
tp_short = short_entry  - tp

sl_long  = math.max(sl_long0, trail_long_final)
sl_short = math.min(sl_short0, trail_short_final)

sl_long_entry  = ta.valuewhen(longCond , sl_long , 0)
sl_short_entry = ta.valuewhen(shortCond, sl_short, 0)


// Position Adjustment
long_sl  = low <sl_long[1]  and pos[1]==1
short_sl = high>sl_short[1] and pos[1]==-1

final_long_tp  = high>tp_long[1]  and pos[1]==1
final_short_tp = low <tp_short[1] and pos[1]==-1

if ((long_sl or final_long_tp) and not shortCond) or ((short_sl or final_short_tp) and not longCond)
    pos:=0
    
//  Strategy Backtest Limiting Algorithm
i_startTime = input.time(defval = timestamp("01 Sep 2002 13:30 +0000"), title = "Backtesting Start Time")
i_endTime   = input.time(defval = timestamp("30 Sep 2099 19:30 +0000"), title = "Backtesting End Time"  )
timeCond   = (time > i_startTime) and (time < i_endTime)



// RISK
risk_perc = input(1.0, title="Risk Percentage")/100
SL_valueL = ta.valuewhen(longCond , math.abs(close-sl_long ), 0)
SL_valueS = ta.valuewhen(shortCond, math.abs(close-sl_short), 0)

dollar_risk = (strategy.initial_capital + strategy.netprofit) * risk_perc

QTY_L = dollar_risk / SL_valueL 
QTY_S = dollar_risk / SL_valueS

equity = strategy.initial_capital + strategy.netprofit

if equity>0 and timeCond
    if longCond
        strategy.entry("long" , strategy.long , qty=QTY_L)
    if shortCond
        strategy.entry("short", strategy.short, qty=QTY_S)
    
    strategy.exit("SL/TP", from_entry = "long" , stop=sl_long , limit=tp_long )
    strategy.exit("SL/TP", from_entry = "short", stop=sl_short, limit=tp_short)





show_sltp = input(true, title="Show SL/TP Lines on Chart")
xtl=plot(show_sltp and pos== 1? tp_long  : na, color=color.green, style=plot.style_linebr, title="TP Long ")
xts=plot(show_sltp and pos==-1? tp_short : na, color=color.green, style=plot.style_linebr, title="TP Short")
xsl=plot(show_sltp and pos== 1? sl_long_entry  : na, color=color.red  , style=plot.style_linebr, title="SL Long ")
xss=plot(show_sltp and pos==-1? sl_short_entry : na, color=color.red  , style=plot.style_linebr, title="SL Short")
xel=plot(show_sltp and pos== 1?long_entry : na, color=color.blue , style=plot.style_linebr, title="E Long ")
xes=plot(show_sltp and pos==-1?short_entry: na, color=color.blue , style=plot.style_linebr, title="E Short")

fill(xel, xtl, color=color.new(color.green, 80))
fill(xel, xsl, color=color.new(color.red  , 80))

fill(xes, xts, color=color.new(color.green, 80))
fill(xes, xss, color=color.new(color.red  , 80))

plot(show_sltp and pos== 1 and i_tsl>0? sl_long  : na, color=color.red  , style=plot.style_linebr, title="Trailing SL Long ")
plot(show_sltp and pos==-1 and i_tsl>0? sl_short : na, color=color.red  , style=plot.style_linebr, title="Trailing SL Short")


alerts = input.string("PineConnector", title="Alerts Messages:", options=['PineConnector', 'Custom'], group='ALERT SELECTOR')

pc_id      = input.string(title="License ID",              defval="1236518421235", group='PineConnector Settings', tooltip="This is your PineConnector license ID")
pc_prefix  = input.string(title="MetaTrader Prefix",       defval="",              group='PineConnector Settings', tooltip="This is your broker's MetaTrader symbol prefix")
pc_suffix  = input.string(title="MetaTrader Suffix",       defval="",              group='PineConnector Settings', tooltip="This is your broker's MetaTrader symbol suffix")
pc_risk    = input.float(minval=0, maxval=100,  step=1, defval=1,                 group='PineConnector Settings', title="Risk %", tooltip="This is how much to risk per trade in Meta Trader")

var symbol = pc_prefix + syminfo.ticker + pc_suffix

pc_entry_alert(direction) =>
    pc_id + "," + direction + "," + symbol + "," + "sl=" + str.tostring(i_sl/10, '#') + ",tp=" + str.tostring(i_tp/10, '#') + ',trailtrig=' + str.tostring(i_tsltp/10, '#') +  ',traildist=' + str.tostring(i_tsl/10, '#') + ',trailstep=' + str.tostring(1) + ",risk=" + str.tostring(pc_risk) 

if alerts=='PineConnector'
    if longCond
        alert(pc_entry_alert('buy'), alert.freq_once_per_bar_close)
    if shortCond
        alert(pc_entry_alert('sell'), alert.freq_once_per_bar_close)



longCond_txt         = input("", title='Custom Alert Msg: LONG Entry' , group='Custom Alert Messages', inline='longCond_txt      ')
shortCond_txt        = input("", title='Custom Alert Msg: SHORT Entry', group='Custom Alert Messages', inline='shortCond_txt     ')

if alerts=='Custom'
    if longCond
        alert(longCond_txt, alert.freq_once_per_bar_close)
    if shortCond
        alert(shortCond_txt, alert.freq_once_per_bar_close)

Откликнулись

1
Разработчик 1
Оценка
(236)
Проекты
265
64%
Арбитраж
6
17% / 33%
Просрочено
8
3%
Загружен
Похожие заказы
I installed the E.A. into the Experts folder in MT4. When I double click on it nothing happens. When I right click and "attach to chart" nothing happens. The E.A. is not grayed out, it simply will not attach. Any help would be greatly Appreciated
I have an EA and want to add few new logic to fetch profit taking factors and other values from an external master data and use it in existing EA
Hello Every one, Good day, I want from someone professional to create an EA is working on Mt5, This EA is working by depend on some indicators, and all those indicators must be working on MACD window, not on the chart, for more details please read my attached pdf file carefully. Many Thanks
I'm looking for an expert MQL5 developer that can create an EA that's based on my price action trading strategy with no indicators. The EA must analyze trades based on my price action rules, enter trades based on my price action rules, manage trades based on my price action rules and exit trades based on my price action rules
hi hi there i have an strategy on tradingview and i want to automate it like metatrader EA so i want the strategy to open and close trade automaticlly on tradingview
We are looking for an experienced Expert Advisor Developer who can build a customized MT5 Expert Advisor for us. The Expert Advisor would use two built-in indicators as entry/exit signals and our own risk management strategy with customizable inputs. The goal is to create a reliable and efficient trading tool that can automate our trading process on the MT5 platform. Skills required: - Strong understanding of
I need stochastic div (hidden &regular ea) that should perform task in all tf's ..divergence is a repaint stly so i want to use it with candlestick flips .. so bet for it
Hello, I have an indicator from a friend and I'd like to replicate it on my own TradingView or MT5 platform. Could you assist me with that?. Here is the link
so basically I have an EA(mql5), AI script(python), flask server and socket server both on python. Now this is an experimental script as I am trying to learn. However the EA is not entering any trades. How much would it cost for you to troubleshoot this for me? Thank you in advance
NEW FUNCTION 50+ USD
La idea es la siguiente, sería un EA semi automático. Yo como trader opero en zonas. En adelante las vamos a denominar ``zonas calientes´´. El EA debe que necesito debe operar conforme a 4 zonas calientes que yo configure en el mismo. ¿Qué hará el EA en cada una de esas zonas calientes que yo he configurado? En cada una de estas zonas el EA debe realizar hedging (crear un rango en el cual el EA entrara en sell o en

Информация о проекте

Бюджет
60+ USD
Исполнителю
54 USD
Сроки выполнения
до 2 дн.