#
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Home
Forex Forum
+ Add Script
Metastock
Expert Advisors
Explorations
Indicators
Trading Systems
Metatrader
MQL Experts
MQL Indicators
MQ4 Experts
MQ4 Indicators
MQ4 Scripts
Tradestation
Functions
Indicators
PaintBars
ShowMe
Trading Systems
Amibroker
Commentaries
Explorations
Functions
Indicators
Trading Systems
Contact us
Newsletter
Group: Metatrader MQL Indicators
Title: Spikes
Description:
Search of "thorns". Bars-thorns are marked by a tick
/*[[ Name := Spikes Author := Copyright © 2002, Company Link := http://www.company.com/ Notes := Search of thorns Update on every tick := No Enable Alerts := No Disable alert once hit := No Lots := 1 Stop Loss := 0 Take Profit := 0 Trailing Stop := 0 ]]*/ /* PARAMETERS: nK - factor of an eminence of a thorn above the next bars nAdtrFor - an average true range raschityvat' for this period (kol-in bars) nCloseLevel - koef. uroven'a closings. Should be low / high for thorns upwards / downwards nHighest - rise / recession of a trend for nHighest bars */ Variable: nCurBar(1), nADTR(0), nRealMax(0), nRealMin(0), nBars(0); Variable: i(0), i1(0), nCompare(0), nComparedBar(0); Define: nK(0.75), nAdtrFor(10), nCloseLevel(3), nHighest(50); Define: nExit(0); If nExit = 1 Then Exit; nExit = 1; // Search of a bar with the big difference in comparison with next nBars = Bars-nAdtrFor-1; nComparedBar = 1; // ***** Search of Thorns Upwards For i=2 to nBars-1 { // -----Calculation ADTR - a difference between the next bars nADTR = 0; For i1=1 to nAdtrFor { // True range nComparedBar = i+i1; If High[nComparedBar] > Close[nComparedBar+1] Then nRealMax = High[nComparedBar] Else nRealMax = Close[nComparedBar+1]; If Low[nComparedBar] < Close[nComparedBar+1] Then nRealMin = Low[nComparedBar] Else nRealMin = Close[nComparedBar+1]; nADTR = nADTR + (nRealMax - nRealMin); }; nADTR = nADTR / nAdtrFor; nCompare = nADTR * nK; // The suitable difference is found? If (High[i] - High[i-1]) < nCompare or (High[i] - High[i+1]) < nCompare Then { Continue; }; // ----- Check of a level of closing of the found peak If High[i]-Close[i] < nCloseLevel*(Close[i]-Low[i]) Then { Continue; }; // ----- Comparison current maks. With the previous maxima: there should be a big rise of the prices before a thorn If High[i] <= High[Highest(MODE_HIGH, i+nHighest+1, nHighest)] Then { Continue; }; // ***** The thorn is found //Print("Spike UP found: ", High[i]); SetArrow(Time[i], High[i], 218, Red); }; // ***** Search of Thorns Downwards For i=2 to nBars-1 { // ----- Calculation ADTR - a difference between the next bars nADTR = 0; For i1=1 to nAdtrFor { // True range nComparedBar = i+i1; If High[nComparedBar] > Close[nComparedBar+1] Then nRealMax = High[nComparedBar] Else nRealMax = Close[nComparedBar+1]; If Low[nComparedBar] < Close[nComparedBar+1] Then nRealMin = Low[nComparedBar] Else nRealMin = Close[nComparedBar+1]; nADTR = nADTR + (nRealMax - nRealMin); }; nADTR = nADTR / nAdtrFor; nCompare = nADTR * nK; // The suitable difference is found? If (Low[i-1] - Low[i]) < nCompare or (Low[i+1] - Low[i]) < nCompare Then { Continue; }; // ----- Check of a level of closing of the found peak If Close[i]-Low[i] < nCloseLevel*(High[i]-Close[i]) Then { Continue; }; // ----- Comparison current minutes with the previous minima: there should be a big recession of the prices before a thorn If Low[i] >= Low[Lowest(MODE_LOW, i+nHighest+1, nHighest)] Then { Continue; }; // ***** The thorn is found //Print("Spike DOWN found: ", Low[i]); SetArrow(Time[i], Low[i], 217, Red); }; Print("Searching spikes is done"); Exit;
Author/Source:
?
Forex Directory
|
Forex Trading Systems
|
Privacy
|
Disclaimer
|
Contact