other

murata mql5 複数EA PositionsTotalの工夫

// global 変数
int MagicT = 202555591;


// 関数
 int totalPositions(int num){
 
      int counter = 0;
      
      for(int k = 0; k < PositionsTotal(); k++){
      
        string name = PositionGetSymbol(k); // 不要?
        if(PositionGetInteger(POSITION_MAGIC) == num)counter++;
      
      }
 
   return counter;
 }

 // 書き換え
 // 各注文・決済に追加

      requestT.magic = MagicT;


 if(posT == 0 && TimeT[0] > LongEntryTimeT && (EntryCountT < EntryCountLimitT) && totalPositions(MagicT) == 0)


 この場合posTは不要か?
Was this helpful?