[amibroker] Re: a bug in portfolio tester?

2009-06-04 Thread stevensg2009
Tomasz,

I took a look of my code really hard, and found the possible reason. My code 
set backtester mode to backtestRegularRaw. For this mode, if there are 
multiple buy before sell, the example code for scale in and out below seems not 
to work. I think the code cannot determine the priceatbuy and highsincebuy 
properly. The reason is we don't know when the trade will be entered until 
portfolio test is done. Am I understanding this correctly? Is there a sample 
code for backtestRegularRaw mode? 

Many thanks,
Steven

// the system will exit 
// 50% of position if FIRST PROFIT TARGET stop is hit 
// 50% of position is SECOND PROFIT TARGET stop is hit 
// 100% of position if TRAILING STOP is hit 

FirstProfitTarget = 10; // profit 
SecondProfitTarget = 20; // in percent 
TrailingStop = 10; // also in percent 

priceatbuy=0; 
highsincebuy = 0; 

exit = 0; 

for( i = 0; i  BarCount; i++ ) 
{ 
   if( priceatbuy == 0 AND Buy[ i ] ) 
{ 
   priceatbuy = BuyPrice[ i ]; 
} 

   if( priceatbuy  0 ) 
{ 
   highsincebuy = Max( High[ i ], highsincebuy ); 

  if( exit == 0 AND 
  High[ i ] = ( 1 + FirstProfitTarget * 0.01 ) * priceatbuy ) 
   { 
 // first profit target hit - scale-out 
 exit = 1; 
 Buy[ i ] = sigScaleOut; 
   } 

  if( exit == 1 AND 
  High[ i ] = ( 1 + SecondProfitTarget * 0.01 ) * priceatbuy ) 
   { 
 // second profit target hit - exit 
 exit = 2; 
 SellPrice[ i ] = Max( Open[ i ], ( 1 + SecondProfitTarget * 0.01 ) * 
priceatbuy ); 
   } 

  if( Low[ i ] = ( 1 - TrailingStop * 0.01 ) * highsincebuy ) 
   { 
 // trailing stop hit - exit 
 exit = 3;
 SellPrice[ i ] = Min( Open[ i ], ( 1 - TrailingStop * 0.01 ) * 
highsincebuy ); 
   } 

  if( exit = 2 ) 
   { 
 Buy[ i ] = 0; 
 Sell[ i ] = exit + 1; // mark appropriate exit code 
 exit = 0; 
 priceatbuy = 0; // reset price 
 highsincebuy = 0; 
   } 
} 
} 

SetPositionSize( 50, spsPercentOfEquity ); 
SetPositionSize( 50, spsPercentOfPosition * ( Buy == sigScaleOut ) ); // scale 
out 50% of position




Re: [amibroker] Re: Do all trading systems stop working? - Howard Bandy's book

2009-06-04 Thread malcolm Crouch
Its a funny Conversation this .

If All systems will eventually fail then

 The underlying theory must be wrong  so therefore dow theory , elliot
wave theory , fundamental economic  thoery  ect must all be wrong ... except
these are the underpinning of most practitioners. which leads us to say then
All textbookss are wrong  and all academics are wrong .. which say all
universities are wrong .

So therefore most education in the financial markets will eventually fail
...

So this could bring us to a conversation about the random walk of stock
prices .. which would lean on a quantitve side ... which would fail .

however there are practictions making from -100% to plus 1000% per annum
 so i would say not all
Systems but rather the Individuals designing the system fail .

Perhaps the education  fail in a sense...
The learners fail ...
The work experience fails
so perhaps all that is needed is the correct  hard work and the correct
study and the correct experience
(which would be very difficult with limited resources )



I would imagine you are defining the problem  wrong, when actually the
problem is the greater environment  not the system.

i think a classic example of this is the current weakness in the market in a
way the education system has failed , the regulatory system has failed and
executive management has failed (to name a few )

The world has a long way still to go . we are a  young civilisation .


Regards

Malcolm




