Hi,
you can do this with the valuewhen function.
So you write something like:
BuySetup = Cond1;
BuyStopLevel = ValueWhen(Cond1,High);
Buy = BarsSince(BuySetup)<=1 AND Cross(High,BuyStopLevel);
BuyPrice = Max(Open,BuyPrice);
- - - - - - - - - - - - - - - - - - - -
Best regards
Thomas
www.tradingbasis.com
support@xxxxxxxxxxxxxxxx
- - - - - - - - - - - - - - - - - - - -
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx
[mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of iascool
Sent: Tuesday, January 24, 2006 2:18 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Code help
In the following code I like to trigger the buy or sell when the
high/low of the signal bar is breached .I have made changes with
highestsince/lowestsince , but it donot work . Any suggestions please.
//
Cond1= WMA(C,4)>WMA(C,12) AND ADX(14)>20 AND PDI(14)>MDI(14)
AND Cross
(StochK(8,3),40) AND C>EMA(C,25) AND EMA(C,64)>MA(C,64);
Cond2= WMA(C,4)<WMA(C,12) AND ADX(14)>20 AND PDI(14)<MDI(14)
AND Cross
(60,StochK(8,3)) AND C<EMA(C,25) AND MA(C,64)>EMA(C,64);
Buy=HighestSince(Cond1,C,5); Sell=LowestSince(Cond2,C,5);
Filter =Buy OR Sell;
AddColumn( Buy, "Bullish", 1 );
AddColumn( Sell, "Bearish", 1 );
Regards
sai
------------------------ Yahoo! Groups Sponsor
--------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/