顺水外汇EA交易网MT4
标题:
求助:一个牛逼的初始指标编写
[打印本页]
作者:
qwertyqazwsx
时间:
2018-1-11 13:36
标题:
求助:一个牛逼的初始指标编写
需要编写一个趋势判断指标:当前K线记为0,从当前K线往左数x 【要求参数可调】根K线,0至X这个区间【区间1】的所有K线的最高点记为H,最低点记为L;从当前K线往左数y【要求参数可调】根K线,x至y这个区间【区间2】的所有K线的最高点记为H0,最低点记为L0;分别比较H与H0,L与L0的大小,总共有4种情况:
1、H≥H0,L≥L0, 在副图上画一条红线或者是主图最下方每个K线下标记一个红点,表示当前行情是上涨趋势;
2、H≥H0,L<L0, 在副图上画一条白线或者是主图最下方每个K线下标记一个白点,表示当前行情是盘整;
3、H<H0,L≥L0, 在副图上画一条白线或者是主图最下方每个K线下标记一个白点,表示当前行情是盘整;
4、H<H0,L<L0, 在副图上画一条绿线或者是主图最下方每个K线下标记一个绿点,表示当前行情是下跌趋势;
哪位哥帮忙编译下,不胜感谢~
作者:
dkforex
时间:
2018-1-11 15:12
[attach]19337[/attach]
[attach]19338[/attach]
[attach]19339[/attach]
[attach]19340[/attach]
[attach]19341[/attach]
好东东必须大家一起分享,
[attach]19342[/attach]
[attach]19343[/attach]
[attach]19344[/attach]
[attach]19345[/attach]
[attach]19346[/attach]
继续努力了哟
[attach]19347[/attach]
[attach]19348[/attach]
[attach]19349[/attach]
[attach]19341[/attach]
[attach]19350[/attach]
作者:
yatong777
时间:
2018-1-11 16:31
谢谢分享
作者:
cxzscr
时间:
2018-1-11 17:21
8888888888888
作者:
是誰卑微了承諾
时间:
2018-1-11 18:41
好东东必须大家一起分享,继续努力了哟
作者:
大王叫我来巡山
时间:
2018-1-11 19:25
MACD改版三线带趋势线指标--#Macd。代码出错,大神修改一下
[attach]19351[/attach]
#property link "my.fx3q.com"
#property indicator_buffers 5
#property indicator_separate_window
#property indicator_color1 HotPink //macd
#property indicator_color2 Lime //signal
#property indicator_color3 Gray //histogram
#property indicator_color4 Blue //macd[1]
#property indicator_color5 Black //zero line
//---- buffers
double Buffer1[]; //macd
double Buffer2[]; //signal
double Buffer3[]; //histogram
double Buffer4[]; //macd[1]
double Buffer5[]; //zero line
//
extern int FastEMA = 9;
extern int SlowEMA = 64;
extern int SignalSMA = 112;
//extern bool plotMACD = true;
//extern bool plotSignalLine = true;
//extern bool plotHistogram = true;
//extern bool plotMACDOneBarAgo = true;
//extern bool plotZeroLine = true;
extern bool plotArrows = false;
extern double HistThreshold = 0;
//
//
int limit = 0;
int fontsize=10;
int i = 0;
bool InLTrade = false;
bool InSTrade = false;
int init()
{
ObjectsDeleteAll();
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);//macd
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);//signal
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,2);//hist
SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,2);//macd[1]
SetIndexStyle(4,DRAW_LINE,STYLE_SOLID,1);//zero
//
SetIndexBuffer(0,Buffer1);
SetIndexBuffer(1,Buffer2);
SetIndexBuffer(2,Buffer3);
SetIndexBuffer(3,Buffer4);
SetIndexBuffer(4,Buffer5);
//
SetIndexDrawBegin(1,SignalSMA);
//
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
//
IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
//
SetIndexLabel(0,"MACD");
SetIndexLabel(1,"Signal");
SetIndexLabel(2,"Histogram");
SetIndexLabel(3,"MACD[1]");
SetIndexLabel(4,"Zero");
//
return(0);
}
string NewArrow(datetime T1, double P1, color collor)
{
string N=StringConcatenate("A",collor,"-",TimeToStr(T1));
int AC=SYMBOL_STOPSIGN;
if(collor==Blue)
AC=SYMBOL_ARROWUP;
if(collor==Red)
AC=SYMBOL_ARROWDOWN;
//
ObjectCreate(N, OBJ_ARROW, 0, T1, P1);
ObjectSet(N, OBJPROP_ARROWCODE, AC);
ObjectSet(N, OBJPROP_COLOR, collor);
ObjectSet(N, OBJPROP_WIDTH, 1);
ObjectsRedraw();
return(N);
}
int deinit()
{
ObjectsRedraw();
return(0);
}
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars0) counted_bars--;//---- last counted bar will be recounted
limit=Bars-counted_bars;
//
for(i=0; i=0;i--)
{
if ((Buffer3[i-1] > 0) && (Buffer3
HistThreshold)//Long Begin
{
string upArrow1=NewArrow(Time[i-1], High[i-1]+0.0005, Blue);
InLTrade = true;
}
if ((Buffer3[i-1] 0) && Buffer3[i-1] Buffer3
))//Short End
{
string upArrow2=NewArrow(Time[i-1], Low[i-1]-0.0003, Aqua);
InSTrade = false;
}
if ((InLTrade == true) && (Buffer3[i-1] = 0; l_objs_total_4--) {
l_name_8 = ObjectName(l_objs_total_4);
if (StringSubstr(l_name_8, 0, 8) == "VertLine") ObjectDelete(l_name_8);
}
return (0);
}
int start() {
int lia_4[30];
bool li_8;
int li_12;
int li_16;
int l_index_20;
string l_time2str_24;
int l_count_32;
string ls_36;
int li_44;
int li_0 = TimeCurrent() + 3600 * (InputTimeZone - ChartTimeZone);
if (TimeDayOfWeek(li_0) != g_day_of_week_112 || Bars - g_bars_116 > 1) {
g_day_of_week_112 = TimeDayOfWeek(li_0);
g_bars_116 = Bars;
li_8 = TRUE;
li_12 = 0;
l_index_20 = 0;
while (TimeDayOfWeek(li_0) == 0 || TimeDayOfWeek(li_0) == 6) li_0 += 86400;
l_time2str_24 = TimeToStr(li_0, TIME_DATE);
while (li_8) {
l_index_20++;
li_16 = StringFind(KeyTimePoints, ",", li_12);
if (li_16 == -1) {
li_16 = StringLen(KeyTimePoints);
li_8 = FALSE;
}
lia_4[l_index_20] = StrToTime(l_time2str_24 + " " + StringSubstr(KeyTimePoints, li_12, li_16 - li_12));
li_12 = li_16 + 1;
}
l_count_32 = 0;
for (int l_count_48 = 0; l_count_48 < LookBackDays; l_count_48++) {
while (TimeDayOfWeek(li_0 - 86400 * l_count_32) == 0 || TimeDayOfWeek(li_0 - 86400 * l_count_32) == 6) l_count_32++;
for (int li_52 = 1; li_52 <= l_index_20; li_52++) {
ls_36 = "VertLine" + l_count_48 + li_52 + " " + TimeToStr(lia_4[li_52], TIME_MINUTES);
li_44 = lia_4[li_52] - 86400 * l_count_32 - 3600 * (InputTimeZone - ChartTimeZone);
DrawLine(ls_36, li_44);
}
l_count_32 += 1;
}
}
return (0);
}
void DrawLine(string a_name_0, int a_datetime_8) {
if (ObjectFind(a_name_0) != 0) ObjectCreate(a_name_0, OBJ_VLINE, 0, a_datetime_8, 0);
else ObjectMove(a_name_0, 0, a_datetime_8, 0);
ObjectSet(a_name_0, OBJPROP_STYLE, LineStyle);
ObjectSet(a_name_0, OBJPROP_COLOR, LineColor);
ObjectSet(a_name_0, OBJPROP_WIDTH, LineWidth);
ObjectSet(a_name_0, OBJPROP_BACK, DrawInBackground);
}
作者:
大王叫我来巡山
时间:
2018-1-11 20:55
这个是干嘛的
作者:
足行天下路
时间:
2018-1-11 22:31
唐奇安通道,就是你说的去周期高低点的指标,自己加两个arrow数组判断下就出箭头了
作者:
shuperjolly
时间:
2018-1-11 22:47
谢谢分享
作者:
shenhua16898806
时间:
2018-1-11 23:41
fggggggggggggggggggggggggggggggggggggg
欢迎光临 顺水外汇EA交易网MT4 (http://waterforex.com/)
Powered by Discuz! X3.2