Adjusted Close and Past Signals Changing

The notion of Yahoo Finance's Adjusted Close and its advantages in back-testing seem clear enough to me. But I'm not sure what to think about one behavior I've seen.

You can implement an AFL indicator and start following it, watching for the Buy and Sell signals. You might choose (as I do) to check it once a week, downloading new historical data whenever you do.

But what happens sometimes is that past signals can change. Maybe in one week, a Sell signal appeared on 12/2 at a certain Close value. Then another week or two go buy, but with the new historical data, perhaps that Sell signal now appears on 12/9, at a slightly different Close value.

I think this is happening because the security gets an action which affects Adjusted Close, maybe a dividend payout or something. That causes the numerical values processed by the indicator to change. And sometimes they can change enough to alter the date of a past signal.

This doesn't indicate any problem with AmiBroker or AmiQuote. I think it's just in the nature of what can happen with Adjusted Close values. But I find it disconcerting. I would feel better if, once a signal appeared, it always looked the same afterwards in the historical record. But that's not the behavior I see.

I think using Adjusted Close values is proper for what I need to do. But there's a feeling of randomness that comes with this that makes me uncomfortable. And I don't know how to address that.

If anyone has any suggestions would love to hear them.

Make your own record of trades, with a unique identifier. As part of the identifier, include stuff like instrument, DateTime, order type, order DateTime, order price, fill price/prices et al.

Then as a robust price "marker" use a percentage of that particular Daily Bar and/or particular infra-day bar. For example a trade or exit price was precisely at the 50% point of that particular bar's range, it will yield an entry price. If for whatever reason there is a corporate adjustment or a roll (for continuous back-adjusted futures) you can "Re-adjust" the entry or exit price.

You might consider NOT adjusting for dividends. The main reason for problems is dividend adjustment, not split adjustment (unless your code uses absolute values for triggers).

You can download unadjusted prices by modifying aqh.format file as explained in the Knowledge Base.

1 Like

in general if you are live trading with the use of a data source, it is a good idea to keep your trades documented, in case of disappearing signal due to faulty data source

I do two things

  1. a notificaion script for disappearing signals after each run of my analysis
  2. Include the signals from the past into the buy/sell/short/cover variables so that live system is still in sync ( so that next signal will be processed correctly)

an implementation below that I use to keep Buy variable in sync (there might be better ways to do it, but the below works for me)

my latest live positions are documented in a file stat'StockName'.csv

//Buy/Sell/Short/Cover logic here
//statQQQ.csv looks like below, will always have one entry with latest position
//QQQ,17/12/2022 10:14:59,250
//-------------------signal disappear
_N( list = fdir( "C:\\IB\\NQSwing1\\stat*.csv", 1 ) ); 
for ( i = 0; ( filename = StrExtract( List, i ) ) != ""; i++ ) 
    printf( filename + " " ); 

filename1="C:\\IB\\NQSwing1\\" + filename1;

fh = fopen( filename1, "r"); 
fh1 = fopen( "C:\\IB\\NQSwing1\\ErrorDisappearing.txt", "a"); 
if( fh )    // get live quantity in this if 
   while( ! feof( fh ) ) 
      line = fgets( fh );
      printf(  line);   
        if( StrFind( line, "," ))
            dateandtime = StrExtract( line, 1 );
            datefield = StrExtract( dateandtime, 0, ' ' );
            timefield = StrExtract( dateandtime, 1, ' ' );
            //datefield = StrExtract( datefield, 2, '/' ) + StrExtract( datefield, 1, '/' ) + StrExtract( datefield, 0, '/' );
            datefield = NumToStr(10000*(StrToNum(StrExtract( datefield, 2, '/' ))-1900) + 100*(StrToNum(StrExtract( datefield, 1, '/' ))) + StrToNum(StrExtract( datefield, 0, '/' )),1.0,false);
            timefield = StrExtract( timefield, 0, ':' ) + StrExtract( timefield, 1, ':' ) + StrExtract( timefield, 2, ':' );
            quantity1 = (StrExtract( line, 2 ));
            qs = StrFormat(" %.0f", 
                     LastValue(TimeNum()) ); 
            //fputs( qs, fh1 );//timenum 
            //fputs(" ",fh1);
            //fputs(datefield,fh1); fputs(timefield,fh1) ;  fputs(quantity1,fh1);
            quantity = StrToNum(quantity1);
   printf("ERROR: file can not be found (does not exist)"); 

if(quantity > 0)
	   if(d[i] <= StrToNum(datefield) && t[i] < StrToNum(timefield)) {break;} // dont look any further
           if(d[i] == StrToNum(datefield) && t[i] == StrToNum(timefield))
               if (sell[i]==true) // exit loop, since there is exit signal and will be processed anyway even if from past

               if (Buy[i]==False)
                   fputs("found disappearing bar",fh1);
                   fputs("signal gone",fh1);
Buy = Buy OR signalattimelong;

1 Like

Good thoughts here. Thanks, folks.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.