Search the web
Sign In
New User? Sign Up
amibroker · AmiBroker User's List
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
How to Buy Tomorrow and Sell the Next Day Using Your Whole Portfolio   Message List  
Reply | Forward Message #116945 of 143815 |
Re: [amibroker] How to Buy Tomorrow and Sell the Next Day Using Your Whole Portfolio

hi,
 
there are multiple ways to do this in Amibroker. Below I give an example how it can built this in a portfolio type system,
 
rgds, Ed
 
 
 
// if you want this inside a portfolio type system
SetBarsRequired(10000,10000
);
SetOption("MaxOpenPositions", 10
);
SetOption("UsePrevBarEquityForPosSizing",True
);
SetOption("PriceBoundChecking", False
);
PositionSize = -10
;
SetTradeDelays(0,0,0,0
);

// delay of exit with respect to entry in bars

sellDelay =
Optimize("sellDelay", 1, 1, 50, 1
);

// buy signal when H exceeds H of past 220 bars

Buy = H > Ref(HHV(H,220),-1
);

// entry at the open of the bar following the signal bar

Buy = Ref(Buy,-1); BuyPrice = O
;

// remove excessive signals from initial signal

Buy = ExRemSpan(Buy
, sellDelay);

// sell sellDelay bars after entry at the open

Sell = BarsSince(Buy) == sellDelay; SellPrice = O
;

SetChartOptions(0, chartShowDates
);
GraphXSpace = 5
;
Plot(C,"C",1,64
);
PlotShapes(IIf(Buy,shapeUpArrow,0),colorWhite, layer = 0, yposition = BuyPrice, offset = 0
);
PlotShapes(IIf(Sell,shapeDownArrow,0),colorYellow, layer = 0, yposition = SellPrice, offset = 0
);

PositionScore = 1/Ref(RSI(sellDelay),-1)
 
 
 
----- Original Message -----
Sent: Tuesday, November 13, 2007 8:24 PM
Subject: [amibroker] How to Buy Tomorrow and Sell the Next Day Using Your Whole Portfolio

So I've got this great EOD system that pulls in handsome results.
However, I really want to measure exactly how effective it is.
There's only one snafu. I can't get the backtester to buy and sell on
different days. Basically, I want to:

1) Get the buy signal at the end of Day 1
2) Buy the stock on the opening of Day 2
3) Sell the stock on the opening of Day 3

And I can do this when I invest my whole portfolio in one stock using
this code:

E = Equity(0);
Buy <= SellPrice*Ref(E,-1) AND E > 0;

And I've tried everything I can think of relating to Buy, Sell, and
Ref commands, but those only seems to work when you don't want the
backtester to buy and sell the SAME stock on the same day. It doesn't
work across your whole portfolio.

So does anyone know how to buy tomorrow and sell the next day across
your entire portfolio?



Wed Nov 14, 2007 1:26 pm

ed2000nl
Offline Offline
Send Email Send Email

Forward
Message #116945 of 143815 |
Expand Messages Author Sort by Date

So I've got this great EOD system that pulls in handsome results. However, I really want to measure exactly how effective it is. There's only one snafu. I...
Joseph Peha
krazyglu52
Offline Send Email
Nov 14, 2007
12:20 pm

hi, there are multiple ways to do this in Amibroker. Below I give an example how it can built this in a portfolio type system, rgds, Ed // if you want this...
Edward Pottasch
ed2000nl
Offline Send Email
Nov 14, 2007
1:26 pm

Thank you so much, Ed! Awesome stuff. ... example how it can built this in a portfolio type system, ... = BuyPrice, offset = 0 ); ... yposition = SellPrice,...
Joseph Peha
krazyglu52
Offline Send Email
Nov 14, 2007
4:49 pm

SetTradeDelays( 1, 0, 0, 0 ); buy = your signal sell = ref(buy, -1); buyprice = open; sellprice = open; _____ From: amibroker@yahoogroups.com...
Paul Ho
paultsho
Offline Send Email
Nov 14, 2007
5:28 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help