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

[amibroker] Re: long when index long



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "cagigas00" <cagigas00@xxxx> wrote:
>
> Hello and happy new year!
> 
> How can I code the following?
> 
> go long in a stock when Nasdaq is above the 9 day MA
> go short in a stock when Nasdaq is below the 9 day MA
> 
> I want my trading system to generate buys and shorts with reference to 
> an index (nasdaq i.e.)
> 
> Thanx
>

Put your own symbol in place of the index, OTC-C. You can look at this
in a plot or use it in AA for a backtest.
-------------------

index	= Foreign("OTC-C", "Close");

Buy	= Cross(index, MA(index, 9));
Sell	= Cross(MA(index, 9), index);

Plot(index, "index", 32);
Plot(MA(index, 9), "MA9", 42);
PlotShapes(shapeUpArrow*Buy+shapeDownArrow*Sell, 
IIf(Buy, 43, 32), 0, index, -12);
-------------------
Good Trading, Bill






------------------------ 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/