ฉันจะอธิบายเนื้อหาของการตรวจสอบซอร์สโค้ด MQL ที่ดำเนินการโดย Gogojan
เราหวังว่าคุณจะใช้เป็นรายการตรวจสอบเมื่อลงรายการ EA ของคุณ
ขั้นตอนการตรวจสอบ EA ทั้งหมดมีดังนี้
*โปรดทราบว่าการตรวจสอบนี้ไม่รับประกันผลลัพธ์ของ EA
ที่นี่ ฉันจะอธิบายเนื้อหาการตรวจสอบเฉพาะของซอร์สโค้ด (mq4)
[Example
extern int MagicNumber = 123456;
input int MAGIC = 123456;
extern
หรือ input
เพื่อยืนยัน)OrdersTotal
เพื่อยืนยัน)[Example.
//-------- entering a new position --------
// Count the number of positions
for(i=OrdersTotal()-1; i>=0; i--)
{
// Select orders (if an error occurs, break out of the loop)
if (OrderSelect( i, SELECT_BY_POS, MODE_TRADES ) == false)
{
Print("OrderSelect returned the error of ", GetLastError() );
break; }
}
// Order confirmation (if the currency pair does not match, return to the beginning of the for statement)
if (OrderSymbol() ! = Symbol()) continue; }
//Confirm magic number (if the magic number does not match, return to the top of the for statement)
if (OrderMagicNumber() ! = MagicNumber) continue; if (OrderMagicNumber() !
if (OrderType() == OP_BUY)
{
CountBuy = CountBuy + 1; }
}
if (OrderType() == OP_SELL)
{
CountSell = CountSell + 1; }
}
}
OrderSend
เพื่อยืนยัน)[Example
if (countbuy=0)
if(OrderModify(ticket,OrderOpenPrice(),sl,tp,0))
{
lastTime=now;
entry_cnt++;
}
[After modification
ticket=OrderSend(symbol,OP_BUY,Lots,Ask,Slippage,sl,tp,NULL,MagicNumber,0,Blue);
if(ticket>=0)
{
lastTime=now;
entry_cnt++;
}
[Example.
for( i=OrdersTotal()-1; i>=0; i-- ){
if( OrderSelect(i, SELECT_BY_POS) == true ){
if( OrderType() == OP_BUY && OrderMagicNumber() == Magic && OrderSymbol() == Symbol() ){
if( ! (OrderClose(OrderTicket(),OrderLots(),MarketInfo(Symbol(),MODE_BID),Slippage,Green)){
`ต่อไปนี้เป็น NG เนื่องจากตั๋ว ณ เวลาที่ชำระเงินเปลี่ยนรูปแบบ’
for( i=OrdersTotal()-1; i>=0; i-- ){
if( OrderSelect(i, SELECT_BY_POS) == true ){
if( OrderType() == OP_BUY && OrderMagicNumber() == Magic && OrderSymbol() == Symbol() ){
OrderTicketChange();.
if( ! (OrderClose(OrderTicket(),OrderLots(),MarketInfo(Symbol(),MODE_BID),Slippage,Green)){
void OrderTicketChange()
{
OrderSelect(3, SELECT_BY_POS); }
}
NG สำหรับการประมวลผลลูปไม่สิ้นสุด
[Example.
bool closePosition(int magic, int type = -1) //function to process settlement.
{
int result_count = 0; //number of attempts
int close_signal = 0; //0 means success, non-zero means failure
if(IsTradeAllowed() == true) {
for(int i = OrdersTotal() - 1; i >= 0; i--) {
if(OrderSelect(i, SELECT_BY_POS) == false) continue;
if(OrderSymbol() ! = Symbol() || OrderMagicNumber() ! = magic) continue; if(type >= 0 &&
if(type >= 0 && OrderType() ! = type) continue; if(OrderType() !
RefreshRates(); if(OrderClose(OrderType() !
if(OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage, ArrowColor[OrderType()]) == true) {
continue; //first close process (usually succeeds here)
}else{ //processing in case of settlement failure from here
result_count = 0; for(int j = 0; j = 0; j = 0; j = 0; j = 0
for(int j = 0; j 0){
result_count++; //increase the counter for the number of failures
Print("[OrderClose Error] : ", err, " ", ErrorDescription(err)); }
}
}
if(result_count == RETRY_COUNT) { //when the counter reaches the specified number of attempts
close_signal++; //signal settlement failure
}
}
}
}
if(close_signal == 0) return(true); //exit the function because of success
Alert("[OrderClose Error] : Close timeout. Check the experts log."); //Timeout error on failure
}
return(false); //Alert and exit the function.
}
NG ถ้าตัวแปรที่ใช้สำหรับเงื่อนไขการชำระถูกเริ่มต้นโดยการรีสตาร์ท
[Good example: Timeout handling is described.
while(true)
{
int hoge; //variable that becomes 1 when processing is successful
//**** where processing such as settlement***//
if(hoge) return(true);
// timeout processing
if (GetTickCount() - StartTime > 10 * 1000)
{
Alert("OrderSend timeout. Check the experts log."); { return(-1); }
return(-1); }
}
[Bad example: timeout processing is not described.
while(true)
{
int hoge; //variable that becomes 1 if processing is successful
//**** where processing such as settlement***//
if(hoge) return(true); }
}
[Other examples of loop escaping
// If the error is not resolved by retrying, escape the loop
if(err == ERR_INVALID_PRICE) break; }
if(err == ERR_INVALID_STOPS) break;
if(err == ERR_LONGS_NOT_ALLOWED) break; break
if(err == ERR_SHORTS_NOT_ALLOWED) break; if(err == ERR_SHORTS_NOT_ALLOWED) break;
if(err == ERR_NOT_ENOUGH_MONEY) break; break
if(err == ERR_TRADE_TOO_MANY_ORDERS) break; if(err == ERR_TRADE_TOO_MANY_ORDERS)
[NG Example: Specifying a brokerage firm (Gaitame)
int OnInit()
{
if(IsTradeAllowed() == false) {
Alert("Enable the setting 'Allow live trading' in the Expert Properties!"); }
}
if(StringFind(TerminalInfoString(TERMINAL_COMPANY), "Gaitame") == -1) return(INIT_FAILED); //If the brokerage is not "Gaitame", initialization will fail
magic_array[0] = Magic1;
bars1 = getBars(Magic1);
return(INIT_SUCCEEDED); }
}
http
)hst
, dll
เพื่อยืนยัน)GlobalVariableSet
, GlobalVariableGet
)Example: In the case of product ID 12345, product name GogoJungleEA
int ticket = OrderSend( ①, ②, ③, ④, ⑤, ⑥, ⑦, "12345:GogoJungle_EA", ⑨, ⑩, ⑪);
[Example
double Gda_280[30];
int G_digits_192=0;
double G_point_196=0.0;
int Gi_204;
double Gd_208;
double Gd_216; double
double Gd_224; double Gd_224;.
[Example
int 2516972921474835825095 ;
int 919926175214748358129332 ;
int OnInit()
{
158651616521474836452710 = 945331452214748360523750 (); int
1821361779214748361111350 ( 158651616521474836452710 );
[Example.
//#include
//#include
//int group_no = 11,group,a1=1; //group number 0:not used
//bool PC_Check = true; // true: do PC binding false: don't do it
//datetime PrevTime;
//string ServerURL0 = "http://reapseven.xsrv.jp/license";
//string ServerURL = "http://fxea.xsrv.jp/license"; //server URL
//string ServerURL2 = "http://fxea.xsrv.jp/license"; //string
//int stp=-1;
//#import "shell32.dll"
//int ShellExecuteW(int hWnd, int lpVerb, string lpFile, string lpParameters, string lpDirectory, int nCmdShow);
//#import
//string DataPath = TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL4\Libraries";
ถ้า 1: ORDER_FILLING_FOK *ค่าเริ่มต้น
สำหรับ 2: ORDER_FILLING_IOC
[Example
int FillingMode=(int)SymbolInfoInteger(_Symbol,SYMBOL_FILLING_MODE);
if(FillingMode == 2){
request.type_filling = ORDER_FILLING_IOC;
}
PositionsTotal
เพื่อยืนยัน)[Example
int pos = 0;.
int posTotal=PositionsTotal();
for( int posIndex=0; posIndex<posTotal; posIndex++ )
{
const ulong ticket=PositionGetTicket(posIndex);
if(PositionSelectByTicket(ticket) &&
PositionGetString(POSITION_SYMBOL)==_Symbol &&
PositionGetInteger(POSITION_MAGIC)==Magic_Number)
{
pos++; }
}
}
}
[Example
input int Magic_Number;
MqlTradeRequest request;
MqlTradeResult result;
request.action = TRADE_ACTION_DEAL;
request.magic = Magic_Number;
request.symbol = _Symbol;
request.volume = 0.1;
request.sl = stoploss;
request.tp = takeprofit;
request.position = 0;
OrderSend(request,result);
[Example
int posTotal=PositionsTotal();
for( int posIndex=0; posIndex<posTotal; posIndex++ )
{
const ulong ticket=PositionGetTicket(posIndex);
if(PositionSelectByTicket(ticket) &&
PositionGetString(POSITION_SYMBOL)==_Symbol &&
PositionGetInteger(POSITION_MAGIC)==Magic_Number)
{
MqlTradeRequest request request; MqlTradeResult result
MqlTradeResult result;
request.action = TRADE_ACTION_DEAL;
request.magic = Magic_Number;
request.symbol = _Symbol;
request.volume = 0.1;
request.sl = 0;
request.tp = 0;
request.position = ticket;
OrderSend(request,result);
}
}
}
Gogojan ดำเนินการตรวจสอบแหล่งที่มาข้างต้นสำหรับ EA ทั้งหมด
หากคุณมีปัญหาในการดำเนินงานหรือข้อมูลใหม่ โปรดแจ้งให้เราทราบ
เราจะอัปเดตรายการตรวจสอบเป็นครั้งคราวตามเนื้อหาที่รายงาน
เราหวังเป็นอย่างยิ่งว่าจะได้จัดแสดง EA ที่ยอดเยี่ยมของคุณ
検索結果がありません。 |
検索結果がありません。 |