PDA

View Full Version : 需要帮助Code Plz



阿提拉诺多琳
11-20-2009 06:49, 06:49 AM
你好

我有这个代码的问题

任何人都可以看看这个。

// ----------------------------------------------- -------------------
//|此MQL由Expert Advisor Builder |生成
//|
http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/|
//| |
//|任何情况下,作者均不对任何损害负责。 |
//|使用风险自负。 |
//| |
// -------------------请勿删除此标题--------------------

#define SIGNAL_NONE 0
#define SIGNAL_BUY 1
#define SIGNAL_SELL 2
#define SIGNAL_CLOSEBUY 3
#定义SIGNAL_CLOSESELL 4

#property版权Expert Advisor Builder
#property链接http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/

extern int MagicNumber = 0;
extern bool SignalMail = False;
extern bool EachTickMode = False;
extern double Lots = 1.0;
extern int Slippage = 3;
extern bool UseStopLoss = True;
extern int StopLoss = 300;
extern bool UseTakeProfit = True;
extern int TakeProfit = 600;
extern bool UseTrailingStop = True;
extern int TrailingStop = 300;

int BarCount;
int当前;
bool TickCheck = False;
// ----------------------------------------------- -------------------
//|专家初始化函数|
// ----------------------------------------------- -------------------
int init(){
BarCount =酒吧;

if(EachTickMode)Current = 0;其他电流= 1;

返回(0);
}
// ----------------------------------------------- -------------------
//|专家去初始化函数|
// ----------------------------------------------- -------------------
int deinit(){
返回(0);
}
// ----------------------------------------------- -------------------
//|专家启动功能|
// ----------------------------------------------- -------------------
int start(){
int Order = SIGNAL_NONE;
int Total,Ticket;
双StopLossLevel,TakeProfitLevel;



if(EachTickMode Bars!= BarCount)TickCheck = False;
Total = OrdersTotal();
Order = SIGNAL_NONE;

// ----------------------------------------------- -------------------
//|变量开始|
// ----------------------------------------------- -------------------

double Var1 = iIchimoku(NULL,0,9,26,52,MODE_CHIKOUSPAN,Current 0);
double Var2 = iIchimoku(NULL,0,9,26,52,MODE_TENKANSEN,Current 0);
double Var3 = iIchimoku(NULL,0,9,26,52,MODE_KIJUNSEN,Current 0);

双倍Buy1_1 = Var1;
double Buy1_2 = iClose(NULL,0,Current 21);
双倍Buy2_1 = Var2;
double Buy2_2 = Var3;

double Sell1_1 = Var1;
double Sell1_2 = iClose(NULL,0,Current 21);
double Sell2_1 = Var3;
double Sell2_2 = Var2;




// ----------------------------------------------- -------------------
//|变量结束|
// ----------------------------------------------- -------------------

//检查位置
布尔IsTrade = False;

for(int i = 0; i lt; Total; i ){
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()lt; = OP_SELL OrderSymbol()== Symbol()){
IsTrade = True;
if(OrderType()== OP_BUY){
//关

// ----------------------------------------------- -------------------
//|信号开始(退出购买)|
// ----------------------------------------------- -------------------



// ----------------------------------------------- -------------------
//|信号结束(退出购买)|
// ----------------------------------------------- -------------------

if(Order == SIGNAL_CLOSEBUY((EachTickMode!TickCheck)||(!EachTickMode(Bars!= BarCount)))){
OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,MediumSeaGreen);
如果(SignalMail)SendMail([Signal Alert],[ Symbol() ] DoubleToStr(Bid,Digits) Close Buy);
如果(!EachTickMode)BarCount = Bars;
IsTrade = False;
继续;
}
//追踪止损
if(UseTrailingStop TrailingStop> 0){
如果(Bid - OrderOpenPrice()> Point * TrailingStop){
if(OrderStopLoss()lt; Bid - Point * TrailingStop){
OrderModify(OrderTicket(),OrderOpenPrice(),Bid - Point * TrailingStop,OrderTakeProfit(),0,MediumSeaGreen);
如果(!EachTickMode)BarCount = Bars;
继续;
}
}
}
} else {
//关

// ----------------------------------------------- -------------------
//|信号开始(退出销售)|
// ----------------------------------------------- -------------------



// ----------------------------------------------- -------------------
//|信号结束(退出卖出)|
// ----------------------------------------------- -------------------

if(Order == SIGNAL_CLOSESELL((EachTickMode!TickCheck)||(!EachTickMode(Bars!= BarCount)))){
OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,DarkOrange);
如果(SignalMail)SendMail([Signal Alert],[ Symbol() ] DoubleToStr(Ask,Digits) Close Sell);
如果(!EachTickMode)BarCount = Bars;
IsTrade = False;
继续;
}
//追踪止损
if(UseTrailingStop TrailingStop> 0){
如果((OrderOpenPrice() - Ask)>(Point * TrailingStop)){
((OrderStopLoss()gt;(Ask Point * TrailingStop))||(OrderStopLoss()== 0)){
OrderModify(OrderTicket(),OrderOpenPrice(),Ask Point * TrailingStop,OrderTakeProfit(),0,DarkOrange);
如果(!EachTickMode)BarCount = Bars;
继续;
}
}
}
}
}
}

