超初心者です。エラーが解決出来なく困ってます。

フォーラム(掲示板)ルール
フォーラム(掲示板)ルールはこちら  ※コードを貼り付ける場合は [code][/code] で囲って下さい。詳しくはこちら
sydney

超初心者です。エラーが解決出来なく困ってます。

#1

投稿記事 by sydney » 10年前

エラーの内容です。
== -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);
}

アバター
みけCAT
記事: 6734
登録日時: 14年前
住所: 千葉県
連絡を取る:

Re: 超初心者です。エラーが解決出来なく困ってます。

#2

投稿記事 by みけCAT » 10年前

かっこの位置が違います。
× if(isBuyTrapG)==true
○ if(isBuyTrapG==true)
複雑な問題?マシンの性能を上げてOpenMPで殴ればいい!(死亡フラグ)

sydney

Re: 超初心者です。エラーが解決出来なく困ってます。

#3

投稿記事 by sydney » 10年前

ありがとうございます!一か所直しただけで全部のエラーが消えました!

閉鎖

“C言語何でも質問掲示板” へ戻る