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

[amibroker] help with shorting system



PureBytes Links

Trading Reference Links

Hi,

The following system seems to show the Shorts when I use Explore, but 
when I use backtest only one trade appears and it says it's an open 
long position. I'm new at AmiBroker so any guidance would be 
appreciated. 

Thanks

//Define EntryTrigger
EntryTrigger = DaysUp AND CloseGTMA200 AND ATR30PGT15 AND 
HighGTMA103ATR5;

//Define SELL Price for tomorrow - Todays high + 0.5 * ATR(2)
ShortPrice = H + (0.5*ATR(2));

//Define stops and cover price
//InitialStop = ShortPrice + Ref(6 * ATR(10),-1);
InitialStop = ShortPrice + Ref(1.1*ATR(2),-1);
ProfitStop = Ref(L, -2);
ExitTrigger = L <= ProfitStop;
//CoverPrice = IIf(O > Ref(ProfitStop, -1), O, Ref(ProfitStop, -2));
CoverPrice = profitstop;

// You need to define the Buy and Sell signals for the
// backtester, when going short
//
Sell = EntryTrigger;
Buy = ExitTrigger;

Short = EntryTrigger;
Cover = ExitTrigger;

// The explorer needs Filter to be set with your signals.
//Filter = Buy;
//Filter = Short OR Cover;
//Filter = 1;
Filter = Short;
//Filter=1;
AddColumn( H,"Todays High", 1.2 );
AddColumn(ATR(2),"ATR(2)",1.4);
AddColumn(ATR(10),"ATR(10)",1.4);
AddColumn(initialstop,"Initial stop",1.2);
AddColumn(Profitstop,"Low 2 Days ago",1.2);
AddColumn( EntryTrigger, "Short?", 1.2 );
AddColumn( ExitTrigger, "BuyBack?", 1.2 );
AddColumn( Close, "Close", 1.2 );
AddColumn( Daysup, "Days Up", 1.2 );
AddColumn( MA(C,200) ,"MA(200)",1.2);
AddColumn( CloseGTMA200 ,"Close > MA200",1.2);
AddColumn( (ATR(30)/C)*100 ," ATR(30)% > 1.5", 1.2 );
AddColumn( MA(C,10) + 3 * ATR(5),"High > MA(10)+3*ATR(5)", 1.2 );
AddColumn(HighGTMA103ATR5 ,"High above ma(10) + atr(5)*3",1.2);
AddColumn( ShortPrice,"Sell at",1.2);
AddColumn( ProfitStop,"Buy at",1.2);
AddColumn( CoverPrice,"Cover at",1.2);

// You might also want to have an automatic stop to
// exit immediately when hit (because the way you have
// InitialStop won't do much).
ApplyStop(stopTypeLoss, stopModePoint, initialstop);



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/