On Thu, Jun 4, 2009 at 10:01 AM, Herman psy...@magma.ca wrote:



  Brian, often people waste a lot of time trying to call something black or
 white; you learn more if you try looking at the grey stuff in between.


 Of course there are 'systems' that last forever. Buy-n-hold, trend
 following, or rotational trading are trading systems to some. It all depends
 on your criteria of what makes a trading system. Then there are highly
 optimized trading systems that will, as one would expect, fade in and out of
 Performance. Some systems will, with some discretionary input, keep working
 forever while for a true mechanical trader these systems will fail. What may
 be a great trading idea to one person may be a joke to another.


 However, if you must have an answer I think it is best to err on the safe
 side and say that ALL systems will eventually fail. Overconfidence in any
 system may end up costing you dearly.


 Best regards,

 herman


 Wednesday, June 3, 2009, 9:32:35 PM, you wrote:


  You are sitting on the fence Herman ... that can become a bit
 uncomfortable;-)


  In the scientific method all axioms are temporary and it only takes one

  verifiable case to reject the null hypothesis of the current axiom.


  We already have a list of candidate systems that people claim have
 remained successful over decades.


  Declare yourself ... do ALL systems fail because they are discovered and
 traded to failure or not?


  Are you are an evidenced based trader or some other kind of trader?


  Because breakout systems were made famous by the Turtles and they now
 fail

  for some traders does that mean all breakout systems fail for all traders
 and

  all instruments all of the time (how can anyone know the answer to that
 question one way or another?)




  


   IMPORTANT PLEASE READ 

  This group is for the discussion between users only.

  This is *NOT* technical support channel.


  TO GET TECHNICAL SUPPORT send an e-mail directly to

  SUPPORT {at} amibroker.com


  TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at

  http://www.amibroker.com/feedback/ http://www.amibroker.com/feedback/

  (submissions sent via other channels won't be considered)


  For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:

  http://www.amibroker.com/devlog/ http://www.amibroker.com/devlog/


  Yahoo! Groups Links


  http://groups.yahoo.com/group/amibroker/


  Individual Email | Traditional


  http://groups.yahoo.com/group/amibroker/join

  (Yahoo! ID required)


  
  mailto:amibroker-dig...@yahoogroups.comamibroker-dig...@yahoogroups.com


  
  mailto:amibroker-fullfeatu...@yahoogroups.comamibroker-fullfeatu...@yahoogroups.com


  amibroker-unsubscr...@yahoogroups.com


  http://docs.yahoo.com/info/terms/



  




-- 
Malcolm A.B Croucher


[amibroker] Re: Do all trading systems stop working? - Howard Bandy's book

2009-06-04 Thread sidhartha70
Malcolm,

Spot on. I agree 100%.


--- In amibroker@yahoogroups.com, malcolm Crouch malcolm.crouc...@... wrote:

 Its a funny Conversation this .
 
 If All systems will eventually fail then
 
  The underlying theory must be wrong  so therefore dow theory , elliot
 wave theory , fundamental economic  thoery  ect must all be wrong ... except
 these are the underpinning of most practitioners. which leads us to say then
 All textbookss are wrong  and all academics are wrong .. which say all
 universities are wrong .
 
 So therefore most education in the financial markets will eventually fail
 ...
 
 So this could bring us to a conversation about the random walk of stock
 prices .. which would lean on a quantitve side ... which would fail .
 
 however there are practictions making from -100% to plus 1000% per annum
  so i would say not all
 Systems but rather the Individuals designing the system fail .
 
 Perhaps the education  fail in a sense...
 The learners fail ...
 The work experience fails
 so perhaps all that is needed is the correct  hard work and the correct
 study and the correct experience
 (which would be very difficult with limited resources )
 
 
 
 I would imagine you are defining the problem  wrong, when actually the
 problem is the greater environment  not the system.
 
 i think a classic example of this is the current weakness in the market in a
 way the education system has failed , the regulatory system has failed and
 executive management has failed (to name a few )
 
 The world has a long way still to go . we are a  young civilisation .
 
 
 Regards
 
 Malcolm
 
 
 
 
 On Thu, Jun 4, 2009 at 10:01 AM, Herman psy...@... wrote:
 
 
 
   Brian, often people waste a lot of time trying to call something black or
  white; you learn more if you try looking at the grey stuff in between.
 
 
  Of course there are 'systems' that last forever. Buy-n-hold, trend
  following, or rotational trading are trading systems to some. It all depends
  on your criteria of what makes a trading system. Then there are highly
  optimized trading systems that will, as one would expect, fade in and out of
  Performance. Some systems will, with some discretionary input, keep working
  forever while for a true mechanical trader these systems will fail. What may
  be a great trading idea to one person may be a joke to another.
 
 
  However, if you must have an answer I think it is best to err on the safe
  side and say that ALL systems will eventually fail. Overconfidence in any
  system may end up costing you dearly.
 
 
  Best regards,
 
  herman
 
 
  Wednesday, June 3, 2009, 9:32:35 PM, you wrote:
 
 
   You are sitting on the fence Herman ... that can become a bit
  uncomfortable;-)
 
 
   In the scientific method all axioms are temporary and it only takes one
 
   verifiable case to reject the null hypothesis of the current axiom.
 
 
   We already have a list of candidate systems that people claim have
  remained successful over decades.
 
 
   Declare yourself ... do ALL systems fail because they are discovered and
  traded to failure or not?
 
 
   Are you are an evidenced based trader or some other kind of trader?
 
 
   Because breakout systems were made famous by the Turtles and they now
  fail
 
   for some traders does that mean all breakout systems fail for all traders
  and
 
   all instruments all of the time (how can anyone know the answer to that
  question one way or another?)
 
 
 
 
   
 
 
    IMPORTANT PLEASE READ 
 
   This group is for the discussion between users only.
 
   This is *NOT* technical support channel.
 
 
   TO GET TECHNICAL SUPPORT send an e-mail directly to
 
   SUPPORT {at} amibroker.com
 
 
   TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
 
   http://www.amibroker.com/feedback/ http://www.amibroker.com/feedback/
 
   (submissions sent via other channels won't be considered)
 
 
   For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
 
   http://www.amibroker.com/devlog/ http://www.amibroker.com/devlog/
 
 
   Yahoo! Groups Links
 
 
   http://groups.yahoo.com/group/amibroker/
 
 
   Individual Email | Traditional
 
 
   http://groups.yahoo.com/group/amibroker/join
 
   (Yahoo! ID required)
 
 
   
   mailto:amibroker-dig...@yahoogroups.comamibroker-dig...@yahoogroups.com
 
 
   
   mailto:amibroker-fullfeatu...@yahoogroups.comamibroker-fullfeatu...@yahoogroups.com
 
 
   amibroker-unsubscr...@yahoogroups.com
 
 
   http://docs.yahoo.com/info/terms/
 
 
 
   
 
 
 
 
 -- 
 Malcolm A.B Croucher





[amibroker] Re: automation : asked already in AT forum - but maybe someone here knows an ans

2009-06-04 Thread dubi1974
They do... but this would not be a nice and reliable solution... As the 
exported trade history is delayed ... if the two indicators would produce 
signals at the same time, I could not find out which was filled ...

does someone else have a solution or ever thought about that problem?

--- In amibroker@yahoogroups.com, Mike sfclimb...@... wrote:

 Hi,
 
 Does IB offer access to the trade history? Using BarsSince from AmiBroker you 
 can determine the order in which your signals fired. If IB offers the API, 
 you can iterate through the trade history of the symbol and match the trades 
 to the signals.
 
 Mike
 
 --- In amibroker@yahoogroups.com, dubi1974 gonzales74@ wrote:
 
  Hi guys,
  
  how do you solve this problem?:
  I would like to use different indicators for opening/closing a position. 
  I would like the orders to be executed automatically. 
  I don't want the positions (let's say the mini SP) of the different 
  indicators to interfere each other?
  I am working with ibc.GetPositionSize... but here I cannot get any 
  information of the indicator which placed the positions.
  Example:
  indicator 1 gives me a signal to buy 10 ES contracts. 10 ES are filled
  5 min later indicator 2 gives me a signal to buy 10 ES contracts. But just 
  5 ES are filled.
  So I am long 15 contracts... If indicator 2 gives me an exit signal e.g. 
  1hour later, how should the the AT system know that it should sell just 5 
  contracts as just 5 were filled?
  ibc.GetPositionSize  can't solve this problem... 
  
  Does someone know a solution for this problem?
  
  Many thanks, dubi
 





