Limit trades per cycle

 
Hello,

I have a structure that I summarize here and that, in this case, generates 3 sales on each tick once the first trade is made.
I need to program:
- That only 1 trade is performed in each cycle, and
- That only 3 trades are made, one for each if: Only one with comment "C", one with comment "D" and one with comment "E".

Can anyone help me?
#include <Trade/Trade.mqh>
CTrade trade;

int A = 1;
int B = 2;
int C = 3;
int D = 4;
int E = 5;
int F = 6;

void OnTick(){
   double bid = SymbolInfoDouble(_Symbol,SYMBOL_BID);

      if(PositionsTotal() == 0) trade.Sell(0.01,_Symbol,bid,0,0,"1ª");
      else {
      
            if(C < D) trade.Sell(0.01,_Symbol,bid,0,0,"C");
            
            if(D < E) trade.Sell(0.01,_Symbol,bid,0,0,"D");
 
            if(E < F) trade.Sell(0.01,_Symbol,bid,0,0,"E");
      }
}

Thanks in advance,
Juan 
 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
😥