Hi Johan
You can use the following script to do something similar. This is just an example of creating "buy" and "sell" signals when the Relative Strength Index (RSI) breaches a certain level. Note that it is designed so that you can't have more than one consecutive "buy" or "sell" signal.
LC := REF(CLOSE,1);
RSI:SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100;
UpperLevel:70;
LowerLevel:30;
SELL:=CROSS(RSI,UpperLevel);
BUY:=CROSS(LowerLevel,RSI);
BarsSinceLastBuy:=REF(HHVBARS(BUY==1,100000),1);
BarsSinceLastSell:=REF(HHVBARS(SELL==1,100000),1);
CanSell:=IF(BarsSinceLastBuy>BarsSinceLastSell,0,1);
CanBuy:=IF(BarsSinceLastSell>BarsSinceLastBuy,0,1);
SELL2 := SELL * CanSell;
BUY2 := BUY * CanBuy;
DRAWTEXT(BUY2==1,RSI,'BUY',1),Label2,VCenter,Bottom;
DRAWTEXT(SELL2==1,RSI,'SELL',2),Label1,VCenter,Top;
This should give you the following output:

If you want to display the labels on the candlestick graph rather than on the indicator, then use the following script:
LC := REF(CLOSE,1);
RSI:=SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100;
UpperLevel:=70;
LowerLevel:=30;
SELL:=CROSS(RSI,UpperLevel);
BUY:=CROSS(LowerLevel,RSI);
BarsSinceLastBuy:=REF(HHVBARS(BUY==1,100000),1);
BarsSinceLastSell:=REF(HHVBARS(SELL==1,100000),1);
CanSell:=IF(BarsSinceLastBuy>BarsSinceLastSell,0,1);
CanBuy:=IF(BarsSinceLastSell>BarsSinceLastBuy,0,1);
SELL2 := SELL * CanSell;
BUY2 := BUY * CanBuy;
STOCK;
DRAWTEXT(BUY2==1,C,'BUY',1),Label2,VCenter,Bottom;
DRAWTEXT(SELL2==1,C,'SELL',2),Label1,VCenter,Top;
This should give you the following output:

Hope this helps!
Regards
Estuary Solutions
Edited by user Friday, December 9, 2011 7:01:38 PM(UTC)
| Reason: Not specified