MT4在特定时间停止开仓
input int TakeProfit = 5; input double Lots = 0.01; input int MagicNumber = 12345; input bool Weekend_Stop = true; input int Stop_Day_Of_Week1 = 1; input int Stop_Day_Of_Week2…
MT4 连续上涨三根K线开仓
static int TicketNumber; int OnInit() { return (INIT_SUCCEEDED); } void OnDeinit(const int reason) { } void OnTick() { if (iOpen(Symbol(), 0, 1) < iClose(Symbol(), 0, 1) &a…
MT4 RSI 指标开仓平仓
static int TicketNumber; int OnInit() { return (INIT_SUCCEEDED); } void OnDeinit(const int reason) { } void OnTick() { if (OrdersTotal() == 0 && iRSI(Symbol(), 0, 14, …
MT4在特定时间开仓平仓
input double LOT = 0.01; input int SLIP = 1; input int MAGIC = 12345; static int TicketNumber; int OnInit() { return (INIT_SUCCEEDED); } void OnDeinit(const int reason) { } vo…
MT4 计算指标时的回调函数,到底该更新几根 bar 的计算
新版的 MT4 指标计算在 OnCalculate 函数中,每次 tick 数据变动,相当于刷新最后一根 bar 的 Close。这时只需要重新计算最后一根的 bar 上的数据。显然不希望在最后一根 bar 上不断更新收盘价时,均线缺不变化。 但是如果在 EA 中用 iCustom 来引用这根均线时,可以采用上一根已收盘的 bar 的来计算。 采用…
MT4的 prev_calculated 和IndicatorCounted() 有什么区别
在MT4中,prev_calculated 和 IndicatorCounted() 是两个与指标计算相关的函数,它们有一些区别。让我们来详细了解一下: 1. IndicatorCounted(): - IndicatorCounted() 是一个旧版 MQL4 内置函数,返回一个整数值。 - 它用于计算从启动指标到现在没有发生变化的柱的数量。 -…
Chatgpt 交易策略
顾比均线交叉 // 顾比均线金叉交易的EA示例 input double lotSize = 0.1; // 手数大小 input double riskPercentage = 1.0; // 风险百分比 input int shortTermPeriod = 15; // 短期均线周期 input int longTermPeriod = 50…
程序化止损的几种方式
1. Time-Based Stop Loss: This strategy considers time as a valuable factor. If the return on a stock within a certain time period falls below a predefined threshold, the syste…
一般程序化交易的模型
在回调中计算交易信号 处理已有持仓 根据信号下单,在信号出现时还要计算止损止盈。 止损:ATR/前一根K线的低点/前一个分形的低点/反向信号 止盈: 2*ATR/3*ATR/4*ATR/反向信号 //+------------------------------------------------------------------+ //| Ex…