10点3.mq4 - 页 339 1...332333334335336337338339340341342343344345346...489 新评论 Wayne Ovenstone 2008.01.28 15:12 #3381 pagebluk2007: 大家好,我是这个主题的新手。我在IBFX上使用10p3v002(感谢David)TF 30M,我打算用一个微型账户(250美元)进行回测。但它没有用0.01手交易,而是一直用0.1和0.3手交易。我在这里错过了什么吗? 利润本身是惊人的,但我认为用这些手数交易的风险太大。这是我的设置和详细声明。 Tia, Don. 外部int Magic = 772188。 extern double TakeProfit = 10; 外部双数 Lots = 0.01; extern double InitialStop = 160; 外置双倍跟踪止损 = 0; 最大交易量 = 10; 外部双倍乘数 = 3; 外部数据 Pips = 5; 外置 int OrderstoProtect = 4; 外部 bool Money_management = true; extern int AccountType = 2; //0: 标准账户(NorthFinance,MiG,Alpari) 1: 普通账户(FXLQ,FXDD) 2: InterbankFX的NANO账户 extern double risk = 0.5; 外部 bool ReverseSignal = false; extern int Fast_EMA = 12; extern int Slow_EMA = 26; extern int Signal_SMA = 9; extern int Shift = 1; extern int TradingRange = 0; 外部 bool UseTimeFilter=true; extern int StopTrade = 13; 外部int StartTrade = 18; 有没有可能你在设置MQ4的时候忘记了选择迷你账户? 如果你忘了,只需右击 "账户",选择新的,并确保你将账户类型改为迷你账户。 如果是这个问题的话,一切都会好起来的。 谢谢 韦恩 Bob Davids 2008.01.28 15:18 #3382 MANSTIR: 感谢David的及时回复...我在获利上设置了 "0",因为我希望我的追踪止损能够完成获利的工作。 当EA买入时,修改止损(追踪止损)是xtream好的,而不是卖出/卖空(问题就在这里--卖出/卖空没有修改止损的动作!)为什么,我不知道... 10points3比我想象的要大得多...... 这个EA的效果很好,我已经开始测试,以确保其良好的....。 再次出现问题,当EA卖出时,没有修改止损!我想知道为什么...... 我花了很多时间来解决这个问题,但最终还是失败了。 我是否需要将BID改为ASK以使其不同......如果是,我就不说了,但没有行动。 这是我做的回测,没有改变任何东西。该代码工作正常。 谢谢 大卫 附加的文件: trailing.jpg 27 kb 003-trail.gif 7 kb 003-trail.htm 333 kb Bob Davids 2008.01.28 15:34 #3383 只是再快速提醒一下所有的交易者。IBFX的真实账户持有人请注意。谨慎阅读!!IBFX标准账户有1:100的杠杆。如果你决定用10p3v0系列交易,请记住将你的风险降低到NANO账户的一半。因为通常NANO账户有1:200的杠杆。如果你能让LiveChat的工作人员帮助你把标准账户改为1:200,那么对你来说就可以用你的NANO账户的相同设置来运行。希望这有帮助。 谢谢 大卫 MANSTIR 2008.01.29 00:13 #3384 davidke20: 这是我做的回测,没有改变任何东西。该代码工作正常。意见 大卫 嗯,你现在使用的是什么版本,大卫,我使用的是10point4版本。 你能在这里分享你的设置吗? MANSTIR 2008.01.29 00:17 #3385 davidke20: 我的NANO和普通账户都没有问题,请检查我的设置是否与你的一致。不知道你为什么会有这样的问题。关于 邓小平 谢谢你,大卫。 也许我使用的是10point4版本,你现在使用的是什么版本......你能在这里分享一下你的设置吗? Bob Davids 2008.01.29 01:56 #3386 MANSTIR: 谢谢你,大卫,也许我使用的是10point4版本,你现在使用的是什么版本......你能在这里分享你的设置吗? 0.03版。你可以在早期的30X页面(不记得是306还是309)找到它们,请做一些阅读。设置在回测报告中。当你想测试账户余额 低于1000时,请确保你是在NANO条件下测试(即欧元兑美元后面有一个 "m"--EURUSDm)。 谢谢 大卫 p/s: 10poin4不是由我制作的。如果你真的需要在你提到的那个特定版本上获得正确的东西,请找另一个编码员来帮助你。 pagebluk2007 2008.01.29 01:58 #3387 KaMpeR: 有没有可能是你在设置MQ4时忘记选择迷你账户? 如果你忘了,只需右击 "账户",选择新的,并确保你将账户类型改为迷你账户。如果是这个问题的话,一切都应该是好的? 欢呼声 韦恩 你是对的,我犯了一个愚蠢的小错误。谢谢你,韦恩。 Wayne Ovenstone 2008.01.29 02:17 #3388 pagebluk2007: 你是对的,我犯了一个愚蠢的小错误。谢谢你,韦恩。 没问题,很高兴能帮上忙,我们都是人,错误是不可避免的。) 干杯 韦恩 MANSTIR 2008.01.29 04:06 #3389 davidke20: 0.03版。你可以在早期的30X页面(不记得是306还是309)找到它们,请做一些阅读。设置在回测报告中。当你想测试账户余额低于1000时,确保你是在NANO条件下测试的(也就是欧元兑美元后面有一个 "m"--EURUSDm)。疑问 大卫 p/s: 10poin4并不是我制作的。如果你真的需要在你提到的那个特定版本上把事情做对,请找另一个编码员来帮助你。 再次感谢......大卫先生 volcom11 2008.01.30 07:39 #3390 需要帮助的Ea 我是新来的,不知道如何开始新的主题或任何东西,所以我正在交易10points3,并试图找人放一个代码,我可以让它只在一天中的某些时间进行交易。我想让它在晚上7点停止交易,并在上午16点重新开始。如果有人能帮助,那将是非常棒的....。 extern double TakeProfit = 10; extern double Lots = 0.01; extern double InitialStop = 80; 外置双倍跟踪止损 = 0; 最大交易次数=7。 extern int Pips=5; 外置 int SecureProfit=0; extern int AccountProtection=0; extern int OrderstoProtect=0; extern int ReverseCondition=0; extern double EURUSDPipValue=10; 外置双倍GBPUSDPipValue=10。 外置双倍 USDCHFPipValue=10。 外置双倍 USDJPYPipValue=9.715; 外部数据 StartYear=2005。 extern int StartMonth=1; extern int EndYear=2005; extern int EndMonth=12; 外置int EndHour=22; extern int EndMinute=30; extern int mm=0; extern int risk=12; extern int AccountisNormal=0; int OpenOrders=0, cnt=0; int slippage=0; double sl=0, tp=0; double BuyPrice=0, SellPrice=0; 双重lotsi=0, mylotsi=0; int mode=0, myOrderType=0; bool ContinueOpening=True; double LastPrice=0; int PreviousOpenOrders=0; 双倍利润=0。 int LastTicket=0, LastType=0; double LastClosePrice=0, LastLots=0; 双重Pivot=0。 双重PipValue=0。 字符串 text="", text2=""。 //+------------------------------------------------------------------+ //|专家初始化函数| //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //|专家的去初始化功能| //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //|专家启动功能| //+------------------------------------------------------------------+ int start() { //---- 如果(AccountisNormal==1) { 如果(mm!=0) { lotsi=MathCeil(AccountBalance()*risk/10000); } 否则 { lotsi=Lots; } } else { //然后是迷你 if (mm!=0) { lotsi=MathCeil(AccountBalance()*risk/10000)/10; } else { lotsi=Lots; // then is mini 否则 { lotsi=Lots; } } 如果(lotsi>100){ lotsi=100; } OpenOrders=0。 for(cnt=0;cnt<OrdersTotal();cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)。 如果(OrderSymbol()==Symbol()) { OpenOrders++; } } /* 如果(OpenOrders<1) { 如果(TimeYear(CurTime())<StartYear) { return(0); } 如果 (TimeMonth(CurTime())<StartMonth) { return(0); } 如果(TimeYear(CurTime())>EndYear) { return(0); } 如果(TimeMonth(CurTime())>EndMonth ) { return(0); } */ 如果(Symbol()=="EURUSD") { PipValue=EURUSDPipValue; } 如果(Symbol()=="GBPUSD") { PipValue=GBPUSDPipValue; } 如果(Symbol()=="USDJPY") { PipValue=USDJPYPipValue; } 如果(符号()=="USDCHF") { PipValue=USDCHFPipValue; } 如果(PipValue==0) { PipValue=5; } 如果(PreviousOpenOrders>OpenOrders) { for(cnt=OrdersTotal();cnt>=0;cnt--) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)。 mode=OrderType()。 如果(OrderSymbol()==Symbol()) { 如果(mode==OP_BUY) { OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slipage,Blue); } 如果(模式==OP_SELL) { OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slipage,Red); } return(0); } } } PreviousOpenOrders=OpenOrders; 如果(OpenOrders>=MaxTrades) { ContinueOpening=False; } 否则 { ContinueOpening=True; } 如果(LastPrice==0) { for(cnt=0;cnt<OrdersTotal();cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); mode=OrderType()。 如果(OrderSymbol()==Symbol()) { LastPrice=OrderOpenPrice()。 如果(mode==OP_BUY) { myOrderType=2; } 如果(模式==OP_SELL) { myOrderType=1; } } } } 如果(OpenOrders<1) { myOrderType=3。 //如果(iMACD(14,26,9,MODE_MAIN,0)>0和iMACD(14,26,9,MODE_MAIN,0)>iMACD(14,26,9,MODE_MAIN,1)) 那么OrderType=2。 如果(iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,0)>iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,1) { myOrderType=2; } //如果(iMACD(14,26,9,MODE_MAIN,0)<0和iMACD(14,26,9,MODE_MAIN,0)<iMACD(14,26,9,MODE_MAIN,1)) 那么OrderType=1。 如果(iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,0)<iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,1) ) { myOrderType=1; } 如果(ReverseCondition==1) { 如果(myOrderType==1) { myOrderType=2; } else { 如果(myOrderType==2) { myOrderType=1; }} } } // 如果我们有开立的头寸,我们要处理它们 for(cnt=OrdersTotal();cnt>=0;cnt--) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); 如果(OrderSymbol() == Symbol() { 如果(OrderType()==OP_SELL) { 如果(TrailingStop>0){ 如果(OrderOpenPrice()-Ask>=(TrailingStop+Pips)*Point) { 如果(OrderStopLoss()>(Ask+Point*TrailingStop)) { OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderClosePrice()-TakeProfit*Point-TrailingStop*Point,800, Purple); 返回(0)。 } } } } 如果(OrderType()==OP_BUY) { 如果(TrailingStop>0){ 如果(Bid-OrderOpenPrice()>=(TrailingStop+Pips)*Point) { 如果(OrderStopLoss()<(Bid-Point*TrailingStop)) { OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderClosePrice()+TakeProfit*Point+TrailingStop*Point,800,Yellow) 。 返回(0)。 } } } } } } 利润=0。 LastTicket=0; LastType=0; LastClosePrice=0; LastLots=0。 for(cnt=0;cnt<OrdersTotal();cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)。 如果(OrderSymbol()==Symbol()) { LastTicket=OrderTicket()。 如果(OrderType()==OP_BUY){ LastType=OP_BUY; } 如果(OrderType()==OP_SELL) { LastType=OP_SELL; } LastClosePrice=OrderClosePrice()。 LastLots=OrderLots()。 如果(LastType==OP_BUY) { //Profit=Profit+(Ord(cnt,VAL_CLOSEPRICE)-Ord(cnt,VAL_OPENPRICE))*PipValue*Ord(cnt,VAL_LOTS)。 如果(OrderClosePrice()<OrderOpenPrice() { 利润=利润-(OrderOpenPrice()-OrderClosePrice())*OrderLots()/Point; } 如果(OrderClosePrice()>OrderOpenPrice()) { Profit=Profit+(OrderClosePrice()-OrderOpenPrice())*OrderLots()/Point; } } 如果(LastType==OP_SELL) { //Profit=Profit+(Ord(cnt,VAL_OPENPRICE)-Ord(cnt,VAL_CLOSEPRICE))*PipValue*Ord(cnt,VAL_LOTS) 。 如果(OrderClosePrice()>OrderOpenPrice() { 利润=利润-(OrderClosePrice()-OrderOpenPrice())*OrderLots()/Point; } 如果(OrderClosePrice()<OrderOpenPrice()) { Profit=Profit+(OrderOpenPrice()-OrderClosePrice())*OrderLots()/Point; } } //打印(Symbol,":",Profit,"," LastLots)。 } Profit=Profit*PipValue; text2="利润:$"+DoubleToStr(Profit,2)+" +/-" 。 如果(OpenOrders>=(MaxTrades-OrderstoProtect) && AccountProtection==1)。 { //Print(Symbol,":",Profit); 如果(Profit>=SecureProfit) { OrderClose(LastTicket,LastLots,LastClosePrice,slipage,Yellow); ContinueOpening=False; return(0); } } 如果(!IsTesting()) { if (myOrderType==3) { text="无条件开启交易"; } else { text=" "; } Comment("LastPrice=",LastPrice, "PreviousOpenOrders=",PreviousOpenOrders, "\nContinue Opening=",ContinueOpening, " OrderType=",myOrderType, "\n",text2, "\nLots=",lotsi, "\n",text); } 如果(myOrderType==1 && ContinueOpening) { 如果((Bid-LastPrice)>=Pips*Point || OpenOrders<1) { SellPrice=Bid。 LastPrice=0。 如果(TakeProfit==0) { tp=0; } 否则 { tp=SellPric-TakeProfit*Point; } 如果(InitialStop==0) { sl=0; } 否则 { sl=SellPrice+InitialStop*Point; } 如果(OpenOrders!=0) { mylotsi=lotsi; for(cnt=1;cnt<=OpenOrders;cnt++) { 如果(MaxTrades>12) { mylotsi=NormalizeDouble(mylotsi*3,3); } 否则 { mylotsi=NormalizeDouble(mylotsi*3,3); } } } else { mylotsi=lotsi; } if (mylotsi>100) { mylotsi=100; } OrderSend(Symbol(),OP_SELL,mylotsi,SellPrice,slipage,tp,NULL,0,0,Red)。 return(0); } } 如果(myOrderType==2 && ContinueOpening) { 如果((LastPric-Ask)>=Pips*Point || OpenOrders<1) { BuyPrice=Ask; LastPrice=0。 如果(TakeProfit==0) { tp=0; } 否则 { tp=BuyPrice+TakeProfit*Point; } 如果(InitialStop==0) { sl=0; } 否则 { sl=BuyPric-InitialStop*Point; } 如果(OpenOrders!=0) { mylotsi=lotsi; for(cnt=1;cnt<=OpenOrders;cnt++) { 如果(MaxTrades>12) { mylotsi=NormalizeDouble(mylotsi*3,3); } 否则 { mylotsi=NormalizeDouble(mylotsi*3,3); } } } else { mylotsi=lotsi; } if (mylotsi>100) { mylotsi=100; } OrderSend(Symbol(),OP_BUY,mylotsi,BuyPrice,slipage,tp,NULL,0,0,Blue)。 返回(0)。 } } //---- return(0); } //+------------------------------------------------------------------+ 向老师们请教一个关于编程的问题 Script is not fully 10points 3.mq4 1...332333334335336337338339340341342343344345346...489 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
大家好,我是这个主题的新手。
我在IBFX上使用10p3v002(感谢David)TF 30M,我打算用一个微型账户(250美元)进行回测。但它没有用0.01手交易,而是一直用0.1和0.3手交易。我在这里错过了什么吗?
利润本身是惊人的,但我认为用这些手数交易的风险太大。这是我的设置和详细声明。
Tia, Don.
外部int Magic = 772188。
extern double TakeProfit = 10;
外部双数 Lots = 0.01;
extern double InitialStop = 160;
外置双倍跟踪止损 = 0;
最大交易量 = 10;
外部双倍乘数 = 3;
外部数据 Pips = 5;
外置 int OrderstoProtect = 4;
外部 bool Money_management = true;
extern int AccountType = 2; //0: 标准账户(NorthFinance,MiG,Alpari) 1: 普通账户(FXLQ,FXDD) 2: InterbankFX的NANO账户
extern double risk = 0.5;
外部 bool ReverseSignal = false;
extern int Fast_EMA = 12;
extern int Slow_EMA = 26;
extern int Signal_SMA = 9;
extern int Shift = 1;
extern int TradingRange = 0;
外部 bool UseTimeFilter=true;
extern int StopTrade = 13;
外部int StartTrade = 18;有没有可能你在设置MQ4的时候忘记了选择迷你账户? 如果你忘了,只需右击 "账户",选择新的,并确保你将账户类型改为迷你账户。
如果是这个问题的话,一切都会好起来的。
谢谢
韦恩
感谢David的及时回复...
我在获利上设置了 "0",因为我希望我的追踪止损能够完成获利的工作。
当EA买入时,修改止损(追踪止损)是xtream好的,而不是卖出/卖空(问题就在这里--卖出/卖空没有修改止损的动作!)为什么,我不知道...
10points3比我想象的要大得多......
这个EA的效果很好,我已经开始测试,以确保其良好的....。
再次出现问题,当EA卖出时,没有修改止损!我想知道为什么......
我花了很多时间来解决这个问题,但最终还是失败了。
我是否需要将BID改为ASK以使其不同......如果是,我就不说了,但没有行动。这是我做的回测,没有改变任何东西。该代码工作正常。
谢谢
大卫
只是再快速提醒一下所有的交易者。IBFX的真实账户持有人请注意。谨慎阅读!!IBFX标准账户有1:100的杠杆。如果你决定用10p3v0系列交易,请记住将你的风险降低到NANO账户的一半。因为通常NANO账户有1:200的杠杆。如果你能让LiveChat的工作人员帮助你把标准账户改为1:200,那么对你来说就可以用你的NANO账户的相同设置来运行。希望这有帮助。
谢谢
大卫
这是我做的回测,没有改变任何东西。该代码工作正常。
意见
大卫嗯,你现在使用的是什么版本,大卫,我使用的是10point4版本。
你能在这里分享你的设置吗?
我的NANO和普通账户都没有问题,请检查我的设置是否与你的一致。不知道你为什么会有这样的问题。
关于
邓小平谢谢你,大卫。
也许我使用的是10point4版本,你现在使用的是什么版本......你能在这里分享一下你的设置吗?
谢谢你,大卫,也许我使用的是10point4版本,你现在使用的是什么版本......你能在这里分享你的设置吗?
0.03版。你可以在早期的30X页面(不记得是306还是309)找到它们,请做一些阅读。设置在回测报告中。当你想测试账户余额 低于1000时,请确保你是在NANO条件下测试(即欧元兑美元后面有一个 "m"--EURUSDm)。
谢谢
大卫
p/s: 10poin4不是由我制作的。如果你真的需要在你提到的那个特定版本上获得正确的东西,请找另一个编码员来帮助你。
有没有可能是你在设置MQ4时忘记选择迷你账户? 如果你忘了,只需右击 "账户",选择新的,并确保你将账户类型改为迷你账户。
如果是这个问题的话,一切都应该是好的?
欢呼声
韦恩你是对的,我犯了一个愚蠢的小错误。谢谢你,韦恩。
你是对的,我犯了一个愚蠢的小错误。谢谢你,韦恩。
没问题,很高兴能帮上忙,我们都是人,错误是不可避免的。)
干杯
韦恩
0.03版。你可以在早期的30X页面(不记得是306还是309)找到它们,请做一些阅读。设置在回测报告中。当你想测试账户余额低于1000时,确保你是在NANO条件下测试的(也就是欧元兑美元后面有一个 "m"--EURUSDm)。
疑问
大卫
p/s: 10poin4并不是我制作的。如果你真的需要在你提到的那个特定版本上把事情做对,请找另一个编码员来帮助你。再次感谢......大卫先生
需要帮助的Ea
我是新来的,不知道如何开始新的主题或任何东西,所以我正在交易10points3,并试图找人放一个代码,我可以让它只在一天中的某些时间进行交易。我想让它在晚上7点停止交易,并在上午16点重新开始。如果有人能帮助,那将是非常棒的....。
extern double TakeProfit = 10;
extern double Lots = 0.01;
extern double InitialStop = 80;
外置双倍跟踪止损 = 0;
最大交易次数=7。
extern int Pips=5;
外置 int SecureProfit=0;
extern int AccountProtection=0;
extern int OrderstoProtect=0;
extern int ReverseCondition=0;
extern double EURUSDPipValue=10;
外置双倍GBPUSDPipValue=10。
外置双倍 USDCHFPipValue=10。
外置双倍 USDJPYPipValue=9.715;
外部数据 StartYear=2005。
extern int StartMonth=1;
extern int EndYear=2005;
extern int EndMonth=12;
外置int EndHour=22;
extern int EndMinute=30;
extern int mm=0;
extern int risk=12;
extern int AccountisNormal=0;
int OpenOrders=0, cnt=0;
int slippage=0;
double sl=0, tp=0;
double BuyPrice=0, SellPrice=0;
双重lotsi=0, mylotsi=0;
int mode=0, myOrderType=0;
bool ContinueOpening=True;
double LastPrice=0;
int PreviousOpenOrders=0;
双倍利润=0。
int LastTicket=0, LastType=0;
double LastClosePrice=0, LastLots=0;
双重Pivot=0。
双重PipValue=0。
字符串 text="", text2=""。
//+------------------------------------------------------------------+
//|专家初始化函数|
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//|专家的去初始化功能|
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//|专家启动功能|
//+------------------------------------------------------------------+
int start()
{
//----
如果(AccountisNormal==1)
{
如果(mm!=0) { lotsi=MathCeil(AccountBalance()*risk/10000); }
否则 { lotsi=Lots; }
} else { //然后是迷你
if (mm!=0) { lotsi=MathCeil(AccountBalance()*risk/10000)/10; } else { lotsi=Lots; // then is mini
否则 { lotsi=Lots; }
}
如果(lotsi>100){ lotsi=100; }
OpenOrders=0。
for(cnt=0;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)。
如果(OrderSymbol()==Symbol())
{
OpenOrders++;
}
}
/*
如果(OpenOrders<1)
{
如果(TimeYear(CurTime())<StartYear) { return(0); }
如果 (TimeMonth(CurTime())<StartMonth) { return(0); }
如果(TimeYear(CurTime())>EndYear) { return(0); }
如果(TimeMonth(CurTime())>EndMonth ) { return(0); }
*/
如果(Symbol()=="EURUSD") { PipValue=EURUSDPipValue; }
如果(Symbol()=="GBPUSD") { PipValue=GBPUSDPipValue; }
如果(Symbol()=="USDJPY") { PipValue=USDJPYPipValue; }
如果(符号()=="USDCHF") { PipValue=USDCHFPipValue; }
如果(PipValue==0) { PipValue=5; }
如果(PreviousOpenOrders>OpenOrders)
{
for(cnt=OrdersTotal();cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)。
mode=OrderType()。
如果(OrderSymbol()==Symbol())
{
如果(mode==OP_BUY) { OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slipage,Blue); }
如果(模式==OP_SELL) { OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slipage,Red); }
return(0);
}
}
}
PreviousOpenOrders=OpenOrders;
如果(OpenOrders>=MaxTrades)
{
ContinueOpening=False;
} 否则 {
ContinueOpening=True;
}
如果(LastPrice==0)
{
for(cnt=0;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
mode=OrderType()。
如果(OrderSymbol()==Symbol())
{
LastPrice=OrderOpenPrice()。
如果(mode==OP_BUY) { myOrderType=2; }
如果(模式==OP_SELL) { myOrderType=1; }
}
}
}
如果(OpenOrders<1)
{
myOrderType=3。
//如果(iMACD(14,26,9,MODE_MAIN,0)>0和iMACD(14,26,9,MODE_MAIN,0)>iMACD(14,26,9,MODE_MAIN,1)) 那么OrderType=2。
如果(iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,0)>iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,1) { myOrderType=2; }
//如果(iMACD(14,26,9,MODE_MAIN,0)<0和iMACD(14,26,9,MODE_MAIN,0)<iMACD(14,26,9,MODE_MAIN,1)) 那么OrderType=1。
如果(iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,0)<iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,1) ) { myOrderType=1; }
如果(ReverseCondition==1)
{
如果(myOrderType==1) { myOrderType=2; }
else { 如果(myOrderType==2) { myOrderType=1; }}
}
}
// 如果我们有开立的头寸,我们要处理它们
for(cnt=OrdersTotal();cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
如果(OrderSymbol() == Symbol()
{
如果(OrderType()==OP_SELL)
{
如果(TrailingStop>0){
如果(OrderOpenPrice()-Ask>=(TrailingStop+Pips)*Point)
{
如果(OrderStopLoss()>(Ask+Point*TrailingStop))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderClosePrice()-TakeProfit*Point-TrailingStop*Point,800, Purple);
返回(0)。
}
}
}
}
如果(OrderType()==OP_BUY)
{
如果(TrailingStop>0){
如果(Bid-OrderOpenPrice()>=(TrailingStop+Pips)*Point)
{
如果(OrderStopLoss()<(Bid-Point*TrailingStop))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderClosePrice()+TakeProfit*Point+TrailingStop*Point,800,Yellow) 。
返回(0)。
}
}
}
}
}
}
利润=0。
LastTicket=0;
LastType=0;
LastClosePrice=0;
LastLots=0。
for(cnt=0;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)。
如果(OrderSymbol()==Symbol())
{
LastTicket=OrderTicket()。
如果(OrderType()==OP_BUY){ LastType=OP_BUY; }
如果(OrderType()==OP_SELL) { LastType=OP_SELL; }
LastClosePrice=OrderClosePrice()。
LastLots=OrderLots()。
如果(LastType==OP_BUY)
{
//Profit=Profit+(Ord(cnt,VAL_CLOSEPRICE)-Ord(cnt,VAL_OPENPRICE))*PipValue*Ord(cnt,VAL_LOTS)。
如果(OrderClosePrice()<OrderOpenPrice()
{ 利润=利润-(OrderOpenPrice()-OrderClosePrice())*OrderLots()/Point; }
如果(OrderClosePrice()>OrderOpenPrice())
{ Profit=Profit+(OrderClosePrice()-OrderOpenPrice())*OrderLots()/Point; }
}
如果(LastType==OP_SELL)
{
//Profit=Profit+(Ord(cnt,VAL_OPENPRICE)-Ord(cnt,VAL_CLOSEPRICE))*PipValue*Ord(cnt,VAL_LOTS) 。
如果(OrderClosePrice()>OrderOpenPrice()
{ 利润=利润-(OrderClosePrice()-OrderOpenPrice())*OrderLots()/Point; }
如果(OrderClosePrice()<OrderOpenPrice())
{ Profit=Profit+(OrderOpenPrice()-OrderClosePrice())*OrderLots()/Point; }
}
//打印(Symbol,":",Profit,"," LastLots)。
}
Profit=Profit*PipValue;
text2="利润:$"+DoubleToStr(Profit,2)+" +/-" 。
如果(OpenOrders>=(MaxTrades-OrderstoProtect) && AccountProtection==1)。
{
//Print(Symbol,":",Profit);
如果(Profit>=SecureProfit)
{
OrderClose(LastTicket,LastLots,LastClosePrice,slipage,Yellow);
ContinueOpening=False;
return(0);
}
}
如果(!IsTesting())
{
if (myOrderType==3) { text="无条件开启交易"; }
else { text=" "; }
Comment("LastPrice=",LastPrice, "PreviousOpenOrders=",PreviousOpenOrders, "\nContinue Opening=",ContinueOpening, " OrderType=",myOrderType, "\n",text2, "\nLots=",lotsi, "\n",text);
}
如果(myOrderType==1 && ContinueOpening)
{
如果((Bid-LastPrice)>=Pips*Point || OpenOrders<1)
{
SellPrice=Bid。
LastPrice=0。
如果(TakeProfit==0) { tp=0; }
否则 { tp=SellPric-TakeProfit*Point; }
如果(InitialStop==0) { sl=0; }
否则 { sl=SellPrice+InitialStop*Point; }
如果(OpenOrders!=0)
{
mylotsi=lotsi;
for(cnt=1;cnt<=OpenOrders;cnt++)
{
如果(MaxTrades>12) { mylotsi=NormalizeDouble(mylotsi*3,3); }
否则 { mylotsi=NormalizeDouble(mylotsi*3,3); }
}
} else { mylotsi=lotsi; }
if (mylotsi>100) { mylotsi=100; }
OrderSend(Symbol(),OP_SELL,mylotsi,SellPrice,slipage,tp,NULL,0,0,Red)。
return(0);
}
}
如果(myOrderType==2 && ContinueOpening)
{
如果((LastPric-Ask)>=Pips*Point || OpenOrders<1)
{
BuyPrice=Ask;
LastPrice=0。
如果(TakeProfit==0) { tp=0; }
否则 { tp=BuyPrice+TakeProfit*Point; }
如果(InitialStop==0) { sl=0; }
否则 { sl=BuyPric-InitialStop*Point; }
如果(OpenOrders!=0) {
mylotsi=lotsi;
for(cnt=1;cnt<=OpenOrders;cnt++)
{
如果(MaxTrades>12) { mylotsi=NormalizeDouble(mylotsi*3,3); }
否则 { mylotsi=NormalizeDouble(mylotsi*3,3); }
}
} else { mylotsi=lotsi; }
if (mylotsi>100) { mylotsi=100; }
OrderSend(Symbol(),OP_BUY,mylotsi,BuyPrice,slipage,tp,NULL,0,0,Blue)。
返回(0)。
}
}
//----
return(0);
}
//+------------------------------------------------------------------+