哪位大师把pine脚本源代码修改MT4

MQL4 스크립트 전환 Forex Stocks

명시

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

//@version=4
study("Gridimus Maximus", shorttitle = 'Gridimus Maximus', overlay = true)
step_By  = input('Steps by Pivot',                title = 'Type of Increment',
 options = ['Steps by Pivot', 'Steps by Percent', 'Steps by Price'])
stepNmb  = input(defval = 5,                      title = 'Number Of Steps',           minval = 0, maxval = 50)
towards  = input(defval = 'Top',                  title = 'Direction To Step Towards',
 options = ['Bottom', 'Top'])
startAt  = input(defval = 10000.00,               title = 'Starts From Price',         minval = 0)
fctr_By  = step_By == 'Steps by Percent' ? .01 : 1
stepAmt  = input(defval = 33.3,                   title = 'Steps By Percent Or Price', minval = 0) * fctr_By
pivotHi  = input(defval = high,                   title = 'Or Steps By Higher',                                  inline = 'pivots')
pivotLo  = input(defval = low,                    title = 'Lower',                                               inline = 'pivots')
pivotLn  = input(defval = 7,                      title = 'Pivot nBars To Left',       minval = 0,               inline = 'nBars')
pivotRn  = input(defval = 2,                      title = 'Right ',                    minval = 0,               inline = 'nBars')
resoltn  = input('',                              title = 'Use A Higher Timeframe',    type = input.resolution)
gridSty  = input(defval = 'Dotted',               title = 'Grid Lines Show As',
 options = ['Dashed', 'Dotted', 'Solid'],                                                                        inline = 'grid')
