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

[amibroker] Re: Delaying A Buy or Sell



PureBytes Links

Trading Reference Links

Thanks Steve, I believe that will do it just fine. 
I understand now. 

Thanks a lot
Rusty
amibroker@xxxxxxxxxxxxxxx, "Steve" <avalon-ardy@xxxx> wrote:
> Try this.....
> 
> Plot ( Close, "Close", colorWhite, styleBar);
> //Graph3Style = 1;
> //Graph3Color = 43;
> //Graph3 = EMA (Close, 5);
> EMA5 = EMA(C,5);
> Plot(EMA5,"EMA5",43,styleLine|styleNoRescale);
> //Graph4Style = 1;
> //Graph4Color = 42;
> //Graph4 = EMA (Close, 13);
> EMA13 = EMA(C,13);
> Plot(EMA13,"EMA13",42,styleLine|styleNoRescale);
> //Graph5Style = 1;
> //Graph5Color = 32;
> //Graph5 = (EMA (Close, 200));
> EMA200 = EMA(C,200);
> Plot(EMA200,"EMA200",32,styleLine| styleNoRescale);
> /*
> EMAdiff = (EMA13 - EMA200)*.13;
> Plot(EMAdiff,"EMAdiff",28,styleLine);
> */
> //Buy = Cross( EMA( Close, 5), EMA( Close, 13 ) ) AND Close > 
> EMA(Close,200);
> //Buy = Cross( EMA( Close, 5), EMA( Close, 13 ) ) AND Close < 
> EMA(Close,200);
> BuyStop = EMA5> EMA13 AND Cross( EMA5,EMA13);
> //Sell = Cross( EMA( Close, 200 ), Close );
> SellStop = Cross( EMA13, EMA5);
> Buy =IIf(BarsSince(Buystop) == 5,1,0); //Delay set to 5 bars
> Sell =IIf(BarsSince(Sellstop) ==5,1,0);
> PlotShapes( shapeUpArrow*Buy, colorGreen,0, L, -20);
> PlotShapes( shapeUpArrow*Buystop, colorOrange,0, L, -20);
> PlotShapes( shapeDownArrow*Sell, colorRed,0,H, -20) ;
> PlotShapes( shapeDownArrow*Sellstop, colorLightBlue,0,H, -20) ;
> _SECTION_END();
> 
> 
> ----- Original Message ----- 
> From: kandrstocks
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Wednesday, September 14, 2005 10:17 AM
> Subject: [amibroker] Delaying A Buy or Sell
> 
> 
> Here is my code I am working on just to try and understand AFL.
> Nothing big just a cross of a 13 and 5 day ema. How Can I delay the
> buys and sells for a given number of bars or days? I have tried
> barssince function without any luck. I am sure I am doing something
> wrong but getting frustrated and thought someone here could help me 
a
> bit.
> 
> Thanks
> Rusty
> MaxGraph = 18;
> Plot ( Close, "Close", colorBlack, styleBar);
> Graph3Style = 1;
> Graph3Color = 43;
> Graph3 = EMA (Close, 5);
> Graph4Style = 1;
> Graph4Color = 42;
> Graph4 = EMA (Close, 13);
> Graph5Style = 1;
> Graph5Color = 32;
> Graph5 = (EMA (Close, 200));
> Graph6Style = 1;
> Graph6Color = 21;
> Graph6 = ((EMA (Close, 200))- (EMA (Close, 200))*.13) ;
> 
> //Buy = Cross( EMA( Close, 5), EMA( Close, 13 ) ) AND Close > EMA
> (Close,200);
> //Buy = Cross( EMA( Close, 5), EMA( Close, 13 ) ) AND Close < EMA
> (Close,200);
> Buy = (EMA( Close, 5)> (EMA(Close, 13)))  AND Cross( (EMA( Close,
> 5)), EMA( Close, 13 ) );
> 
> //Sell = Cross( EMA( Close, 200 ), Close );
> Sell = (Cross( EMA( Close, 13), EMA( Close, 5 ) ));
> 
> PlotShapes( shapeUpArrow*Buy, colorGreen,0, L, -20);
> 
> PlotShapes( shapeDownArrow*Sell, colorRed,0,H, -20) ;




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/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/