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

MQL5 Experts Convertir

Tâche terminée

Temps d'exécution 4 jours

Spécifications

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

Répondu

1
Développeur 1
Évaluation
(236)
Projets
265
64%
Arbitrage
6
17% / 33%
En retard
8
3%
Chargé
Commandes similaires
hi. I hv a strategy on tradingview need to convert to MT4/MT5 expert advisor for algo trading. would like to add some tradingview strategy setting to the EA(not included in my tradingview code): recalculate after order is filled, order size: xx% of equity
Hi, I would like the HARSI RSI indicator from TradingView (link below) converted to MT4: Heikin-Ashi RSI Oscillator on TradingView It appears that Mr. Tools from Forex Station has already created an MT4 version of this indicator. I've included the reference indicator here: !!rsi - heiken ashi averages smoothed (mtf + sw + alerts + arrows). I don't need the divergence settings in the indicator. I only need the
I need an expert to convert a TradeStation script over to pine please let me know if this is something you can do perfectly. I will be expecting your message. thanks
I need an expert to convert a TradeStation script over to pine please let me know if this is something you can do perfectly. I will be expecting your message. thanks
Hello, I have indicators for tradestation written in easylanguage and I need them in tradingview pinescript. So I need someone to convert these tradestation indicators to tradingview. Do you think you can help me with that
Dear Freelancers, I'm seeking a skilled MT4/MT5 developer to collaborate on a valuable trading indicator. Project Description: I'm looking to develop a powerful Elliott Wave indicator compatible with the MT4 and MT5 trading platforms. This indicator will be based on the highly successful [LuxAlgo] indicator currently available on TradingView. Key Features: In-indicator Alerts: The ability to receive pop-up
I am currently seeking a highly skilled developer for an important project. I need a professional developer to convert an Indicator to tradingview on MT4. If you are highly skilled and capable of handling this project, kindly reach out now
I HAVE A EX4 FILE,I NEED TO CONVERT THE EX5 FILE AS A EXPERT ADVISOR, I WANT SAME INPUT OF EX4. I ATTACHED MY EX4 FILE WITHHERE. PLS CONVERT THE SAME INPUT TO EX5. Thanks
Hello there, I'm looking for an experienced developer to convert a TradingView indicator script into an MT4 (MetaTrader 4) compatible format. The script, written in Pine Script version 5, includes custom indicators and graphical elements such as lines, boxes, and labels that we need to be accurately replicated in MT4. Check the attached file below
Hello Developers, I am currently seeking a highly skilled and experienced developer to assist with an important project. I requested the conversion of an existing TradingView code to MetaTrader 4 (MT4). The main objective is to convert a TradingView script to an exact MT4 equivalent. If you have the expertise and are interested in this project, please provide a quote and your estimated timeline for the conversion

Informations sur le projet

Budget
60+ USD
Pour le développeur
54 USD
Délais
à 2 jour(s)