// ----------------------------------------------- -------------------
//|信号开始(输入)|
// ----------------------------------------------- -------------------

(Buy1_1 gt; Buy1_2 Buy2_1 == Buy2_2)Order = SIGNAL_BUY;

如果(Sell1_1 lt; Sell1_2 Sell2_1 gt; Sell2_2)Order = SIGNAL_SELL;


// ----------------------------------------------- -------------------
//|信号结束|
// ----------------------------------------------- -------------------

//购买
if(Order == SIGNAL_BUY((EachTickMode!TickCheck)||(!EachTickMode(Bars!= BarCount)))){
如果(!IsTrade){
//检查免费保证金
if(AccountFreeMargin()lt;(1000 * Lot)){
打印(我们没有钱,免费保证金=,AccountFreeMargin());
返回(0);
}

如果(UseStopLoss)StopLossLevel = Ask - StopLoss * Point;否则StopLossLevel = 0.0;
如果(UseTakeProfit)TakeProfitLevel = Ask TakeProfit * Point;否则TakeProfitLevel = 0.0;

Ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,StopLossLevel,TakeProfitLevel,Buy(# MagicNumber ),MagicNumber,0,DodgerBlue);
如果(Ticket> 0){
if(OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES)){
打印(购买订单打开:,OrderOpenPrice());
如果(SignalMail)SendMail([Signal Alert],[ Symbol() ] DoubleToStr(Ask,Digits) Open Buy);
} else {
打印(错误打开BUY订单:,GetLastError());
}
}
if(EachTickMode)TickCheck = True;
如果(!EachTickMode)BarCount = Bars;
返回(0);
}
}

//卖
if(Order == SIGNAL_SELL((EachTickMode!TickCheck)||(!EachTickMode(Bars!= BarCount)))){
如果(!IsTrade){
//检查免费保证金
if(AccountFreeMargin()lt;(1000 * Lot)){
打印(我们没有钱,免费保证金=,AccountFreeMargin());
返回(0);
}

如果(UseStopLoss)StopLossLevel = Bid StopLoss * Point;否则StopLossLevel = 0.0;
如果(UseTakeProfit)TakeProfitLevel = Bid - TakeProfit * Point;否则TakeProfitLevel = 0.0;

Ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,StopLossLevel,TakeProfitLevel,Sell(# MagicNumber ),MagicNumber,0,DeepPink);
如果(Ticket> 0){
if(OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES)){
打印(打开销售订单:,OrderOpenPrice());
如果(SignalMail)SendMail([Signal Alert],[ Symbol() ] DoubleToStr(Bid,Digits) Open Sell);
} else {
打印(打开SELL命令错误,GetLastError());
}
}
if(EachTickMode)TickCheck = True;
如果(!EachTickMode)BarCount = Bars;
返回(0);
}
}

如果(!EachTickMode)BarCount = Bars;

返回(0);
}
// ----------------------------------------------- -------------------

阿提拉诺多琳
08-29-2021 14:27, 02:27 PM
发现自己的问题eabuilder拼错chinkou