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

MQL5 专家 转化中

工作已完成

执行时间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
等级
(317)
项目
355
72%
仲裁
7
43% / 29%
逾期
20
6%
工作中
相似订单
Hello, I am a serious buyer interested in acquiring an existing, stable and profitable Expert Advisor (EA) specifically designed to: 👉 mainly (XAUUSD) or any other exchange rate This is a full purchase order. ⚠️ I'm not interested in creating a new EA from scratch. Only ready-to-use, proven systems with a real track record of performance. ✅ EA Requirements (Stringent) 📌 Symbol and Strategy ✔️ Trade Gold Only
Here is a professional, detailed requirements specification draft for your MQL5 freelance order based on your prompt: ​ Strategy Objective: Develop an automated Expert Advisor (EA) featuring a 1:3 Risk-to-Reward ratio optimized for a small starting budget. ​ Core Trading Logic: ​Execute automatic Buy and Sell trades using high-probability entry signals. ​Target a strict 90% theoretical win-rate structure through
i want to fix my gold martingale bot MT5. RSI 14 ENTRY 30 BUY 70 SELL Lot 0.02 0.04 0.07 TP 150 for all SL 90 30 30 once total daily profit is 200$ stop trading stop trading once 2 consecutives total losses stop trading if spread exceeded 30 and between hour 15 & 17 PM Move SL to breakeven point once the profit exceeded 50 from from breakeven thanks
MarketMind Breakout Pro XAUUSD H1 — Donchian Breakout EA Project type: Personal EA development and backtesting Platform: MetaTrader 5 Instrument: XAUUSD Timeframe: H1 Strategy: Donchian Channel breakout with EMA 200 Project overview This project evaluates a Donchian breakout trading strategy for XAUUSD on the H1 timeframe. The system uses channel-based breakout conditions and an EMA 200 trend filter. Historical
The purpose of this order is ONLY to test and implement my H1 POI (Point of Interest) identification logic correctly. I am not requesting the complete EA at this stage. I will provide the exact rules for identifying the H1 POI after selecting the developer. The developer must convert those rules into clear, deterministic MQL5 logic. Requirements: Analyze H1 candles according to the rules I provide. Identify and mark
Hello, I would like to create a trading robot based on the Moving Average indicator. Here are the technical specifications: 1. Indicator Settings: - Moving Average Period: 50 (Exponential - EMA). - Applied to: Close price. 2. Buy Signal (Long): - Enter a Buy order when the price crosses and closes above the 50 EMA. 3. Sell Signal (Short): - Enter a Sell order when the price crosses and closes below the 50 EMA. 4
Hello, I am looking for an MQL5 developer to create a simple custom Expert Advisor for MetaTrader 5 based on my manual trading strategy. Strategy requirements: Instrument: NASDAQ index (broker-dependent symbol, e.g. NAS100 or USTEC). Timeframe: M1 (1-minute chart). Trading session: 16:00–21:00 Slovenia local time, with daylight saving time handled correctly. Strategy: Bull Coach / Bear Coach price-action setup based
buy stop sell stop with multiple orders send trail file and performance chart to test.....Backtesting results and verified trading history, source code availability. Existing bots are welcome...fully automatic.. no martingale. note- i need expiry and account number in source code... fixed budget...don't bargain please...read well then confirm job please
Title: Fully Automatic MT5 Trading Bot (Expert Advisor) with Risk Management I want a fully automated trading robot (Expert Advisor) for MetaTrader 5, written in MQL5. The bot must automatically analyse market data, identify trading opportunities, execute BUY and SELL orders, manage open positions, and close trades according to predefined rules without requiring manual confirmation for each trade. Requirements
Hello. I have some custom chartbooks/studies that run on ACSIL C++ in Sierra Charts trading platform. I need them put into pinescript to be able to be used in trading view and look similar to the charts we are giving you. also need it to be able to work on ninja trader NinjaScript (C#)/java, and MQL4 and MQL5 for metatrader 4 and 5. You would have to assist with testing. Let me know if you can help with this task

项目信息

预算
60+ USD
截止日期
到 2 天