Re: [amibroker] Re: AFL formula question

2009-06-04 Thread Thomas Ludwig

On 03.06.2009, 22:11:06 Keith McCombs wrote:

 You probably meant RSI(14)  Ref(RSI(14),1)

Better yet: RSI(14)  Ref(RSI(14),-1)

;-)






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

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

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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

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-dig...@yahoogroups.com 
mailto:amibroker-fullfeatu...@yahoogroups.com

* To unsubscribe from this group, send an email to:
amibroker-unsubscr...@yahoogroups.com

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/



[amibroker] How to graph ... Ticker Information Financials 1Yr Target price

2009-06-04 Thread gmorlosky
I see under the Information window in Amibroker for each ticker, there is a sub 
category Financials, which has a listing of 1yr Target Price.(fundamental basic 
data from Yahoo - downloaded via AmiQuote)

How do I access this piece of data that I might create an indicator to overlay 
on the price ?



[amibroker] Re: How to graph ... Ticker Information Financials 1Yr Target price

2009-06-04 Thread gmorlosky
Look in
http://www.amibroker.com/guide/h_fundamental.html

--- In amibroker@yahoogroups.com, gmorlosky gmorlo...@... wrote:

 I see under the Information window in Amibroker for each ticker, there is a 
 sub category Financials, which has a listing of 1yr Target Price.(fundamental 
 basic data from Yahoo - downloaded via AmiQuote)
 
 How do I access this piece of data that I might create an indicator to 
 overlay on the price ?





[amibroker] How to use ODBC for data other than OHLC

2009-06-04 Thread dmcleod1981
Is it possible to use other data from a database that is not open high low 
close data? I wanted to try and plot in AB some historical fundamental 
information but have not been able to figure out based on the samples given. Is 
this possible and does anyone have an example they would be willing to share?

Thanks,
DM



[amibroker] How to stop fundamental download from overwriting Fullname ???

2009-06-04 Thread gmorlosky
I notice that when I download Fundamental data (Yahoo), the fullname is 
overwritten. The problem is that the full name for the mutual funds from Yahoo 
starts with the company and is usually 40 charaters long and so there is no 
value left in the field to understand which fund it is, as it is restricted to 
maybe 17 charaters.

Fullname (as I had it)
FS-Biotechnology

Fullname (after fundamental download)
FIDELITY SELECT S

Is there a way to restrict this overwriting ?



[amibroker] Re: WorstRankHeld Help

2009-06-04 Thread bistrader
Hoping to do without backtester.  Will read Help and see if I can do this.  I 
have Howard Brandy's book, Into to AmiBroker, and will see if something is in 
there as well.  Thanks Bruce.
--- In amibroker@yahoogroups.com, bruce1r bru...@... wrote:

 Bert -
 
 I think that it isn't trivial, but is reasonably straightforward.
 
 1. Set worst rank held to 15.
 2. Use mid-level backtester.
 3. On the first of the month, walk the signals and set the PosScore of
 signals 4 - 15 to 0.
 
 Remember, you are doing it on the first of the month if BuyDelay is 1. 
 This is because rotational mode shifts the rank signals by the delay and
 executes.
 
 -- BruceR
 
 --- In amibroker@yahoogroups.com, Ron Rowland rowland@ wrote:
 
  I don't think it can be done (short of writing special code inside the
 Custom Backtester).
 
  Every time I try to change/manipulate the WorstRankHeld option, I get
 an invalid type error.
 
  Some workarounds, which might get you closer but not all the way
 there, include:
  1) The ScoreNoRotate method that Tomasz described
  2) Using stop-losses to exit current position and rotate into new one
 (not the same as a #15 ordinal rank but will get you out mid-month under
 the defined conditions)
  3) Special coding of PositionScore when not at month end (again, not
 the same as a #15 ordinal rank but will get you out mid-month under the
 defined conditions)
 
  I am interested in this also, so let me know if you find an answer!
 
  --- In amibroker@yahoogroups.com, bistrader bistrader@ wrote:
  
  
   On last day of month I want MaxOpenPositions and WorstRankHeld at 3,
 which I have.  I do not want scoreNoRotate for other days in the month. 
 Rather, for other days in the month I want WorstRankHeld set at 15,
 leaving MaxOpenPositions at 3, so that system will rotate if any
 position held drops to below 15th in the ranking.  How do I do this?
  
   The idea is to buy on the last day of the month the top 3 ranked and
 to hold them until the end of the next month, but only if the ranking
 does not fall a large amount (say, to 15 as I stated above) during the
 month.
  
  
   Thanks
  
   Bert
  
  
   --- In amibroker@yahoogroups.com, Tomasz Janeczko \(groups\)
 groups@ wrote:
   
Hello,
   
Set both MaxOpenPositions and WorstRankHeld to 3
AND
set PositionScore to scoreNoRotate value for every day BUT the one
you want rotation to occur.
   
SetOption(MaxOpenPositions, 3 );
SetOption(WorstRankHeld, 3 );
   
