[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Referencing the last Actual entry signal.



PureBytes Links

Trading Reference Links

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@xxxxxxxxxxxxx> 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


------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12h52dugl/M=362131.6882500.7825259.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1123030343/A=2889190/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Put more honey in your pocket. (money matters made easy) Welcome to the Sweet Life - brought to you by One Economy</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/