MT4技术指标源码 顶和底

#property indicator_chart_window
中国国情国力extern int ma1per= 10;
extern int ma2per= 20;
extern int mamode= 0;
double up[];
double dn[];
double upok[];边际贡献
double dnok[];
double dir[];
double upBuffer[];
double dnBuffer[];
/
/+------------------------------------------------------------------+
int deinit()
{
ObjectsDeleteAll();
return(0);
}
//+------------------------------------------------------------------+
int start()
{
int counted_bars= IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit= Bars-counted_bars;
贞元集团for(int i=limit; i>1; i--){
//--i为三K线中的高棒时
if(i==iHighest(NULL, 0, MODE_HIGH, 3, i-1)){      // (含未来)
//--查左框边
for(int upLeft=i; upLeft<Bars; upLeft++){
if(Low[upLeft+1]<Low[upLeft]){
upLeft= upLeft+1;
break;
}
}
//--查右框边
for(int upRight=i; upRight>=0; upRight--){
if(Low[upRight-1]<Low[upRight]){
upRight= upRight-1;
break;
}
}
//--统计收盘均线下时间
int count= 0;
for(int j=i-1; j>=0; j--){
if(Close[j]>=iMA(NULL, 0, ma1per, 0, mamode, PRICE_CLOSE, j))马未都说玉
count= 0;
else
count++;
//--超过三 则跳出
if(count>=3)
break;
}
//--
if(upRight!=i && i==iHighest(NULL, 0, MODE_HIGH, upLeft-upRight, upRight) && count>=3 && iMA(NULL, 0, 10, 0, MODE_EMA, PRICE_CLOSE, i)>iMA(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, i)){ 
drawline("up"+Time[upLeft], Time[upLeft], MathMin(Low[upLeft],Low[upRight]), Time[upRight], High[i], Red);
i= upRight; // 顶部
}
}
//--m为三K线中的低棒时
for(int m=limit; m>1; m--){
if(m==iLowest(NULL, 0, MODE_LOW, 3, m-1)){
for(int downLeft=m; downLeft<Bars; downLeft++){
if(High[downLeft+1]>High[downLeft]){
downLeft= downLeft+1;
break;
}
}
for(int downRight=m; downRight>=0; downRight--){
if(High[downRight-1]>High[downRight]){
downRight= downRight-1;
break;
}
}
if(downRight!=m && m==iLowest(NULL, 0, MODE_LOW, downLeft-downRight, downRight) && iMA(NULL, 0, 10, 0, MODE_EMA, PRICE_CLOSE, m)<iMA(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, m)){
drawline("down"+Time[downLeft], Time[downLeft], MathMax(High[downLeft], High[downRight]), Time[downRight], Low[m], Blue);
m= downRight; // 底部
}
}
}
return(0);
}
//+-------------------------------------------------------
-----------+
void drawline(string linename, int t1, double price1, int t2, double price2, int lincolor)
{
se18mmif(ObjectFind(linename)<0){
ObjectCreate(linename, OBJ_RECTANGLE, 0, t1, price1, t2, price2);
//ObjectSet(linename, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(linename, OBJPROP_COLOR, lincolor);
//ObjectSet(linename, OBJPROP_RAY, false);
}
else{
ObjectSet(linename, OBJPROP_TIME1, t1);
ObjectSet(linename, OBJPROP_PRICE1, price1);
iec标准ObjectSet(linename, OBJPROP_TIME2, t2);
ObjectSet(linename, OBJPROP_PRICE2, price2);
}
return;
}

本文发布于:2024-09-22 04:37:51,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/610485.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:查找   收盘   均线   国力   边际   跳出   中国国情   贡献
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议