PureBytes Links
Trading Reference Links
|
yes I do and actually provided it a couple of days ago
there are many ways to achieve the same thing, this is one
InTrade = flip(buy,sell);
then to reference anything you can just refer to InTrade
eg for the first buy signal and exclude the rest use
Intrade and ref(InTrade,-1)==0
so from your code
BuyPrice = ValueWhen( ExRemBuyReturn ==1 , Open )
becomes
BuyPrice = ValueWhen( Intrade and ref(InTrade,-1)==0, Open );
On 8/6/05, Peter <pa299@xxxxxxxxxxxxx> wrote:
> Hi Graham
> Thanks for your help!
> I'm trying to code a exit on the first profitable open and need in
> the situation where there is more than one buy signal before the
> sell, to still be able to reference the first buy bar and use a
> value of that bar in the sell signal.
>
> I've got this far but the problem is the line order. i.e. you
> really need the BuyPrice line prior to the sell line, however that
> doesn't remove any excess signals.?
>
> Is there a way to do this?
> Any help would be much appreciated.
> Thanks
> Peter
>
>
>
> Cond1 = Ref(C,1) > Ref(C,0);
> Cond2 = Ref(C,-2) > Ref(C,-1);
>
> Buy = Cond1 AND Cond2;
>
> Sell = Cross(Open,BuyPrice);
>
> ExRemBuyReturn = Buy = ExRem(Buy,Sell);
>
> BuyPrice = ValueWhen( ExRemBuyReturn ==1 , Open );
>
> Sell = ExRem( Sell, Buy );
> SellPrice = Ref(O,0);
>
> --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> > Hi Peter
> > I did a post a few months back which demonstrated that psoition of
> the
> > exrem statement makes a difference to what is the results. Here is
> the
> > code below, just use param to alter the exrem location.
> >
> > Another simple method is to create a variable that shows when you
> are
> > in or out of a trade
> > Intrade = flip(buy,sell);
> > this will have value of 1 when you are in a trade, 0 when out.
> > So to find the values (eg Close) when last sell use Valuewhen(
> > Intrade==0 and ref(intrade,-1), C );
> >
> >
> > GraphXSpace = 5;
> > Plot(C,"price",colorGrey50,styleBar); //CHANGE COLOUR TO SUIT
> > SetTradeDelays( 0, 0, 0, 0 );
> >
> > x = Param("Exrem Position", 1, 1, 4, 1);
> >
> > Buy = DayOfWeek()<Ref(DayOfWeek(),-1) AND
> > Sum(DayOfWeek()<Ref(DayOfWeek(),-1),BarsSince(Month()!=Ref(Month
> (),-1))+1)<=3;
> > // buy on 1st trading day of week within 1st 3 weeks of month
> > Sell = DayOfWeek()<Ref(DayOfWeek(),-1) AND
> > Sum(DayOfWeek()<Ref(DayOfWeek(),-1),BarsSince(Month()!=Ref(Month
> (),-1))+1)==4;
> > // sell on 1st trading day of week in last week of month
> >
> > // POSITION #1
> > if(x==1) Buy = ExRem(Buy,Sell);
> >
> > PlotShapes( Buy * shapeUpArrow, colorGreen, 0, L, -20 );
> > PlotShapes( Sell * shapeDownArrow, colorRed, 0, H, -20 );
> >
> > // POSITION #2
> > if(x==2) Buy = ExRem(Buy,Sell);
> > Plot( HighestSince(Buy,H), "Highest", colorBlue,
> styleLine|styleNoRescale );
> >
> > // POSITION #3
> > if(x==3) Buy = ExRem(Buy,Sell);
> > BuyPrice = ValueWhen(Buy,H);
> > Plot( BuyPrice, "BuyPrice", colorGreen,
> styleDots|styleNoLine|styleNoRescale );
> >
> > // POSITION #4
> > if(x==4) Buy = ExRem(Buy,Sell);
> >
> >
> >
> >
> > On 8/3/05, PA299 <pa299@xxxx> wrote:
> > >
> > >
> > > Hi
> > >
> > > How do you reference the bar that an actual trade (Buy/Short)
> takes place??
> > >
> > >
> > >
> > > I note that BarsSince(Buy) even with the lines Sell=ExRem
> (Sell,Buy);
> > > Buy=ExRem(Buy,Sell); included will give you the bars from the
> last RAW entry
> > > signal which may not be the last Actual signal.
> > >
> > >
> > >
> > > Am I missing the obvious??
> > >
> > >
> > >
> > > Any help would be appreciated.
> > >
> > > Thanks
> > >
> > > Peter
> > >
> > >
> > >
> > > 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
> > >
> > > Visit your group "amibroker" on the web.
> > >
> > > To unsubscribe from this group, send an email to:
> > > amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > >
> > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
> > > To unsubscribe from this group, send an email to:
> > > amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > >
> > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
> > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
> > > ________________________________
> > >
> >
> >
> > --
> > Cheers
> > Graham
> > AB-Write >< Professional AFL Writing Service
> > Yes, I write AFL code to your requirements
> > http://e-wire.net.au/~eb_kavan/ab_write.htm
>
>
>
>
>
> 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
>
>
>
>
>
>
>
>
--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hiuo872/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1123298948/A=2894352/R=0/SIG=11fdoufgv/*http://www.globalgiving.com/cb/cidi/tsun.html">Help tsunami villages rebuild at GlobalGiving. The real work starts now</a>.</font>
--------------------------------------------------------------------~->
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/
|