PositionScore = IIF( Month() != Ref( Month(), 1 ), ...your
 original score here.., scoreNoRotate );
   
   
Best regards,
Tomasz Janeczko
amibroker.com
- Original Message -
From: bistrader bistrader@
To: amibroker@yahoogroups.com
Sent: Wednesday, May 27, 2009 8:45 PM
Subject: [amibroker] WorstRankHeld Help
   
   
I am working on an afl that rotates into the top 3 ETFs on the
 last trading day of the month.  Here, I set MaxOpenPositions and
WorstRankHeld to 3.  I understand how to do this, but would like
 the afl to set WorstRankHeld to say 15 for any other day in the
month.  That is, if the ranking of an owned ETF falls to below
 15, on any other market day in the month, then I want to sell the
ETF and buy the next ranked (at that point in time) ETF.

 Does anyone have sample code for this?

 Thanks

 Bert



 

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

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

 TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
 http://www.amibroker.com/feedback/
 (submissions sent via other channels won't be considered)

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

 Yahoo! Groups Links



   
  
 





[amibroker] Re: WorstRankHeld Help

2009-06-04 Thread bistrader
Thanks and I am still trying.  I am hoping that someone else has done something 
like this, that can post here.

--- In amibroker@yahoogroups.com, Ron Rowland rowl...@... wrote:

 I don't think it can be done (short of writing special code inside the Custom 
 Backtester).
 
 Every time I try to change/manipulate the WorstRankHeld option, I get an 
 invalid type error.  
 
 Some workarounds, which might get you closer but not all the way there, 
 include:
 1) The ScoreNoRotate method that Tomasz described
 2) Using stop-losses to exit current position and rotate into new one (not 
 the same as a #15 ordinal rank but will get you out mid-month under the 
 defined conditions)
 3) Special coding of PositionScore when not at month end (again, not the same 
 as a #15 ordinal rank but will get you out mid-month under the defined 
 conditions)
 
 I am interested in this also, so let me know if you find an answer!
 
 --- In amibroker@yahoogroups.com, bistrader bistrader@ wrote:
 
  
  On last day of month I want MaxOpenPositions and WorstRankHeld at 3, which 
  I have.  I do not want scoreNoRotate for other days in the month.  Rather, 
  for other days in the month I want WorstRankHeld set at 15, leaving 
  MaxOpenPositions at 3, so that system will rotate if any position held 
  drops to below 15th in the ranking.  How do I do this?
  
  The idea is to buy on the last day of the month the top 3 ranked and to 
  hold them until the end of the next month, but only if the ranking does not 
  fall a large amount (say, to 15 as I stated above) during the month.
  
  
  Thanks
  
  Bert
  
  
  --- In amibroker@yahoogroups.com, Tomasz Janeczko \(groups\) groups@ 
  wrote:
  
   Hello,
   
   Set both MaxOpenPositions and WorstRankHeld to 3
   AND
   set PositionScore to scoreNoRotate value for every day BUT the one
   you want rotation to occur.
   
   SetOption(MaxOpenPositions, 3 );
   SetOption(WorstRankHeld, 3 );
   
   PositionScore = IIF( Month() != Ref( Month(), 1 ), ...your original score 
   here.., scoreNoRotate );
   
   
   Best regards,
   Tomasz Janeczko
   amibroker.com
   - Original Message - 
   From: bistrader bistrader@
   To: amibroker@yahoogroups.com
   Sent: Wednesday, May 27, 2009 8:45 PM
   Subject: [amibroker] WorstRankHeld Help
   
   
   I am working on an afl that rotates into the top 3 ETFs on the last 
   trading day of the month.  Here, I set MaxOpenPositions and 
   WorstRankHeld to 3.  I understand how to do this, but would like the afl 
   to set WorstRankHeld to say 15 for any other day in the 
   month.  That is, if the ranking of an owned ETF falls to below 15, on 
   any other market day in the month, then I want to sell the 
   ETF and buy the next ranked (at that point in time) ETF.
   
Does anyone have sample code for this?
   
Thanks
   
Bert
   
   
   

   
 IMPORTANT PLEASE READ 
This group is for the discussion between users only.
This is *NOT* technical support channel.
   
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
   
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
   
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
   
Yahoo! Groups Links
   
   
   
  
 





[amibroker] Re: Walk Forward Testing - Varies by Computer?

2009-06-04 Thread toddk63
I just debugged a similar problem.  Same system, same database, different 
answer.  Turned out to be the Limit Trade Size option on the Settings 
dialog box.  Default is 10,  I need to set it to 0.  I wish there were a 
function like SetOption(LimitTradeSize), but there is not...


--- In amibroker@yahoogroups.com, jacklweinberg jacklweinb...@... wrote:

 Question: 
 How is it possible for a walkforward test to produce different results on two 
 different computers?
 Background:
 1. AB program, database, system, watchlist, walkforward settings etc. are on 
 a usb key that is moved from one computer to another.
 2. Before the walk forward test, the same walkforward settings file is 
 loaded. The same system is executed. The results are also put into the same 
 usb key.
 
 Why do two different computers produce different results? (and strangely 
 enough, very different results!)





[amibroker] Re: How to stop fundamental download from overwriting Fullname ???

2009-06-04 Thread Ed Hoopes
This is a work-around that I use.  After loading the fundamental data, I run 
the following script to put the names back to what I like.
If you haven't done these scripts:
1. Edit/Save the file as clear text using NotePad or whatever.
2. Go to FILE - IMPORT ASCII in AB
3. Navigate to the file  click OPEN
You're done.

$FORMAT FULLNAME, NAME
$AUTOADD 1
$OVERWRITE 1
$BREAKONERR 1
PS DynBioTech,PBE
FTr Biotech,FBT
iShr Nas BioTech,IBB
sTr BioTech,XBI
Hldrs Biotech,BBH

ETC.

ReefBreak

