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

MQL5 Experts Converting

Job finished

Execution time 4 days

Specification

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

Responded

1
Developer 1
Rating
(250)
Projects
279
65%
Arbitration
6
17% / 33%
Overdue
10
4%
Working
Similar orders
Hello, I’m looking for an experienced coder to help with algorithm development. Specifically, I need assistance with converting a MetaTrader Expert Advisor (EA) into TradeLocker. Additionally, I would like to have a new EA built in TradeLocker that mirrors the logic of the original MetaTrader EA, including the specific rules and conditions I need. Please contact me only if you have prior experience converting scripts
Hi there, To assist with the development of an algorithm, I need a seasoned PineScript and MQL coder to convert an indicator from TradingView to MeTaTrader 4, then create an expert advisor (EA) with the same logic as the indicator and the features I want in the expert advisor (Rules & Conditions). Please only apply if you have experience converting scripts from TradingView to MQL. I also need to make sure that the
Hello, I need a coder to help with an algorithm development by converting METATRADER EA INTO TRADELOCKER then build an EA with the same logic of the METATRADER and in addition to the ideas I want in the expert advisor(Rules & Conditions) of exactly the features needed for implementation to have the expert advisor designing as my expected products, ONLY REACH OUT IF YOU HAVE BEEN CONVERTING SCRIPT FROM METATRADER TO
Hello, I need a seasoned PineScript and MQL coder to help with an algorithm development by converting an indicator on TradingView to MT4 then build an EA with the same logic of the indicator and in addition to the ideas I want in the expert advisor(Rules & Conditions) of exactly the features needed for implementation to have the expert advisor designing as my expected products, ONLY REACH OUT IF YOU HAVE BEEN
I want like to convert my tradingview indicator to mt4 EA I use 3 MA MSB RSI The list of the 4 indicators are on TradingView, 1. Market Structure Break And Order block. By EmreKb 2. TMA - Divergence Indicator (V2) 3. Multiple MA (21,50,100) 4. SuperTrend
The goal is to develop a system that mirrors trade actions (Buy/Sell) from a CTrader demo account on Cronos Markets to multiple prop firm accounts on TradeLocker, ensuring accurate replication of trades while adjusting risk proportionally. I was wondering if you could help me with copy trading an EA’s action on Cronos markets (uses CTrader) into a prop firm account that I bought with TooOne Trader (uses TradeLocker
Hello! Since last coder never finished I need to post again, please only accept if you can deliver this conversion. I want to convert an existing open source indicator for tradingview to mql5. Its an orderblock indicator also showing horizontal bullish/bearish volume. My expectation of this is the following: The orderblocks will apear on the chart at exactly the same place with top/bottom etc. The bullish and bearish
hi, I have a strategy coded in Python on Jupiter but I have trouble converting it to Quantconnect. Could you do that? The strategy is based on trading with 10 most liquid crypto coins on Binance rebalanced each month and tracking when the price break 20 day high or low plus some other indicators
Hi there, I am offering $30 usd for someone to convert four pictures I have to metatrader icons(arrows) that I can use in both MT4 & MT5. We all know that we can change arrows on the chart by using a different arrow code, but the arrows in metatrader are boring and I want to use custom ones. I want the four attached pictures as icons that i can use with indicators that give the option to choose your arrow type. I
Trade Mirroring Solution 100 - 150 USD
Hey there! I was wondering if you could help me with copy trading an EA’s action on Cronos markets (uses CTrader) into a prop firm account that I bought with TooOne Trader (uses TradeLocker to execute trades). Actually, I have 3 prop firm accounts with them that I am trying to pass with this particular EA. 1) Each of these 3 accounts is $250,000 (different account numbers that cannot be combined. 2) I currently have

Project information

Budget
60+ USD
For the developer
54 USD
Deadline
to 2 day(s)