0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

エラーが解決できなくこまっています。(超初心者)

Last updated at Posted at 2015-08-23

エラーの内容です。
== -operand expected
; - unexpected token
closePrice - constant expression required
{ - some operator expected
expression has no effect

4 errors 1 warning
下記内容になります。
場所はSELECT_BY_TICKETとでてくる下の行からです。
よろしくお願いしましす。

int doOrderSend(int type, double lots, double openPrice, int slippage, double stoploss, double closePrice, string comment, int magic, int &errCode) {

    openPrice = NormalizeDouble(openPrice, Digits);
    stoploss = NormalizeDouble(stoploss, Digits);
    closePrice = NormalizeDouble(closePrice, Digits);

    int starttime = GetTickCount();

    while(true) {

        if(GetTickCount() - starttime > WAIT_TIME * 1000) {
            Print("OrderSend timeout. Check the experts log.");
            return(false);
        }

        if(IsTradeAllowed() == true) {
            RefreshRates();
          //  int ticket = OrderSend(Symbol(), type, lots, openPrice, slippage, stoploss, closePrice, comment, magic, 0, ArrowColor[type]);
          //  if( ticket > 0) {
            
            int ticket = OrderSend(Symbol(), type, lots, openPrice, slippage, 0, 0, comment, magic, 0, ArrowColor[type]);
            if( ticket > 0) {
                             if(OrderSelect(ticket,SELECT_BY_TICKET)==true){
                                if(isBuyTrapG)==true{        //true kai
                                       clocePrice = openPrice + profitPipsG * pointPerPips; 
                    }else {                               //else =false uri
                           closePrice = openPrice - profitPipsG * pointPerPips;
                          }
                           closePrice = NormalizeDouble(closePrice, Digits);
                          if(OrderModify(OrderTicket(),OrderOpenPrice(),0,closePrice,0,WhiteSmoke)){}
                     }
                return(ticket);
            }

            errCode = GetLastError();
            Print("[OrderSendError] : ", errCode, " ", ErrorDescription(errCode));
            Print("price=",openPrice,": stop=",stoploss,": close=",closePrice);
            if(errCode == ERR_INVALID_PRICE || errCode == ERR_INVALID_STOPS) {
                break;
            }
        }
        Sleep(100);
    }
    return(-1);
}
bool initOrderTicketInfo(){

    // 対象通貨ペアの件数を取得
    int orderCount=0;
    for(int j=0; j < OrdersTotal(); j++) { 
        if(OrderSelect(j,SELECT_BY_POS,MODE_TRADES) == false) return(false);
        if(OrderSymbol() == Symbol()) {
            orderCount++;
        }
    }
    
    // 配列を初期化
    ArrayResize(ticketArray,orderCount);
    ArrayResize(magicArray,orderCount);
    orderCount=0;

    // 配列にセット
    for(j=0; j < OrdersTotal(); j++) { 
        if(OrderSelect(j,SELECT_BY_POS,MODE_TRADES) == false) return(false);
        if(OrderSymbol() == Symbol()) {
            ticketArray[orderCount] = OrderTicket();
            magicArray[orderCount] = OrderMagicNumber();
            orderCount++;
        }
    }
    
    return(true);
    
}
// 指定されたMAGIC注文があるかどうかをチェックする
//
int getOrderTicket(int magic){

    int orderCount = 0;
    int ticket = -1;
    for(int i=0; i < ArraySize(magicArray); i++) { 
        if(magic == magicArray[i]) {
            ticket = ticketArray[i];
            orderCount++;
        }
    }

    if(orderCount > 1){
        Print("order duplicate:MagicNumber=",magic,", orderCount=",orderCount);
    }
    
    return(ticket);
    }
0
1
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?