Decided instead of looking for existing solutions on my HDs to add an spike
suppression auto adjustment. This allows toggling between auto and manual
spike suppression. The default is set for manual, but can of course be
changed to auto. 

 

There are several ways to use those two modes. Personally I would start with
the manual adjustment and then step thru the data. This has the advantage
that you see where the suspect data are located and then toggle to auto
mode. If there are a lot of spikes, one change to the auto mode, and toggle
to the manual mode to see what the original data look like.

 

//==============Spike Suppression: Manual and Auto
Suppression=============================

Title = EncodeColor(4)+ _DEFAULT_NAME()+";  "+EncodeColor(1) +
StrFormat("{{NAME}} - {{INTERVAL}}; {{DATE}}; 

O=%g, H=%g, L=%g, C=%g (%.1f%%) 

{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) );      

Auto_ManualSel=ParamToggle("Spike Suppression","Manual|Auto",0);// Default:
manual

ScaleAdjFactHigh=Param("Manual Scale Adjust-High",1,0.9,1,0.0001);// Forex
values; Manual

ScaleAdjFactLow=Param("Manual Scale Adjust-Low",1,1,1.1,0.0001);// Forex
values; Manual

ScaleAdjFact=Param("Auto ScaleAdjFact",2,1.5,5,0.1);

//===============Manual Selection====================

if(!Auto_ManualSel)//Select Manual

{

Hmax=HighestVisibleValue(H);

LMin=LowestVisibleValue(L);

Plot(C,"C",1,styleOwnScale|64,LMin*ScaleAdjFactLow,Hmax*ScaleAdjFactHigh);

}

//===============Auto Selection====================

if(Auto_ManualSel)//Select Auto

{

ATRPer=Param("ATRPer",14,1,50,1);

fvb = Status("firstvisiblebar"); 

lvb = Status("lastvisiblebar"); 

for( i = fvb; i <= Lvb; i++ ) 

{ 

H=IIf(H>Ref(H,-1)*(1+ScaleAdjFact*ATR(ATRPer)),Ref(H,-1),H);

L=IIf(L<Ref(L,-1)*(1-ScaleAdjFact*ATR(ATRPer)),Ref(L,-1),L);

} 

Plot(C, "Price", colorBlack, 64 ); 

}

 

 

 

 

From: amibroker@yahoogroups.com [mailto:amibro...@yahoogroups.com] On Behalf
Of Joris Schuller
Sent: Saturday, December 05, 2009 6:13 PM
To: amibroker@yahoogroups.com
Subject: RE: [amibroker] Trimming yahoo data bars from abnormally long to
reasonable size-How can we ?

 

  

The simplest solution is to adjust manually using the simple code below. I
prefer manually because I want to see which data are adjusted and which data
are real.  I have generated some dynamically adjusting alternatives.  About
5 years ago when IqFeed data were somewhat noisy I tested and submitted to
AB 5 different approaches of spike suppression to resolve  the problem. More
than 6 months later Solution no 5( using deviation from ATR) was implemented
in the menu). Don't know whether it is still there since I don't use IQFeed
at the moment. I still have all the solutions somewhere on one of my hard
drives and if I can find them I will send them.  

 

Incidentally the selected solution was the one I only submitted for
completeness and to pacify those who like to dabble in statistics (typically
non-scientists). This is about statistics, but of removing spikes that
prevent me from looking at the rest of the data. Whether the spikes are
statistically significant or not is irrelevant, since in all cases they mask
the surrounding data and thus have to be suppressed.

 

ScaleAdjFactHigh=Param("ScaleAdjFactHigh",1,0.9,1,0.0001);// Forex values; 

ScaleAdjFactLow=Param("ScaleAdjFactLow",1,1,1.1,0.0001);// Forex values;

 

Hmax=HighestVisibleValue(H);

LMin=LowestVisibleValue(L);

Plot(C,"C",1,styleOwnScale|64,LMin*ScaleAdjFactLow,Hmax*ScaleAdjFactHigh);

 

 

 

From: amibroker@yahoogroups.com [mailto:amibro...@yahoogroups.com] On Behalf
Of rvlv
Sent: Saturday, December 05, 2009 9:49 AM
To: amibroker@yahoogroups.com
Subject: [amibroker] Trimming yahoo data bars from abnormally long to
reasonable size-How can we ?

 

  


Hi afl experts and experienced coding specialists,

Please few minutes to address this problem that most Amibroker uses face.

summary
people use Amiquote and download stockdata on intraday,daily timeframes into
a separate database.
Then they like to apply certain pattern recognition afl on this data.
The formula does not give proper results.
Reason?
yahoo gives some times once in a while,an abnormal bar that is say 10 times
linger than normal bars. Once these oddsized bars appear, the newbies are in
confusion,pattern detection or following established simple trading rules
becomes not anymore possible.

There must be a simple solution to trim the oddsized abnormal bar using an
automatic trimming afl program.

My humble request to experts like Graham kavanagh(with whose educating afls
we learntr to make our baby steps),Herman,who gives very useful hints that
save lot of troubles,and many other generous 
people like Mike,droskill,reinsley etc,who are willing to help always,
please give us a helping hand to deal with this problem.

One can say HEY MAN, Yahoo makes this odd sized data bars and they are least
bothered about quality. Why dont you buy some paid data?
My answer is just think about guys who wish to spend for paid broker data
once they cross the loosers hell zone(mostly they get losses and still
struggling).
My point is whatever yahoo gives, I manage by trimming data at my end.
Please accept my gratitude in advance for your help.

regards
rvlv



<<image001.gif>>

<<image002.gif>>

Reply via email to