gridCol  = input(defval = color.new(#787b86, 0),  title = ' ',                         type = input.color,       inline = 'grid')
gridWid  = input(defval = 1,                      title = ' ',                         minval = 1,               inline = 'grid')
gridXtd  = input(defval = 'Both',                 title = 'Grid Lines Extend ',
 options = ['Both', 'Right'],                                                                                    inline = 'grid2')
lablSiz  = input(defval = 'Normal',               title = 'Grid Label Show As',
 options = ['Off', 'Auto', 'Tiny', 'Small', 'Normal', 'Large', 'Huge'],                                          inline = 'labl')
textCol  = input(defval = color.new(#000000, 0),  title = ' ',                         type = input.color,       inline = 'labl')
lablCol  = input(defval = color.new(#787b86, 0),  title = ' ',                         type = input.color,       inline = 'labl')

source(_src,_res)=>
    src = _res == timeframe.period ? _src : security(syminfo.tickerid, _res, _src)

offSet(_res, _n)=>
    ctf = _res == timeframe.period
    bar = time_close - time
    htf = ctf ? bar : security(syminfo.tickerid, _res, bar)
    off = ctf ? _n : round(htf / bar * _n)

hiPivot  = source(pivothigh(pivotHi, pivotLn, pivotRn), resoltn), hiValue  = not na(hiPivot)
loPivot  = source(pivotlow (pivotLo, pivotLn, pivotRn), resoltn), loValue  = not na(loPivot)

useAxis  = float(na)
useAxis :=
 step_By == 'Steps by Percent' or step_By == 'Steps by Price' ? startAt :
 hiValue ? hiPivot : loValue ? loPivot : nz(useAxis[1])

useSign  = towards == 'Bottom' ? -1 : 1

// === Queue function method adapted from PineCoders.com | LucF ===
f_qDq(_array, _val) =>
    array.push(_array, _val)
    _return = array.shift(_array)

f_lineNew(_y)=>
    setBack  =
     step_By != 'Steps by Pivot' ? 1       :
     resoltn == timeframe.period ? pivotRn : offSet(resoltn, pivotRn)
    line.new(bar_index - setBack, _y, bar_index, _y, xloc.bar_index,
     gridXtd == 'Both' ? extend.both : extend.right, gridCol, 
     gridSty == 'Dashed' ? line.style_dashed :
     gridSty == 'Dotted' ? line.style_dotted : 
     line.style_solid, gridWid)

f_labelNew(_y)=>
    hideLbl  = lablSiz == 'Off'
    sizeLbl  =
     lablSiz == 'Auto'  ? size.auto  : lablSiz == 'Tiny'   ? size.tiny   :
     lablSiz == 'Small' ? size.small : lablSiz == 'Normal' ? size.normal :
     lablSiz == 'Large' ? size.large : size.huge
    setBack  = resoltn == timeframe.period ? pivotRn : offSet(resoltn, pivotRn)
    if step_By != 'Steps by Pivot'
        label.new(time + (time_close - time), _y, tostring(_y), xloc.bar_time, yloc.price,
         hideLbl ? color(na) : lablCol, label.style_label_lower_left,
         hideLbl ? color(na) : textCol, sizeLbl, text.align_left)
    else if step_By == 'Steps by Pivot'
        label.new(bar_index - setBack, _y, tostring(_y), xloc.bar_index, yloc.price,
         hideLbl ? color(na) : lablCol, hiValue ? label.style_label_lower_left : label.style_label_upper_right,
         hideLbl ? color(na) : textCol, sizeLbl, text.align_left)    

var line[] gridLvl = array.new_line(stepNmb)
var label[] gridLbl = array.new_label(stepNmb)
stepLvl  = float(na)
if step_By != 'Steps by Pivot'
    for i = 0 to stepNmb - 1
        stepLvl :=
         i == 0 ? useAxis :
         step_By == 'Steps by Price'   ? useAxis + (useSign * i * stepAmt)   :
         step_By == 'Steps by Percent' ? stepLvl * (1 + (useSign * stepAmt)) : 
         useAxis // <- future additional static axis options may go here
        label.delete(f_qDq(gridLbl, f_labelNew(stepLvl)))
        line.delete(f_qDq(gridLvl, f_lineNew(stepLvl)))

else if step_By == 'Steps by Pivot' and change(useAxis) != 0
    label.delete(f_qDq(gridLbl, f_labelNew(useAxis)))
    line.delete(f_qDq(gridLvl, f_lineNew(useAxis)))

응답함

1
개발자 1
등급
(108)
프로젝트
126
35%
중재
6
0% / 67%
기한 초과
2
2%
무료
게재됨: 25 코드
2
개발자 2
등급
프로젝트
0
0%
중재
0
기한 초과
0
무료
3
개발자 3
등급
(2)
프로젝트
3
0%
중재
1
0% / 100%
기한 초과
2
67%
무료
4
개발자 4
등급
(252)
프로젝트
462
26%
중재
139
20% / 60%
기한 초과
100
22%
무료
비슷한 주문
还在死磕黄金单边多空,被来回扫止损? 这套黄金期现基差套利思路,完全不赌金价上涨或者下跌! 不管黄金暴涨还是暴跌,对你的仓位影响都会被对冲掉,你只赚【基差收敛回归】这一段利润! 同一个黄金标的,两个市场报价天然存在价差,一旦基差大幅偏离历史常态区间,机会就来了:一边低买、一边高卖,锁死金价波动风险,坐等价差收拢落袋。 📌 实盘案例直观展示: 开仓基差7.53,平仓基差5.37,每盎司抓到2.16美元价差。 合约精准等量配对对冲,毛利润17.28美金,扣完手续费后净落8.60美金。 重点:黄金大涨大跌,都不影响这笔利润来源! 📊 入场用Z值量化信号: Z>2 基差显著偏高|Z<-2 基差显著偏低 中间区间不进场,拒绝盲目开仓。 同时重点盯:换月窗口、交易时差、滑点、双边手续费、成交同步性。 ⚠️ 核心铁律: 必须双腿同步下单,严格配比仓位,杜绝单边敞口; 提前设好三套离场规则:价差回归止盈、价差走阔止损、时间到期强制平仓。
量化交易程序 500 - 1000 USD
🛡️ 第一模块:单笔订单微观风控(我提到的核心) 1. 启用单笔封控 (Hard Stop Loss) · 功能:开仓瞬间,系统强制挂好止损。我可以在面板输入“单笔最多亏损300美金”,EA会自动计算点位挂上止损,且我在图表上绝对无法手动撤销。 2. 强制保本 (Break-Even / Move to BE) · 功能:当订单浮盈达到设定值(比如盈利 200 美金或 20 个点)时,EA自动将止损线移动到我的开仓价。确保这笔单子最差也是平本出局,绝不会盈利变亏损。 3. 移动止损 (Trailing Stop) · 功能:行情顺着我的方向走,止损线自动跟着K线往上/往下推。比如金价每涨 1 美金,止损就上移 1 美金,帮我锁死已得的利润。 4. 分批平仓 (Partial Close) ·
分享一套经过长期参数打磨的均值回归网格+阶梯马丁加仓体系。 市面上绝大多数传统马丁采用指数倍投模式,一旦遭遇持续性单边,保证金回撤会呈几何放大,容错率极低。这套方案做了结构性优化:摒弃激进倍率加仓,采用自定义梯度手数序列,结合ATR波动率动态标定网格间隔,配套分层分批止盈、最大持仓上限、保证金风控阈值三重约束,目的是平缓浮亏曲线,拉长策略在震荡环境下的生存周期。 策略核心逻辑:依托品种价格的震荡回归属性,在合理波动区间内分层挂单捕捉价差利润;底仓先行,补仓按预设梯度递进,每一层订单独立设置止盈,达标即分批兑现收益,避免单子长期被套锁仓。 📊实盘运行记录: 账户自4月底正式实盘部署,无间断24小时跑实盘到至今。在这段时间的行情环境里,每日净值保持正向收益,回撤始终控制在预设风控红线以内,净值曲线稳步上行。 可观模,可测试,+V;naccy5201314 +Q;

프로젝트 정보

예산
30 - 200 USD