PureBytes Links
Trading Reference Links
|
Okay, Thank you Harold. Got it. I changed the Buy to "O" (Open) and
left the Sell at "C" (Close). The code worked well. I just noticed
your posting which was dated Oct, 18, 2008.
//Here is the code below.
SetTradeDelays(0,0,0,0);
BuyPrice = O;
SellPrice = C;
Buy = IIf(DateNum()==950623,1,0);
Sell = IIf(DateNum()==1020912,1,0);
--- In amibroker@xxxxxxxxxxxxxxx, "Howard B" <howardbandy@xxx> wrote:
>
> 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@xxx>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
*********************************
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|