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

Re: [amibroker] Basic Buy and Exit code



PureBytes Links

Trading Reference Links

Hi Wally --

See if this helps --

////////////////////////////////////////////////////////
//    EnterOnSpecificDate.afl
//
//    Entry on a specific date.
//
//    Used to force an entry so that the operation of
//    a trading system or indicator can be checked.
//   
//    For market orders, enter and exit Market On Close
//        with no delay
SetTradeDelays(0,0,0,0);
BuyPrice = C;
SellPrice = C;

//    Enter on June 23, 1995
Buy = IIf(DateNum()==950623,1,0);
//    or Buy = Datenum()==950623;

//    Exit on September 12, 2002
Sell = IIf(DateNum()==1020912,1,0);
//    or Sell = Datenum()==1020912;
//Figure 7.4 Enter on Specific Date
//////////////////////////////////////////////////////////////

Thanks,
Howard

On Thu, Oct 16, 2008 at 4:36 PM, electricwally77 <soundmaker@xxxxxxxxxxxxx> wrote:

Hi Members

I'm learning AFL code and have written some basic SMA strategies.

Can someone please help me write a code to a simple buy and exit strategy.

For example, In regards to the stock, say Coca Cola (KO),

I'd like to Buy (at the open)on 01-03-2000 (January 3, 2000)

and

SELL (at the close) on 12-29-2006 (December 29, 2006)

Thank you for your time and patience while I'm learning.


__._,_.___

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___