我想让30分时图上短期均线向上时,在分时图5上只显示向上箭头,
lR[[]Yn 30分时图上短期均线向下时,在分时图5上只显示向下箭头,
t%Hg8oya 我试编了不会显示,请老师版主修改:
j\&
` //+------------------------------------------------------------------+
I$!rNfrs //| MAcross.mq5 |
*YmR7g |k //|Copyright 2009, MetaQuotes Software Corp. |
FJo?~ //|
http://www.mql5.com |
"8}p>gS //+------------------------------------------------------------------+
jp=z
^l #property copyright "2009, MetaQuotes Software Corp."
-7E)u #property link "http://www.mql5.com"
xgoG>~F #property version "1.00"
d%+oCoeb #property indicator_chart_window
OpFe=1Q #property indicator_buffers 6
.*FBr7rE\ #property indicator_plots 6
Hq<Sg4nz //---- plot long
."`mh&+` `FS)i7-o6 #property indicator_label1 "up"
Nf@-i` #property indicator_type1 DRAW_ARROW
,orq*Wd #property indicator_color1 Red
R1,.H92 #property indicator_style1 STYLE_SOLID
w_gFN%8 #property indicator_width1 1
pt/UY<@yoN #property indicator_label2 "down"
m=m T`EP #property indicator_type2 DRAW_ARROW
rnOg;|u8 #property indicator_color2 MediumBlue
kzkrvC+u #property indicator_style2 STYLE_SOLID
*A^`[_y #property indicator_width2 1
-22]|$f -J6G=+s/ #property indicator_label3 "long"
/N8>>g #property indicator_type1 DRAW_NONE
2{Johqf #property indicator_label4 "small"
L,/(^0; #property indicator_type2 DRAW_NONE
`zP{E T_Y #property indicator_label5 "longh"
\'Z^rjB #property indicator_type1 DRAW_NONE
S)\Yc=~h #property indicator_label6 "smallh"
LcW:vV|'K #property indicator_type2 DRAW_NONE
sKniqWi //---- plot down
o/\f+iz7 "V>p 5 `A^"}0 uD8,E!\ //--- input parameters
!McRtxq?~ input int MA1=10,MA2=20;
m-AW}1:\f input int MAH1=20,MAH2=60;
wdLlQD //--- indicator buffers
`\M}~ double ma1[],ma2[],mah1[],mah2[];
x!;;;iS i564<1`x double upBuffer[];
@*"H{xo.U double downBuffer[];
1qN+AT int m1,m2,mh1,mh2;
j=y{ey7Fd x)OJ?l //+------------------------------------------------------------------+
y6`zdB //| Custom indicator initialization function |
pL pBP+i //+------------------------------------------------------------------+
qJq!0F int OnInit()
P-)`FB {
f\h|Z*Bv
//--- indicator buffers mapping
xY$@^(Q\ &l
_NCo2 SetIndexBuffer(0,upBuffer,INDICATOR_DATA);
*4?%Y8;bF6 SetIndexBuffer(1,downBuffer,INDICATOR_DATA);
,pR.HCR#Y PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_ARROW);
eg(1kDMpn PlotIndexSetInteger(1,PLOT_DRAW_TYPE,DRAW_ARROW);
0W!S.]^1 PlotIndexSetInteger(0,PLOT_ARROW,1001);
) $=!e%{ PlotIndexSetInteger(1,PLOT_ARROW,1002);
EKf! j3 KSxZ4Y }-T
: SetIndexBuffer(2,ma1,INDICATOR_DATA);
y!/:1BHlm SetIndexBuffer(3,ma2,INDICATOR_DATA);
!<= ^&\A SetIndexBuffer(4,mah1,INDICATOR_DATA);
@|d+T"f SetIndexBuffer(5,mah2,INDICATOR_DATA);
}E#1Z\) m1=iMA(Symbol(),PERIOD_M5,MA1,0,MODE_SMA,PRICE_CLOSE);
36\_Y?zx% m2=iMA(Symbol(),PERIOD_M5,MA2,0,MODE_SMA,PRICE_CLOSE);
M+-1/vR *@ mh1=iMA(Symbol(),PERIOD_M30,MAH1,0,MODE_SMA,PRICE_CLOSE);
q" @%W K mh2=iMA(Symbol(),PERIOD_M30,MAH2,0,MODE_SMA,PRICE_CLOSE);
lt& c/xi_ //---
T[%@B" return(0);
nTCwLnX(O }
M?QX'fia //+------------------------------------------------------------------+
=DwY-Ex //| Custom indicator iteration function |
s=hao4v7z //+------------------------------------------------------------------+
o_n 3.O= int OnCalculate(const int rates_total,
zo:NE00 const int prev_calculated,
Kon|TeC>d const datetime& time[],
>J/8lS{# const double& open[],
,PeE'$q const double& high[],
$8`" const double& low[],
3,1HD_ const double& close[],
}!N/?A5 const long& tick_volume[],
^w_\D? const long& volume[],
~>XqR/v const int& spread[])
=3dd1n;8> {
5,?^SK|'x int malong=CopyBuffer(m1,0,0,rates_total,ma1);
t\-|J SZ int masmall=CopyBuffer(m2,0,0,rates_total,ma2);
)FN$Jlo
int malongh=CopyBuffer(mh1,0,0,rates_total,mah1);
+G)a+r'0Q int masmallh=CopyBuffer(mh2,0,0,rates_total,mah2);
+'wO:E1( w for(int i=10;i
hD{
`j
{ ij1YV2v
if((ma1[i-1]>ma2[i-1])&&(ma1&&mah1[1]>mah1[2])) MG~bDM4
{ qae|?z
upBuffer=ma2; Vcnc=ct
if(i==prev_calculated) cICfV,j
{Alert("up");} z:Z-2WV2o
} e\O-5hp7
if((ma1[i-1]>ma2&&mah1[1] aO S,%J^?
{ b`@C #qB
downBuffer=mah2; .FC+
if(i==prev_calculated) \P")Eh =d
{Alert("down");} GC' e
} <oV[[wl
} _> x}MW+
//--- @c'iT20
//--- return value of prev_calculated for next call M<d!j I9)
return(rates_total); Qrg- xu=
} @uCi0P t
//+------------------------------------------------------------------+