我想让30分时图上短期均线向上时,在分时图5上只显示向上箭头,
+n|@'= ] 30分时图上短期均线向下时,在分时图5上只显示向下箭头,
lhF)$M 我试编了不会显示,请老师版主修改:
2(Nf$?U@0 //+------------------------------------------------------------------+
,u.A[{@py //| MAcross.mq5 |
$ Vsf?ID //|Copyright 2009, MetaQuotes Software Corp. |
/J&_ZDNV~ //|
http://www.mql5.com |
[iN\R+: //+------------------------------------------------------------------+
4/&.N] #property copyright "2009, MetaQuotes Software Corp."
VQ4rEO=t #property link "http://www.mql5.com"
%){) /~e& #property version "1.00"
=o4McV} #property indicator_chart_window
? UBE0C #property indicator_buffers 6
%r:Uff@ #property indicator_plots 6
ZJ|&t //---- plot long
]hY4
MS 1K{hj% #property indicator_label1 "up"
"'U]4Z%q! #property indicator_type1 DRAW_ARROW
~G8haN4 #property indicator_color1 Red
A{\!nq_~N #property indicator_style1 STYLE_SOLID
o1rH@ D6/- #property indicator_width1 1
wZ~eE'zx+ #property indicator_label2 "down"
vA0f4W 8+ #property indicator_type2 DRAW_ARROW
cK1RmL"3 #property indicator_color2 MediumBlue
@s~*>k#"# #property indicator_style2 STYLE_SOLID
hbTJXP~~? #property indicator_width2 1
G'6f6i|<I@ ya/pn
qS #property indicator_label3 "long"
,IQ%7*f;O_ #property indicator_type1 DRAW_NONE
^uWj# #property indicator_label4 "small"
=1% < #property indicator_type2 DRAW_NONE
, @dhJ8/ #property indicator_label5 "longh"
zZ{(7Kfz #property indicator_type1 DRAW_NONE
3Vb/Mn!k #property indicator_label6 "smallh"
lhduK4u #property indicator_type2 DRAW_NONE
F}=O Mo:. //---- plot down
(c1Kg K8|>" c~ EMMp4KKOx+ 8Hh=Sp^ //--- input parameters
eAbp5}B input int MA1=10,MA2=20;
udGZ%Mr_ input int MAH1=20,MAH2=60;
s!\Gi5b //--- indicator buffers
5r(Y,m"? double ma1[],ma2[],mah1[],mah2[];
qBXIR} C9"yu&l double upBuffer[];
fGMuml?[ e double downBuffer[];
>J_%'%%f int m1,m2,mh1,mh2;
6SN$El 0|G %] [6TZ} //+------------------------------------------------------------------+
&Y|AX2KUC //| Custom indicator initialization function |
W"ldQ //+------------------------------------------------------------------+
s.9_/cFWB int OnInit()
L(w?.)E {
w>uo-88 //--- indicator buffers mapping
h\PybSW4s Jyo(Etp SetIndexBuffer(0,upBuffer,INDICATOR_DATA);
9Jj:d)E>o SetIndexBuffer(1,downBuffer,INDICATOR_DATA);
L|A.;Gq PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_ARROW);
N(=\S: PlotIndexSetInteger(1,PLOT_DRAW_TYPE,DRAW_ARROW);
}D7} %P] PlotIndexSetInteger(0,PLOT_ARROW,1001);
]aTF0 R PlotIndexSetInteger(1,PLOT_ARROW,1002);
66%4p%#b4 QTT2P(Pz bA8RoC SetIndexBuffer(2,ma1,INDICATOR_DATA);
Lc5I?}:;L SetIndexBuffer(3,ma2,INDICATOR_DATA);
5;_&C=[ SetIndexBuffer(4,mah1,INDICATOR_DATA);
6h3TU,$r SetIndexBuffer(5,mah2,INDICATOR_DATA);
p{S#>JTr m1=iMA(Symbol(),PERIOD_M5,MA1,0,MODE_SMA,PRICE_CLOSE);
V/W{d[86G m2=iMA(Symbol(),PERIOD_M5,MA2,0,MODE_SMA,PRICE_CLOSE);
E{W(5.kb;i mh1=iMA(Symbol(),PERIOD_M30,MAH1,0,MODE_SMA,PRICE_CLOSE);
URb mh2=iMA(Symbol(),PERIOD_M30,MAH2,0,MODE_SMA,PRICE_CLOSE);
7zEpuw //---
2X!!RS>qg return(0);
1G62Qu$O }
VH2/ //+------------------------------------------------------------------+
FErKr) //| Custom indicator iteration function |
k*Vf2O3${ //+------------------------------------------------------------------+
9_I#{? int OnCalculate(const int rates_total,
$mZpX:7/u8 const int prev_calculated,
hD!9[Gb const datetime& time[],
@#W$7Gwf0 const double& open[],
Sw^-@w=!U5 const double& high[],
U)y~{E~c34 const double& low[],
r]'Q5l4j6" const double& close[],
Q]NGd 0 J const long& tick_volume[],
RFzMah?Q=j const long& volume[],
WA&&*ae5` const int& spread[])
:U$U:e {
baL-~`(T int malong=CopyBuffer(m1,0,0,rates_total,ma1);
O)i]K`jk int masmall=CopyBuffer(m2,0,0,rates_total,ma2);
#m<<]L(o8W int malongh=CopyBuffer(mh1,0,0,rates_total,mah1);
\r+8}8 int masmallh=CopyBuffer(mh2,0,0,rates_total,mah2);
byUz for(int i=10;i
3x{2Dh i
{ ]A2l%V_7
if((ma1[i-1]>ma2[i-1])&&(ma1&&mah1[1]>mah1[2])) zxr|:KC ?&
{ ugI9rxT]Kv
upBuffer=ma2; 3_]<H<w
if(i==prev_calculated) 7~V,=WEe
{Alert("up");} Q/,jv5
} :z!N_]t
if((ma1[i-1]>ma2&&mah1[1] 0`
{6~p
{ V~uH)IMkh7
downBuffer=mah2; %;E/{gO
if(i==prev_calculated) @L-3&~=
{Alert("down");} R`F54?th
} hZ0CnY8 '
} DUk&`BSJ
//--- p. eq
N
//--- return value of prev_calculated for next call 93-UA.+g
return(rates_total); n4cM
/unU
} UvSvgDMl
//+------------------------------------------------------------------+