Holding Period as Exit with annother Condition

To understand the logic.
Here with sell = 0 and Test of Holdperiod

 
Buy = BuySignal;
Sell = 0  ;

How can I combine a condition for Sell with a Holding Period in for example

Sell = 0 or SellCondition;

The idea behind crossover
for example:

Buy :C > ma(c,10) and c > Ma(c,40);
Sell: 0 or  C < MA(c,40); // is this correct ? or .......
ApplyStop( stopTypeNBar, stopModeBars, 10, 1);

is this correct or how can I combine a condition with Holding Period Exit.
Thanks.

@Munichtrader Yes, you can have more than one type of exit. Your example has some syntax errors, but the concept is correct – you can have a regular stop and also an n-bar stop. AmiBroker also allows more than one ApplyStop in the same formula with different stop types.