--- In amibroker@yahoogroups.com, gmorlosky gmorlo...@... wrote:

 I notice that when I download Fundamental data (Yahoo), the fullname is 
 overwritten. The problem is that the full name for the mutual funds from 
 Yahoo starts with the company and is usually 40 charaters long and so there 
 is no value left in the field to understand which fund it is, as it is 
 restricted to maybe 17 charaters.
 
 Fullname (as I had it)
 FS-Biotechnology
 
 Fullname (after fundamental download)
 FIDELITY SELECT S
 
 Is there a way to restrict this overwriting ?





[amibroker] Newbie Array / Looping Question

2009-06-04 Thread ics4mer
Hi all,

I'm after a general form for doing a particular type of algorithm 
in AFL - and I'm happy to admit that I might be going about it 
the totally wrong way...

I am attempting to extract an evolving profile of a stock over 
time.

Using median as an example, lets say I want calculate the median
percentage price change for the life of the stock. To give an 
example:
 
The 1st trading day - do nothing.
The 2nd trading day - calc median for 2 days
The 3rd trading day - calc median for 3 days
Last traded day - calc median for n days.

For simple functions, I have used a construct similar to;
for ( i=0; i  BarCount; i++ ){
   myArray[ i ] = simpleFunc( i );
   .
}

However, in this case, I would have to write a new median function,
and this is irritating, since there is a perfectly good one 
taunting me from the users manual! That's why I suspect that I 
might be doing something in the wrong way.

Any help or pointers would be much appreciated. A pointer to 
a message in the user group would be fine too! ( Yes I am still
trawling through the email group as I write this)

TIA

Robert Z



[amibroker] Re: How to stop fundamental download from overwriting Fullname ???

2009-06-04 Thread sumangalam
Hello ED,

Is it right/possible to put Import Format as well as IMPORT Data in one file? I 
thought Format has to be in a separate file than the data to be imported.

I think while importing you select Format separately than the file. Can you 
please tell how you manage, when you have both in one file?

With Regards

Sanjiv Bansal

--- In amibroker@yahoogroups.com, Ed Hoopes reefbreak...@... wrote:

 This is a work-around that I use.  After loading the fundamental data, I run 
 the following script to put the names back to what I like.
 If you haven't done these scripts:
 1. Edit/Save the file as clear text using NotePad or whatever.
 2. Go to FILE - IMPORT ASCII in AB
 3. Navigate to the file  click OPEN
 You're done.
 
 $FORMAT FULLNAME, NAME
 $AUTOADD 1
 $OVERWRITE 1
 $BREAKONERR 1
 PS DynBioTech,PBE
 FTr Biotech,FBT
 iShr Nas BioTech,IBB
 sTr BioTech,XBI
 Hldrs Biotech,BBH
 
 ETC.
 
 ReefBreak
 
 --- In amibroker@yahoogroups.com, gmorlosky gmorlosky@ wrote:
 
  I notice that when I download Fundamental data (Yahoo), the fullname is 
  overwritten. The problem is that the full name for the mutual funds from 
  Yahoo starts with the company and is usually 40 charaters long and so there 
  is no value left in the field to understand which fund it is, as it is 
  restricted to maybe 17 charaters.
  
  Fullname (as I had it)
  FS-Biotechnology
  
  Fullname (after fundamental download)
  FIDELITY SELECT S
  
  Is there a way to restrict this overwriting ?
 





[amibroker] Re: Do all trading systems stop working? - Howard Bandy's book

2009-06-04 Thread brian_z111
Re grey areas in our trading knowledge:


When someone is 'teaching', especially if it is a formal presentation (a book 
or seminar) we tend to mark their ideas, moreso than them, quite harshly, and 
rightly so. When I 'see' that their ideas don't addup or aren't consistent, in 
a certain area, I put up an alert flag and make a mental note to investigate 
this area further because they indicate a 'grey area' in the presenters 
knowledge which more often than not corresponds to a grey area in their field 
of expertise (grey areas == difficult questions to answer definitively).

There are a lot of grey areas in investing/trading and the major ones provide 
us with opportunities for stepped advances, if we can answer them.

I never accept that the hard trading questions don't have an answer in 
nearly every case I have investigated they do and quite a few must have 
answered them but perhaps they don't publish.

Does trading the edge erode the edge is one of the hard questions of trading 
but I am satisfied this forum answered the question, in this discussion, but 
not for everybody ... in some cases the answer was elusive, unpalatable or 
seemed irrelevant etc.



Re confidence:

My mini dictionary defines confidence as,trust; certainty; belief in yourself; 
something told in confidence.

For me 'certainty' is the most apt definition for our use in trading.

Rather than shy away from tradings' grey areas, or whitewash our lack of 
certainty about the answers, we should embrace our ignorance and attack the 
question with gusto.

By observation, followed by postulating and testing, we can move forward.

In TA certainty comes from 100's, 1000's or even 10,000's of observations of 
persistent market behaviour e.g. opening volatility is one thing we can be 
certain about  there are other market events that we can be certain about, 
or that we can be certain will occur with high probabilities, however, only a % 
of them can be exploited, via systems, but some of them will be there for 'my 
forever' == another decade or two (beyond that timeframe the certainty 
diminishes but why worry about trading things that don't concern my trading 
career?).
 



Re: [amibroker] Re: File copying between Win2000 and XP-64 bit.

2009-06-04 Thread Keith McCombs

Mike --
Thanks for your response.  However, it is more complicated than just 
copying the files to the correct directory.  Directory paths are 
embedded in two binary files, broker.newcharts and broker.prefs.


I've sent a request to support and am waiting for an response from them.

Two* bad M$ didn't stick with the name, Program Files, for the 32 bit 
software and Program Files (64) for the 64 bit stuff**.  But what can 
you expect from a company that makes you press the 'Start' button to stop?


-- Keith

