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

[amibroker] Opening Range system not working



PureBytes Links

Trading Reference Links

After struggling quite a bit, I've got a very basic system that 
doesn't produce any signals and certainly has some flaws here and 
there :) If anyone cares to take a look I'd be thrilled:


// System rules:
// - The stock gaps up more than 1 percent
// - The stock's volume in the first 30 minutes of the day is higher 
than 25% of the stock's
//   average daily volume in the last 30 trading days
// - Buy when price exceeds the 30 min Opening Range high
// - Close position if price drops under 30 min Opening Range low
// - Trailing Stop at 1%
// - Stoploss at 0.5%



// ***** Opening Gap Code *****

TimeFrameSet (inDaily);
OpeningGap = (O - Ref (C, -1));
OpeningGapPct = (OpeningGap / Ref (C, -1)) * 100;
GapOK = OpeningGapPct > 1;
TimeFrameRestore ();


// ***** Average Daily Volume Code *****

TimeFrameSet (inDaily);
AvgVol30Days = Sum ( V, 30);
TimeFrameRestore ();


// ***** Opening Volume Code *****

dn = DateNum();
StartDay = dn != Ref (dn, -1);
FirstOpeningBar = Ref (StartDay, 0);
LastOpeningBar = Ref (StartDay, -29);

if (FirstOpeningBar = 1) 
    OpeningVolume = 0;
else ;

if (LastOpeningBar = 1)
    OpeningVolume = Sum (V,29);
else ;

VolumeOK = IIf (OpeningVolume > (TimeFrameExpand (AvgVol30Days, 
inDaily, expandFirst) * 0.25), 1, 0);


// ***** Opening Range Code *****

if (FirstOpeningBar = 1)
    OpeningHigh = HHV (H,29);
else ;

if (LastOpeningBar = 1)
    OpeningLow = LLV (L,29);
else ;


// ***** System Logic *****

Buy = GapOK AND VolumeOK AND (H > OpeningHigh);
BuyPrice = ValueWhen ( Buy, O, 1);
Sell = (L > OpeningLow);
ApplyStop (stopTypeLoss, stopModePercent, 0.5, 1, Volatile=False, 
ReEntryDelay=0);
ApplyStop (stopTypeTrailing, stopModePercent, 1, 1, Volatile=False, 
ReEntryDelay=0);




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