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

RE: [amibroker] [AFL help] How to sell at the second signal?


  • To: amibroker@xxxxxxxxxxxxxxx
  • Subject: RE: [amibroker] [AFL help] How to sell at the second signal?
  • From: kris45mar <kris45mar@xxxxxxxxx>
  • Date: Sat, 11 Dec 2004 20:26:11 -0800 (PST)
  • Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys

PureBytes Links

Trading Reference Links

Graham.

This works a treat, thanks a lot.

I have plotted these exits as below on CTX in around
June 03 just to see how they work.

I have changed your code to Sell = Sum(Sellsig,
BarsSince(Buy))==1;
on the theory that it should give the same result as
Sell = Cross(C,P1);

They do appear on the correct place on the chart.

Interesting though how with this exit there are many
exit arrows after the Sell signal, when I use your
Sell = Sum(Sellsig, BarsSince(Buy))==1;

whereas with the original Sell = Cross(C,P1); there
seems to be only one arrow at each correct location.

Do I have my exrems all messed up?
Or is this because my Equity(1) is at the top of the
code?

// --- trial JBPTL 2nd --- //
// Buy and Sell criteria here //

Equity(1);

P1 = EMA (H, (13)) + 2 * ATR ( 10 );
P2 = HHV (H,(20)) - (2 * ATR (10));
E = LLV (L, 20) + (2.5 * ATR (10));

Buy = Cross(C,E);

SellSig = Cross(C,P1);

Sell = Sum(Sellsig, BarsSince(Buy))==1;
//Sell = Cross(C,P1);

ApplyStop(stopTypeNBar,stopModeBars,40);

ExRem(Buy,Sell);
ExRem(Sell,Buy);

Filter = Buy;

Colorif = IIf(C < E,colorRed,colorBlue);


Plot (P1, "JBPTL", colorBrown, styleLine );
Plot (P2, "second PTL", colorGreen,styleLine);
Plot (E,"entry line", colorBlue, styleLine);
Plot (Close, "close", colorif, styleBar | styleThick);

PlotShapes(IIf(Buy,shapeHollowSquare,shapeNone),colorBrightGreen,
0,C, 1);
PlotShapes(IIf(Sell,shapeDownArrow
,shapeNone),colorRed,0,C,-8);

GraphXSpace = 3;
// ---  end ---  //

Regards.

ChrisB


--- Graham <gkavanagh@xxxxxxxxxxxxx> wrote:

> You could try this
> 
> SellSig = Cross(C,Profitline);
> Sell = sum(Sellsig, barssince(buy))==2;
> 
> Cheers,
> Graham
> http://e-wire.net.au/~eb_kavan/
> 
> -----Original Message-----
> From: kris45mar [mailto:kris45mar@xxxxxxxxx] 
> Sent: Sunday, December 12, 2004 10:42 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] [AFL help] How to sell at the
> second signal?
> 
> 
> Hi All...
> 
> What function can I use if I want to sell the
> *second
> time* an event occurs?
> 
> // buy and sell criteria here //
> Profitline = EMA (H, (13)) + 2 * ATR (10);
> 
> EntryLine = LLV (L, 20) + (2.5 * ATR (10));
> 
> Buy = Cross(C,Entryline);
> 
> 
> Sell = Cross(C,Profitline);
> 
> This gives me a sell signal the *first time* the
> close
> crosses the Profitline.
> How do I code for a sell signal the *second time*
> (or
> third time for that matter) the close crosses the
> profitline?
> 
> I thought I might be able to use 
> Sell = Ref(cross(c,Profitline),2); as a sort
> lookforward function, but this does not work.
> 
> or do I use the Sum or Cum functions somehow?
> 
> TIA
> 
> ChrisB
> 
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Mail - Easier than ever with enhanced search.
> Learn more.
> http://info.mail.yahoo.com/mail_250
> 
> 
> 
> Check AmiBroker web page at:
> http://www.amibroker.com/
> 
> Check group FAQ at:
>
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> 
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250


------------------------ Yahoo! Groups Sponsor --------------------~--> 
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/