#property indicator_chart_window
2 ?/ {' i" y) k& v6 ]( C4 t( f# _+ k#property indicator_buffers 2
* t5 n' U# M) J2 H#property indicator_color1 Blue
1 W& ]3 ~) W, g#property indicator_color2 Red
% ]8 Q7 ]$ A: [6 n% P: E1 Xextern bool 声音开关=1;* n- i, J6 n. p. W4 y
extern int rsi周期 = 14;( _1 r4 e; S# }8 z' C9 m
extern int rsi报警数值1 = 70;
8 W& i& [: P! Z4 d" Zextern int rsi报警数值2 = 30;
. [- N% Q% Z0 J. P2 `0 m8 N! \5 t
! c& W( Z8 I. J1 Y, L+ {% e$ Fdouble buy[], sell[];
2 [: z# V5 G: u& I. T+ K2 Q( w6 s+ v, \
4 M% V# U2 T9 i6 \+ nint init()5 }' s6 x% p0 n9 j' ~
{
9 z* _$ O) L8 S6 b2 E* y5 X//---- indicators6 T4 a- D) h- A/ X: `
SetIndexStyle (0, DRAW_ARROW, EMPTY, 1);! F, ?) t1 ]; n8 w
SetIndexArrow (0, 233); l& B% D: G: v3 ^& I
SetIndexBuffer (0, buy);
* v* N) A' @" V) m9 q SetIndexEmptyValue (0, 0.0);
* `9 G# m4 g+ A3 V5 f+ p2 y SetIndexStyle (1, DRAW_ARROW, EMPTY, 1);
3 q% o6 c d1 ]' v SetIndexArrow (1, 234);
* y6 v4 q: l. f" h! ?! l SetIndexBuffer (1, sell);% t: w' G3 b' r6 z0 U: r
SetIndexEmptyValue (1, 0.0); # {. U: k7 ]% R
6 Z$ Q. ?6 ] `( ?, r8 u+ F* u# V# @6 d//----7 F; }* f/ {, [" a! |" h) M
return(0);
@2 I0 G. g- O: a5 e0 k}0 d( S1 \. n! V2 V
( w. v d* J' f0 E q
int start()4 J0 a8 P& e1 v: b3 T8 k
{2 `$ N: {7 |3 x6 o: }
static int LastAlert = 0;
. M- r, q7 ]6 R8 M0 m7 P0 ` string CurSymbol=Symbol();9 l! b! o0 u' s8 d. K
string Sound1 = "alert.wav";4 G {/ V. v9 c* p3 z$ |. U
string Sound2 = "alert2.wav";
% }+ G6 K& C2 ` double rsi0;$ Z: \8 V! ^1 b! i* y( E
if (声音开关!=0)
3 y F" V( F( f/ |// for (int i = Bars - 1; i >= 0; i --)
; k+ f; f3 ]: L# Y6 ~6 c5 N8 M7 f {9 B9 v. e% Y% H+ A: P! P* |
rsi0 = iRSI(NULL, 0, 14, PRICE_CLOSE, Bars );
- K. A! z( _. O; v8 c% q% m if ( rsi0>(rsi报警数值1-1)&&rsi0<(rsi报警数值1+1))
: Q b( B% o- T {
+ P; M. @- o# }+ ~! ~9 f s/ P* _ if( LastAlert == 0 || LastAlert < Bars )
7 ]# p' ^- v% `& F5 _: }5 _2 G {
; j. m: i5 P4 X PlaySound(Sound1);
4 d( A& _/ w6 }& N Sleep(2000);) a! @: S) f9 R, l) l, E
}! P+ m2 j; ] p# m
LastAlert = Bars; % ^9 W, x1 g% \0 _/ D
} ) X! w+ v- e0 U V; Q
if (rsi0>(rsi报警数值2-1)&&rsi0<(rsi报警数值2+1))
, d+ V; G9 N: V; v { 5 w2 y2 F: p5 K) Y$ B$ _1 t- P4 v% U
if( LastAlert == 0 || LastAlert < Bars )
- f$ P& c! @$ e# O { 1 [ E. w3 G* O, p3 C$ T* `6 J
PlaySound(Sound2);
' I! _8 a) D7 S+ j Sleep(2000);3 e+ }8 ?4 p, w7 E; e" k
}
( H! W& e6 d( V LastAlert = Bars; 2 m( [$ }2 \$ D" Z- p
} " b, [+ S* w) w) R
}: a8 S" ~5 j! s3 |' d
}
- @7 _) Z: V! D4 y7 D$ B2 C' G1 s* P" R( C) y6 f& y
非常感谢,我尝试修改, 但好像不工作,你能帮我看看吗?