需要帮助创建一个非常简单的EA - 页 3 1234567 新评论 Dua Yong Rew 2008.12.02 03:52 #21 //+------------------------------------------------------------------+ //| Stepper.mq4 | //| doshur | //| www.doshur.com | //+------------------------------------------------------------------+ #property copyright "doshur" #property link "www.doshur.com" extern int TakeProfit = 5; extern int Range = 20; extern int Risk = 2; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { return(0); } int deinit() { return(0); } int start() { //---- static bool ToTrade = false; static bool FirstTrade = true; double PrevLow = iLow(Symbol(), 0, 1); double PrevHigh = iHigh(Symbol(), 0, 1); double PrevRange = (PrevHigh - PrevLow) / Point; if(NewBar()) { if(FirstTrade == false) { if(PrevRange >= Range) ToTrade = true; else ToTrade = false; } else { FirstTrade = false; } } if(ToTrade) { if(COT(1) < 1) { if(Ask > PrevHigh) OrderSend(Symbol(), OP_BUY, MM(PrevRange, Risk), Ask, 3, PrevLow, Ask + TakeProfit * Point, "Stepper - BUY", 57390, 0, Blue); } if(COT(2) < 1) { if(Bid < PrevLow) OrderSend(Symbol(), OP_SELL, MM(PrevRange, Risk), Bid, 3, PrevHigh, Bid - TakeProfit * Point, "Stepper - SELL", 57391, 0, Red); } } //---- return(0); } //+------------------------------------------------------------------+ //---- Check Is New Bar bool NewBar() { static datetime PrevBar; if(PrevBar < Time[0]) { PrevBar = Time[0]; return(true); } else { return(false); } return(false); } //---- Check Open Trades int COT(int BS) { int Buys = 0, Sells = 0; for(int cnt_COT = 0; cnt_COT < OrdersTotal(); cnt_COT++) { OrderSelect(cnt_COT, SELECT_BY_POS, MODE_TRADES); if(OrderType() == OP_BUY && OrderSymbol() == Symbol()) Buys++; if(OrderType() == OP_SELL && OrderSymbol() == Symbol()) Sells++; } if(BS == 1) return(Buys); if(BS == 2) return(Sells); } //---- Money Management double MM(int SL, int RK) { double rLots = NormalizeDouble(AccountBalance() / 1000 * RK / SL, 1); // Risk ?% of balance if(rLots < 0.1) rLots = 0.1; return(rLots); } 已经实施了第一次运行以克服这个问题和其他一些问题 还没有测试代码 请测试并列出其他修正案 Need help creating a MQL4 Learning EA: Lucky [删除] 2008.12.02 06:27 #22 is there away where we can modify the stop loss to so 15 or 20 instead of the other end of the candle? Dua Yong Rew 2008.12.02 07:38 #23 crazfoto 2008.12.02 08:27是否有离开,我们可以修改止损到15或20,而不是蜡烛的另一端? 是的。这是有可能的。 [删除] 2008.12.02 14:41 #24 这个是2小时平均线的吗?还是30分钟的另一个版本? 如果是2小时平均线,它昨天没有执行任何交易。 Dua Yong Rew 2008.12.02 16:21 #25 crazfoto: 这是为2小时平均数准备的吗? 还是30分钟的另一个版本? 如果是2小时平均线,它昨天没有执行任何交易。 你是说我的代码? 它按照你的要求实施了30分钟。 [删除] 2008.12.02 16:27 #26 哦,我的错。我现在要测试一下。 非常感谢你对我的帮助。我在4小时图上玩了一下。我想如果我在4小时图上将止损点改为15或20点,结果会很好,也是我所习惯的。 [删除] 2008.12.02 16:29 #27 我看到很多人在离线图表上使用EA的时候都有问题。 [删除] 2008.12.02 16:49 #28 它只在1小时图上工作 [删除] 2008.12.02 17:16 #29 好的。它在30分钟的图表上工作,但每当有一个订单支付出去,它就会不断地输入一个订单。所以它没有等待30分钟的蜡烛形成后再输入新的订单。 Dua Yong Rew 2008.12.02 17:40 #30 oops. 我忘了在它进入后禁用。 让我修改一下代码 1234567 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
//+------------------------------------------------------------------+
//| Stepper.mq4 |
//| doshur |
//| www.doshur.com |
//+------------------------------------------------------------------+
#property copyright "doshur"
#property link "www.doshur.com"
extern int TakeProfit = 5;
extern int Range = 20;
extern int Risk = 2;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
int deinit()
{
return(0);
}
int start()
{
//----
static bool ToTrade = false;
static bool FirstTrade = true;
double PrevLow = iLow(Symbol(), 0, 1);
double PrevHigh = iHigh(Symbol(), 0, 1);
double PrevRange = (PrevHigh - PrevLow) / Point;
if(NewBar())
{
if(FirstTrade == false)
{
if(PrevRange >= Range)
ToTrade = true;
else
ToTrade = false;
}
else
{
FirstTrade = false;
}
}
if(ToTrade)
{
if(COT(1) < 1)
{
if(Ask > PrevHigh)
OrderSend(Symbol(), OP_BUY, MM(PrevRange, Risk), Ask, 3, PrevLow, Ask + TakeProfit * Point, "Stepper - BUY", 57390, 0, Blue);
}
if(COT(2) < 1)
{
if(Bid < PrevLow)
OrderSend(Symbol(), OP_SELL, MM(PrevRange, Risk), Bid, 3, PrevHigh, Bid - TakeProfit * Point, "Stepper - SELL", 57391, 0, Red);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
//---- Check Is New Bar
bool NewBar()
{
static datetime PrevBar;
if(PrevBar < Time[0])
{
PrevBar = Time[0];
return(true);
}
else
{
return(false);
}
return(false);
}
//---- Check Open Trades
int COT(int BS)
{
int Buys = 0, Sells = 0;
for(int cnt_COT = 0; cnt_COT < OrdersTotal(); cnt_COT++)
{
OrderSelect(cnt_COT, SELECT_BY_POS, MODE_TRADES);
if(OrderType() == OP_BUY && OrderSymbol() == Symbol()) Buys++;
if(OrderType() == OP_SELL && OrderSymbol() == Symbol()) Sells++;
}
if(BS == 1) return(Buys);
if(BS == 2) return(Sells);
}
//---- Money Management
double MM(int SL, int RK)
{
double rLots = NormalizeDouble(AccountBalance() / 1000 * RK / SL, 1); // Risk ?% of balance
if(rLots < 0.1) rLots = 0.1;
return(rLots);
}
已经实施了第一次运行以克服这个问题和其他一些问题
还没有测试代码
请测试并列出其他修正案
is there away where we can modify the stop loss to so 15 or 20 instead of the other end of the candle?
crazfoto 2008.12.02 08:27是否有离开,我们可以修改止损到15或20,而不是蜡烛的另一端?
是的。这是有可能的。
这个是2小时平均线的吗?还是30分钟的另一个版本?
如果是2小时平均线,它昨天没有执行任何交易。
这是为2小时平均数准备的吗? 还是30分钟的另一个版本?
如果是2小时平均线,它昨天没有执行任何交易。
你是说我的代码?
它按照你的要求实施了30分钟。
哦,我的错。我现在要测试一下。
非常感谢你对我的帮助。我在4小时图上玩了一下。我想如果我在4小时图上将止损点改为15或20点,结果会很好,也是我所习惯的。
oops.
我忘了在它进入后禁用。
让我修改一下代码