打印本文
關(guān)閉窗口
麥語(yǔ)言的編程思維實(shí)在轉(zhuǎn)不過來(lái),請(qǐng)老師幫我改下
作者:文華財(cái)經(jīng) 來(lái)源:cxh99.com 發(fā)布時(shí)間:2016年01月05日
咨詢內(nèi)容:
for (i = Bars; i >= 0; i--) { TrendUp[i] = EMPTY_VALUE; TrendDown[i] = EMPTY_VALUE; atr = iATR(NULL, 0, Nbr_Periods, i); medianPrice = (High[i]+Low[i])/2; up[i]=medianPrice+(Multiplier*atr); dn[i]=medianPrice-(Multiplier*atr); trend[i]=1; if (Close[i]>up[i+1]) { trend[i]=1; if (trend[i+1] == -1) changeOfTrend = 1; } else if (Close[i]<dn[i+1]) { trend[i]=-1; if (trend[i+1] == 1) changeOfTrend = 1; } else if (trend[i+1]==1) { trend[i]=1; changeOfTrend = 0; } else if (trend[i+1]==-1) { trend[i]=-1; changeOfTrend = 0; }
if (trend[i]<0 && trend[i+1]>0) { flag=1; } else { flag=0; } if (trend[i]>0 && trend[i+1]<0) { flagh=1; } else { flagh=0; } if (trend[i]>0 && dn[i]<dn[i+1]) dn[i]=dn[i+1]; if (trend[i]<0 && up[i]>up[i+1]) up[i]=up[i+1]; if (flag==1) up[i]=medianPrice+(Multiplier*atr); if (flagh==1) dn[i]=medianPrice-(Multiplier*atr); //-- Draw the indicator if (trend[i]==1) { TrendUp[i]=dn[i]; if (changeOfTrend == 1) { TrendUp[i+1] = TrendDown[i+1]; changeOfTrend = 0; } } else if (trend[i]==-1) { TrendDown[i]=up[i]; if (changeOfTrend == 1) { TrendDown[i+1] = TrendUp[i+1]; changeOfTrend = 0; } } }然后在主圖上畫出TrendDown, TrendUp兩條線
文華技術(shù)人員:
查看了一下您的源碼,代碼是不完整的,缺少變量Multiplier定義部分。
您的公式是MT4指標(biāo)吧。請(qǐng)?zhí)峁┫峦暾创a,以便我們?yōu)槟薷摹?/p>
文華客服:
這個(gè)不影響就一個(gè)變量
double TrendUp[], TrendDown[];int changeOfTrend;extern int Nbr_Periods = 10;extern double Multiplier = 2;int init() {//---- indicators SetIndexBuffer(0, TrendUp); SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 3); SetIndexLabel(0, "Trend Up"); SetIndexBuffer(1, TrendDown); SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 3); SetIndexLabel(1, "Trend Down");//---- return(0); }
int start() { int limit, i, flag, flagh, trend[5000]; double up[5000], dn[5000], medianPrice, atr; int counted_bars = IndicatorCounted();//---- check for possible errors if(counted_bars < 0) return(-1);//---- last counted bar will be recounted if(counted_bars > 0) counted_bars--; limit=Bars-counted_bars;
for (i = Bars; i >= 0; i--) { TrendUp[i] = EMPTY_VALUE; TrendDown[i] = EMPTY_VALUE; atr = iATR(NULL, 0, Nbr_Periods, i); medianPrice = (High[i]+Low[i])/2; up[i]=medianPrice+(Multiplier*atr); dn[i]=medianPrice-(Multiplier*atr); trend[i]=1;
if (Close[i]>up[i+1])
{
trend[i]=1;
if (trend[i+1] == -1) changeOfTrend = 1;
}
else if (Close[i]<dn[i+1]) {
trend[i]=-1;
if (trend[i+1] == 1) changeOfTrend = 1;
}
else if (trend[i+1]==1) {
trend[i]=1;
changeOfTrend = 0;
}
else if (trend[i+1]==-1) {
trend[i]=-1;
changeOfTrend = 0;
}
if (trend[i]<0 && trend[i+1]>0) {
flag=1;
}
else {
flag=0;
}
if (trend[i]>0 && trend[i+1]<0) {
flagh=1;
}
else {
flagh=0;
}
if (trend[i]>0 && dn[i]<dn[i+1])
dn[i]=dn[i+1];
if (trend[i]<0 && up[i]>up[i+1])
up[i]=up[i+1];
if (flag==1)
up[i]=medianPrice+(Multiplier*atr);
if (flagh==1)
dn[i]=medianPrice-(Multiplier*atr);
//-- Draw the indicator
if (trend[i]==1) {
TrendUp[i]=dn[i];
if (changeOfTrend == 1) {
TrendUp[i+1] = TrendDown[i+1];
changeOfTrend = 0;
}
}
else if (trend[i]==-1) {
TrendDown[i]=up[i];
if (changeOfTrend == 1) {
TrendDown[i+1] = TrendUp[i+1];
changeOfTrend = 0;
}
}
}
然后在主圖上畫出
TrendDown, TrendUp兩條線
網(wǎng)友回復(fù):
我們研究一下,MT4改寫需要一些時(shí)間。改寫好后會(huì)第一時(shí)間為您回復(fù)。
網(wǎng)友回復(fù):
老師,您好,我的程序改好沒有?
打印本文
關(guān)閉窗口
主站蜘蛛池模板:
精品人妻中文字幕有码在线
|
120秒男女动态视频免费
|
日韩精品久久无码中文字幕
|
亚洲综合精品伊人久久
|
色哟哟国产精品免费观看
|
国产精品一区二区资源
|
juy-432君岛美绪在线播放
|
日本午夜精品一区二区三区电影
|
亚洲日韩国产成网在线观看
|
成人欧美日韩一区二区三区
|
亚洲一级毛片免观看
|
理论片在线观看韩影库
|
国产h在线播放
|
久碰人澡人澡人澡人澡91
|
国色天香论坛社区在线视频
|
一级黄色a毛片
|
日本欧美韩国专区
|
亚洲中文字幕无码av永久
|
激情成人综合网
|
北条麻妃久久99精品
|
青青草国产精品视频
|
国产精品久久久久鬼色
|
99在线视频精品
|
性猛交╳xxx乱大交
|
久久午夜福利电影
|
欧美一区二区久久精品
|
你是我的城池营垒免费看
|
美女被艹免费视频
|
国产午夜在线观看
|
中文字幕在线观看你懂的
|
国模吧双双大尺度炮交gogo
|
…久久精品99久久香蕉国产
|
无码国产乱人伦偷精品视频
|
久久精品欧美日韩精品
|
欧美交性a视频免费
|
亚洲白嫩在线观看
|
男女下面进入拍拍免费看
|
厨房掀起馊子裙子挺进去
|
色综合综合在线
|
国产小视频你懂的
|
h视频在线免费看
|