*Yes, I know, should be 'too', but somehow 'two' seems more appropriate.
**Or someone in M$ marketing thinks that, somehow, they can sell just a 
little more bloat that way.


Mike wrote:



Look into whatever zip utility you are using and see if it supports 
creating the archive using relative paths.


For example; Using WinRAR you can right click on the AmiBroker folder 
itself and choose Add to archive..., then from the Files tab of the 
resulting dialog make sure that the File Paths field is set to Store 
relative paths. When you click OK, an archive will be created whose 
elements are all rooted at AmiBroker.


You can then unzip the AmiBroker folder directly into the C:\Program 
Files (x86) folder on the other machine. Transferring back would be 
the same process, just select the AmiBroker folder and zip it up, then 
unzip it into the C:\Program Files folder of the original machine.


Mike

--- In amibroker@yahoogroups.com mailto:amibroker%40yahoogroups.com, 
Keith McCombs kmcco...@... wrote:


 New twist on the dual computer question.

 I'm now upgrading my desktop to XP-64 (from Win2000), but still want to
 use the 32bit version of AB. Therefore, on my XP-64 machine, I put
 AmiBroker in folder C:\Program Files (86)\. But this means that when I
 copy all of AmiBroker from C:\Program Files\ on one computer to
 C:\Program Files (86)\ on another or vise versa things get pretty much
 screwed up.

 I've heard that there is a program that will reassign folder names
 within programs, but I don't remember what it is. Does anybody know the
 name and, better yet, has anyone used it successfully?

 Also, I just looked at *HKEY_CURRENT_USER\Software\TJP* in the registry
 and noticed that some paths are stored there. So my thought is to
 change the path for AmiBroker on *both* my Win2000 and XP-64 
