Yesterday's EOD data had tons of weird high and lows which completely messed up charts. Since the affected charts were in hundreds, I wrote a quick AFL to clean up the data.
Logic is simple... the close is the only sacrosanct data you can get in any exchange. Using yesterday's close as open for today, the AFL takes these values and creates the high and low for the day.
The results are then exported to a csv file and imported into Amibroker.
Here is the AFL.
>>>
Filter=1;
AddColumn(Ref(C,-1),"open",1.2); // yesterday's close is today's open
AddColumn(IIf(C>Ref(C,-1),C,Ref(C,-1)),"hi",1.2); // sets the high for the day
AddColumn(IIf(C>Ref(C,-1),Ref(C,-1),C),"lo",1.2); // sets the low for the day
AddColumn(C,"close",1.2); // this is final close
AddColumn(V,"vol",1.2);
Logic is simple... the close is the only sacrosanct data you can get in any exchange. Using yesterday's close as open for today, the AFL takes these values and creates the high and low for the day.
The results are then exported to a csv file and imported into Amibroker.
Here is the AFL.
>>>
Filter=1;
AddColumn(Ref(C,-1),"open",1.2); // yesterday's close is today's open
AddColumn(IIf(C>Ref(C,-1),C,Ref(C,-1)),"hi",1.2); // sets the high for the day
AddColumn(IIf(C>Ref(C,-1),Ref(C,-1),C),"lo",1.2); // sets the low for the day
AddColumn(C,"close",1.2); // this is final close
AddColumn(V,"vol",1.2);
<<<
NOTE: this is to be used only in the rarest of rare cases.
No comments:
Post a Comment