# Conditional Order

#### wam1234

##### New member
Hi, I am trying to use a simple conditional order to see how it works but my order is never triggered.

I want my order to be triggered when the price crosses above the high of the previous bar.

So I simply entered: high is greater than high from 1 bar ago

But it's not working

What is the trick here?

#### Christian

##### New member
Def cond1=if high>high[1] then 1 else 0;
plot a= if cond1 then high else Double.NaN;
a.SetStyle(Curve.POINTS);

#### Christian

##### New member
input showBreakoutSignals = yes;
def cond1 = if high > high[1] then 1 else 0;

plot a = if cond1 then high else Double.NaN;
a.SetStyle(Curve.POINTS);

plot UpSignal = high crosses above high[1];

UpSignal.SetHiding(!showBreakoutSignals);
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

#### wam1234

##### New member
Yes! It's Working! Thank you so much Christian!!

As you seem to know what you are talking about... do you know if there is a way to use the function SELL_TO_CLOSE on the conditional orders?

I would like for example to buy 4 SPY following the rule you gave me

Def cond1=if high>high[1] then 1 else 0;
plot a= if cond1 then high else Double.NaN;

And then I would like to sell 2 if the price Go up 2%

And SELL_TO_CLOSE at the market if Low<Low [1]

Any idea how to write the SELL TO CLOSE in the conditional order? I couldn't find it anywhere.

#### wam1234

##### New member
Hi!

I would like to SELL_TO_CLOSE if the price go back to my EntryPrice + 0.01 cts.

Is there a way to write this in the order rules of the conditional Order?

#### wam1234

##### New member
Hi!

Is there a way to customize the quantity in the order rules of the conditional order?

#### Christian

##### New member
Try with this and tell me, you can modify any condition. In the case 1 condition is high>high[1] and entry is on the next open bar,4 is number of contracts.
I don't use thinkorswim and the most important this is NOT a complete trading system. A complete trading system must include stop, target, risk reward ratio,drawdown and the COMISSSSSSIONNNSSS !!!