machines so

 that long term I can just copy back and forth, without repeatedly
 dealing with the problem. (May also help, if/when I replace my Win2000
 laptop with a new Vista or Windows7 one.)

 Your thoughts and comments will be greatly appreciated.
 -- Keith

 Keith McCombs wrote:
 
 
  I've been doing some experimenting. My Amibroker folder presently
  contains 583,446,650 bytes. It takes more than 15 minutes to 'copy'
  it to an external USB hard drive, and more than 20 minutes to a USB
  thumb drive. However, only about 1.5 minutes to Zip it to the same
  USB thumb drive. (I won't have any numbers for WiFi for awhile yet.)
 
  So, I'm expecting that my DesktopLaptop strategy in the future may
  look something like this:
  On laptop, zip all of Amibroker to file called Amibroker on 
Laptop.zip.

  On desktop, zip all of Amibroker to file called Amibroker on
  Desktop.zip.
  Before switching computers, copy most recent .zip file to 'other'
  computer.
  Extract files from latest .zip into Amibroker folder prior to running
  on 'other' computer.
 
  This should be fast, easy, and safe, even when doing all of Amibroker.
  Added benefit, is backup of both computers on both computers.
  You can limit the zipped files to just the necessary ones. But I'm
  beginning to think it's not worth the effort.
 
  I'll update, when I get some numbers on WiFi, and some history 
doing it.

  -- Keith
 
  Keith McCombs wrote:
 
  Thank you for your replies.
  Dingo --
  Coping all is the easiest and safest, and I should do it, time
  permitting. However, sometimes I'm in a big hurry to get out the
  door and copying 600M+ over WiFi may make me late.
 
  Ed --
  That's the kind of info I was looking for. In fact, all I was
  missing (this time) was broker.newcharts.
 
  What I will probably try to do is set up two batch files to handle
  the problem, CopyABSafe and CopyABHurry.
  Thanks to both of you.
  -- Keith
 
  Ed Hoopes wrote:
 
  I have used the instructions below several times to copy AB to my
  laptop when I travel.
 
  The only problem is that the laptop screen has a different aspect
  ratio, so each of your chart views have to be re-sized and saved.
 
  ReefBreak
 
  AB must be installed on the target machine before you start.
  AB should not be running on either machine, all files should be 
closed.

 
  1. Copy the stocks database folder
  copy c:\YourLocation\US-Stocks to the target computer
  2. Copy the formulas folder
  copy c:\Program Files\AmiBroker\Formulas to the target computer
  3. Copy the broker.newcharts file
  Copy c:\program files\amibroker\broker.newcharts to the target 
computer

  4. Copy the 

[amibroker] Re: Newbie Array / Looping Question

2009-06-04 Thread brian_z111
Median(array, periods)

I assume you are measuring, say ROC(C,1) or similar for % price change.
I guess you just need to get a progressive count, of the number of ROC 
datapoints, to make the function work.

Things to look out for (if the AB function is going to work for you):

- every element in the array you are measuring needs a value (nulls or zeros 
might trip up the math e.g. STDev, mean) ... I guess if you are interested in 
daily bars you will first create a daily ROC(C,1) or ROC of some other point of 
interest from within the bar HL range
- the number of periods, in your array count, is range dependent i.e. in AB it 
can vary with mode ... QuickAFL can be used to change the range (in AA) and 
QickAFL will autoset the range in charts (or might ... I am not the full bottle 
on QuickAFL but there is an article by Tomasz in the AB KnowledgeBase)
- BarsSince type functions might count one less period than you expect ... 
depending if the function is a zerobased count and how you want to use the 
count sometimes I have to add 1 to make the adjustment manually
- BarIndex() is the bar by bar count since the start of the range, where range 
== the range of the database ... AB gets a bit tricky with when and where it 
uses the complete database range as the default  probably to do with fast 
array processing etc ...sometimes I prefer to use Cum(1) as my count ... I seem 
to get more visually stable indicators in the charts because it doesn't 
reference the chart range it references from the start of the database.

- so, making a few assumptions, and if Median works for you as required, 
Median(ROC(C,1),Cum(1)); // because Cum(1) is progressive and counts bars from 
the beginning

- mathematically I find ROC is not as stable as GrowthFactor where ROC == 3% is 
expressed as 1.03

Haven't done it though.

If that doesn't work maybe someone else in the forum knows more.

In case of emergency RVince book two has the maths for median, mode, mean 
interelationships (possibly for advanced, or custom use, you could calculate 
the median from other values) mean == median == mode for normal 
distributions (you should be so lucky!)




--- In amibroker@yahoogroups.com, ics4mer ics4...@... wrote:

 Hi all,
 
 I'm after a general form for doing a particular type of algorithm 
 in AFL - and I'm happy to admit that I might be going about it 
 the totally wrong way...
 
 I am attempting to extract an evolving profile of a stock over 
 time.
 
 Using median as an example, lets say I want calculate the median
 percentage price change for the life of the stock. To give an 
 example:
  
 The 1st trading day - do nothing.
 The 2nd trading day - calc median for 2 days
 The 3rd trading day - calc median for 3 days
 Last traded day - calc median for n days.
 
 For simple functions, I have used a construct similar to;
 for ( i=0; i  BarCount; i++ ){
myArray[ i ] = simpleFunc( i );
.
 }
 
 However, in this case, I would have to write a new median function,
 and this is irritating, since there is a perfectly good one 
 taunting me from the users manual! That's why I suspect that I 
 might be doing something in the wrong way.
 
 Any help or pointers would be much appreciated. A pointer to 
 a message in the user group would be fine too! ( Yes I am still
 trawling through the email group as I write this)
 
 TIA
 
 Robert Z





Re: [amibroker] Re: File copying between Win2000 and XP-64 bit.

2009-06-04 Thread Keith McCombs

Paolo --
It is very simple if you set up your AB that way in the beginning.  
However, I have a lot of work invested in setting up my charts and do 
not want to repeat it.  The coupling of charts to .afl code, along with 
the full path of where the .afl code is, appears to be stored in a 
binary file called broker.newcharts.  There is also a binary file called 
broker.prefs which contains full path information as well.


I have asked support for help on this one.

Thank you.
-- Keith

BTW, I am guessing that having all of AB on a USB thumb drive would 
probably reduce speed significantly.  On one of the new portable hard 
drives like 'PassPort' it might not be too bad.


Paolo Cavatore wrote:



Why don't you simply put your entire AB folder onto a portable USB 
device and connect it to the computer your are using? That's safe, 
easy and doesn't require any copy-paste.


p

--- In amibroker@yahoogroups.com mailto:amibroker%40yahoogroups.com, 
Keith McCombs kmcco...@... wrote:


 New twist on the dual computer question.

 I'm now upgrading my desktop to XP-64 (from Win2000), but still want to
 use the 32bit version of AB. Therefore, on my XP-64 machine, I put
 AmiBroker in folder C:\Program Files (86)\. But this means that when I
 copy all of AmiBroker from C:\Program Files\ on one computer to
 C:\Program Files (86)\ on another or vise versa things get pretty much
 screwed up.

 I've heard that there is a program that will reassign folder names
 within programs, but I don't remember what it is. Does anybody know the
 name and, better yet, has anyone used it successfully?

 Also, I just looked at *HKEY_CURRENT_USER\Software\TJP* in the registry
 and noticed that some paths are stored there. So my thought is to
 change the path for AmiBroker on *both* my Win2000 and XP-64 
machines so

 that long term I can just copy back and forth, without repeatedly
 dealing with the problem. (May also help, if/when I replace my Win2000
 laptop with a new Vista or Windows7 one.)

 Your thoughts and comments will be greatly appreciated.
 -- Keith

 Keith McCombs wrote:
 
 
  I've been doing some experimenting. My Amibroker folder presently
  contains 583,446,650 bytes. It takes more than 15 minutes to 'copy'
  it to an external USB hard drive, and more than 20 minutes to a USB
  thumb drive. However, only about 1.5 minutes to Zip it to the same
  USB thumb drive. (I won't have any numbers for WiFi for awhile yet.)
 
  So, I'm expecting that my DesktopLaptop strategy in the future may
  look something like this:
  On laptop, zip all of Amibroker to file called Amibroker on 
Laptop.zip.

  On desktop, zip all of Amibroker to file called Amibroker on
  Desktop.zip.
  Before switching computers, copy most recent .zip file to 'other'
  computer.
  Extract files from latest .zip into Amibroker folder prior to running
  on 'other' computer.
 
  This should be fast, easy, and safe, even when doing all of Amibroker.
  Added benefit, is backup of both computers on both computers.
  You can limit the zipped files to just the necessary ones. But I'm
  beginning to think it's not worth the effort.
 
  I'll update, when I get some numbers on WiFi, and some history 
doing it.

  -- Keith
 
  Keith McCombs wrote:
 
  Thank you for your replies.
  Dingo --
  Coping all is the easiest and safest, and I should do it, time
  permitting. However, sometimes I'm in a big hurry to get out the
  door and copying 600M+ over WiFi may make me late.
 
  Ed --
  That's the kind of info I was looking for. In fact, all I was
  missing (this time) was broker.newcharts.
 
  What I will probably try to do is set up two batch files to handle
  the problem, CopyABSafe and CopyABHurry.
  Thanks to both of you.
  -- Keith
 
  Ed Hoopes wrote:
 
  I have used the instructions below several times to copy AB to my
  laptop when I travel.
 
  The only problem is that the laptop screen has a different aspect
  ratio, so each of your chart views have to be re-sized and saved.
 
  ReefBreak
 
  AB must be installed on the target machine before you start.
  AB should not be running on either machine, all files should be 
closed.

 
  1. Copy the stocks database folder
  copy c:\YourLocation\US-Stocks to the target computer
  2. Copy the formulas folder
  copy c:\Program Files\AmiBroker\Formulas to the target computer
  3. Copy the broker.newcharts file
  Copy c:\program files\amibroker\broker.newcharts to the target 
computer

  4. Copy the Layouts folder
  Copy c:\Program files\Amibroker\Layouts to the target computer
  5. Copy the Watchlist files
  copy c:\yourlocation\*.tls to the target computer
 
  --- In amibroker@yahoogroups.com 
mailto:amibroker%40yahoogroups.com

  mailto:amibroker%40yahoogroups.com, dingo waledingo@ wrote:
  
   why wouldn't you just copy the enitre AB directory over?
  
   d
  
   On Tue, May 12, 2009 at 6:30 PM, Keith McCombs kmccombs@wrote:
  
I like to have my desktop and laptop computers match as far as
  Amibroker
is concerned. 

[amibroker] Re: Newbie Array / Looping Question

2009-06-04 Thread brian_z111
I am not sure about this one now ... I think we need some help from the 
code/maths experts.

Median() doesn't appear to accept an array as input (the manual doesn't say one 
way or another?) ... it might be demanding a constant (that wouldn't surprize 
me since mean/mode/median are moments of a distribution so massive calcs might 
be required to find them for skewed dists without having the distriution at 
hand) ... AB doesn't do that distributions off the shelf ... not AFAIK.

I think you can calc Skewness from N, StDev, arithmetic mean etc ... once you 
have S you can back calc the Median or the Mode from the Mean and the StDev.

Another brute method might be an algorithmic trial and error test for the Mode 
(loops required)... I forget what it is called in programming but if the value 
to the right of the mean has a higher frequency than the mean value the mode is 
somewhere to the right .. by halving the range between the freq test you will 
zero in on the mode and then you can calc the median by using the mean and mode 
values. AFAIK array processing will always be more timely than looping 
though.


--- In amibroker@yahoogroups.com, brian_z111 brian_z...@... wrote:

 Median(array, periods)
 
 I assume you are measuring, say ROC(C,1) or similar for % price change.
 I guess you just need to get a progressive count, of the number of ROC 
 datapoints, to make the function work.
 
 Things to look out for (if the AB function is going to work for you):
 
 - every element in the array you are measuring needs a value (nulls or zeros 
 might trip up the math e.g. STDev, mean) ... I guess if you are interested in 
 daily bars you will first create a daily ROC(C,1) or ROC of some other point 
 of interest from within the bar HL range
 - the number of periods, in your array count, is range dependent i.e. in AB 
 it can vary with mode ... QuickAFL can be used to change the range (in AA) 
 and QickAFL will autoset the range in charts (or might ... I am not the full 
 bottle on QuickAFL but there is an article by Tomasz in the AB KnowledgeBase)
 - BarsSince type functions might count one less period than you expect ... 
 depending if the function is a zerobased count and how you want to use the 
 count sometimes I have to add 1 to make the adjustment manually
 - BarIndex() is the bar by bar count since the start of the range, where 
 range == the range of the database ... AB gets a bit tricky with when and 
 where it uses the complete database range as the default  probably to do 
 with fast array processing etc ...sometimes I prefer to use Cum(1) as my 
 count ... I seem to get more visually stable indicators in the charts because 
 it doesn't reference the chart range it references from the start of the 
 database.
 
 - so, making a few assumptions, and if Median works for you as required, 
 Median(ROC(C,1),Cum(1)); // because Cum(1) is progressive and counts bars 
 from the beginning
 
 - mathematically I find ROC is not as stable as GrowthFactor where ROC == 3% 
 is expressed as 1.03
 
 Haven't done it though.
 
 If that doesn't work maybe someone else in the forum knows more.
 
 In case of emergency RVince book two has the maths for median, mode, mean 
 interelationships (possibly for advanced, or custom use, you could calculate 
 the median from other values) mean == median == mode for normal 
 distributions (you should be so lucky!)
 
 
 
 
 --- In amibroker@yahoogroups.com, ics4mer ics4mer@ wrote:
 
  Hi all,
  
  I'm after a general form for doing a particular type of algorithm 
  in AFL - and I'm happy to admit that I might be going about it 
  the totally wrong way...
  
  I am attempting to extract an evolving profile of a stock over 
  time.
  
  Using median as an example, lets say I want calculate the median
  percentage price change for the life of the stock. To give an 
  example:
   
  The 1st trading day - do nothing.
  The 2nd trading day - calc median for 2 days
  The 3rd trading day - calc median for 3 days
  Last traded day - calc median for n days.
  
  For simple functions, I have used a construct similar to;
  for ( i=0; i  BarCount; i++ ){
 myArray[ i ] = simpleFunc( i );
 .
  }
  
  However, in this case, I would have to write a new median function,
  and this is irritating, since there is a perfectly good one 
  taunting me from the users manual! That's why I suspect that I 
  might be doing something in the wrong way.
  
  Any help or pointers would be much appreciated. A pointer to 
  a message in the user group would be fine too! ( Yes I am still
  trawling through the email group as I write this)
  
  TIA
  
  Robert Z
 





[amibroker] Including externale AB file.

2009-06-04 Thread Dimension
Hi,
is it possible to link reusable AFL code that are stored in a file of there 
own, into other AFL scripts?



[amibroker] Re: Including externale AB file.

2009-06-04 Thread brian_z111
# include

Put it at the head of your AFL script.
Does that help?


--- In amibroker@yahoogroups.com, Dimension dimensi...@... wrote:

 Hi,
 is it possible to link reusable AFL code that are stored in a file of there 
 own, into other AFL scripts?





[amibroker] Re: Including externale AB file.

2009-06-04 Thread Mike
See #include_once
http://www.amibroker.com/guide/afl/afl_view.php?name=%23include_once

Mike

--- In amibroker@yahoogroups.com, Dimension dimensi...@... wrote:

 Hi,
 is it possible to link reusable AFL code that are stored in a file of there 
 own, into other AFL scripts?