编码帮助 - 页 160

 
TEAMTRADER:
我从一个主题中下载了这个指标,它远比CCI-zone或Ma-zone指标好。

能否将其调整为在屏幕上显示为一个区域指标?

它被设置为CCI设置13,但如果它可以很容易地成为一个变量设置指标,那么这将是一个额外的好处--但这是一个非常次要的要求。

它是一个Forex-TSD指标,但没有mq4文件夹。

谢谢

经理人(TEAMTRADER)

在我看来,它不是一个CCI,而是一个Thv T3 trix。你应该搜索一下thv trix的一些变化。

 

mladen,我有一个指标,它绘制了前一天的高点和低点的线,但我需要同样的指标来绘制前一天的三个高点和低点,你能帮助我吗?

//+------------------------------------------------------------------+

//| Copyright © 2008, ledxep |

//| http://www.metaquotes.net/ |

//+------------------------------------------------------------------+

#property copyright "Copyright © 2008, ledzep"

#property link "http://www.metaquotes.net/"

#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 Blue

//---- input parameters

double DayHigh,DayLow,DayHigh1,DayLow1;

int ObjectIdx;

int DayIdx;

int k;

string ObjName;

datetime StartTime;

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

return(0);

}

//+------------------------------------------------------------------+

//| Deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

ObjectsDeleteAll();

return(0);

}

//+------------------------------------------------------------------+

//| Start function |

//+------------------------------------------------------------------+

int start()

{

static bool first=true;

int i,counted_bars=IndicatorCounted();

double BarHour,BarMinute;

int WeekDay;

if(Bars<3) return(0);

i=Bars-3;

if(counted_bars==0 || first)

{

first=false;

while(i>=0)

{

TrendLine(StartTime,DayHigh1,Time,DayHigh1,Red);

TrendLine(StartTime,DayLow1,Time,DayLow1,Red);

if(High > DayHigh) DayHigh = High;

if(Low < DayLow) DayLow = Low;

if(TimeDay(Time) != TimeDay(Time))

{

DayHigh1=DayHigh;

DayLow1=DayLow;

DayHigh=Open;

DayLow=Open;

StartTime=Time;

}

i--;

}//while close

}

return(0);

}//start close

//+------------------------------------------------------------------+

void TrendLine(datetime x1, double y1, datetime x2, double y2, color col)

{

ObjectIdx++;

ObjName="Line" + DoubleToStr(ObjectIdx,0);

ObjectCreate(ObjName, OBJ_TREND, 0, x1, y1, x2, y2);

ObjectSet(ObjName,OBJPROP_COLOR,col);

ObjectSet(ObjName,OBJPROP_RAY,0);

}

 
k3rn3l:
mladen,我有一个指标,可以画出前一天的高点和低点的线,但是我需要同样的指标来画出前3天的高点和低点,你能帮助我吗?提前感谢

//+------------------------------------------------------------------+

//| Copyright © 2008, ledxep |

//| http://www.metaquotes.net/ |

//+------------------------------------------------------------------+

#property copyright "Copyright © 2008, ledzep"

#property link "http://www.metaquotes.net/"

#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 Blue

//---- input parameters

double DayHigh,DayLow,DayHigh1,DayLow1;

int ObjectIdx;

int DayIdx;

int k;

string ObjName;

datetime StartTime;

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

return(0);

}

//+------------------------------------------------------------------+

//| Deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

ObjectsDeleteAll();

return(0);

}

//+------------------------------------------------------------------+

//| Start function |

//+------------------------------------------------------------------+

int start()

{

static bool first=true;

int i,counted_bars=IndicatorCounted();

double BarHour,BarMinute;

int WeekDay;

if(Bars<3) return(0);

i=Bars-3;

if(counted_bars==0 || first)

{

first=false;

while(i>=0)

{

TrendLine(StartTime,DayHigh1,Time,DayHigh1,Red);

TrendLine(StartTime,DayLow1,Time,DayLow1,Red);

if(High > DayHigh) DayHigh = High;

if(Low < DayLow) DayLow = Low;

if(TimeDay(Time) != TimeDay(Time))

{

DayHigh1=DayHigh;

DayLow1=DayLow;

DayHigh=Open;

DayLow=Open;

StartTime=Time;

}

i--;

}//while close

}

return(0);

}//start close

//+------------------------------------------------------------------+

void TrendLine(datetime x1, double y1, datetime x2, double y2, color col)

{

ObjectIdx++;

ObjName="Line" + DoubleToStr(ObjectIdx,0);

ObjectCreate(ObjName, OBJ_TREND, 0, x1, y1, x2, y2);

ObjectSet(ObjName,OBJPROP_COLOR,col);

ObjectSet(ObjName,OBJPROP_RAY,0);

}

恐怕我不明白

该指标是在整个历史上绘制前一天的最高点和最低点(图表上有多少天就画多少天)。绘制前一天的3个高点和低点 "到底是什么意思?

 
mladen:
恐怕我不明白,该指标在整个历史上(图表上有多少天)绘制前一天的高点和低点。绘制前3天的高点和低点 "到底是什么意思?

让我解释一下,我希望这个指标每天都能画出前三天的最高点和最低点。

 
k3rn3l:
让我解释一下,我希望该指标每天都能得出前三天的最高点和最低点。

试试这样的方法(这个方法不使用对象,而是使用缓冲区,你可以设置你希望用于最高价和最低价的天数)。

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 LimeGreen

#property indicator_color2 Red

extern int DaysForHighLow = 3;

double buffh[];

double buffl[];

//------------------------------------------------------------------

//

//------------------------------------------------------------------

int init()

{

SetIndexBuffer(0,buffh);

SetIndexBuffer(1,buffl);

return(0);

}

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

int limit = MathMin(Bars-counted_bars,Bars-1);

for (int i=limit; i>=0; i--)

{

int y = iBarShift(NULL,PERIOD_D1,Time);

buffh = iHigh(NULL,PERIOD_D1,iHighest(NULL,PERIOD_D1,MODE_HIGH,DaysForHighLow,y));

buffl = iLow(NULL,PERIOD_D1,iLowest(NULL,PERIOD_D1,MODE_LOW,DaysForHighLow,y));

}

return(0);

}
 
mladen:
试试这样的方法(这个方法不使用对象,而是使用缓冲区,你可以设置你希望用于最高价和最低价的天数)。
#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 LimeGreen

#property indicator_color2 Red

extern int DaysForHighLow = 3;

double buffh[];

double buffl[];

//------------------------------------------------------------------

//

//------------------------------------------------------------------

int init()

{

SetIndexBuffer(0,buffh);

SetIndexBuffer(1,buffl);

return(0);

}

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

int limit = MathMin(Bars-counted_bars,Bars-1);

for (int i=limit; i>=0; i--)

{

int y = iBarShift(NULL,PERIOD_D1,Time);

buffh = iHigh(NULL,PERIOD_D1,iHighest(NULL,PERIOD_D1,MODE_HIGH,DaysForHighLow,y));

buffl = iLow(NULL,PERIOD_D1,iLowest(NULL,PERIOD_D1,MODE_LOW,DaysForHighLow,y));

}

return(0);

}

谢谢mladen,抱歉我解释得不好......我的意思是以前每3天的最高价和最低价,例如PreviousHighDaily[1],PreviuosHighDaily[2],PreviousHighDaily[3],低价也一样。

 
k3rn3l:
谢谢mladen,抱歉我解释得不好......我的意思是以前每3天的高点和低点,例如PreviousHighDaily[1],PreviuosHighDaily[2],PreviousHighDaily[3],低点也一样......

它比前者更容易找到(更少的函数调用)。

你可以像这样做。

#property indicator_chart_window

#property indicator_buffers 6

#property indicator_color1 LimeGreen

#property indicator_color2 Red

#property indicator_color3 LimeGreen

#property indicator_color4 Red

#property indicator_color5 LimeGreen

#property indicator_color6 Red

#property indicator_width1 2

#property indicator_width2 2

#property indicator_style5 STYLE_DOT

#property indicator_style6 STYLE_DOT

double buffh1[];

double buffl1[];

double buffh2[];

double buffl2[];

double buffh3[];

double buffl3[];

//------------------------------------------------------------------

//

//------------------------------------------------------------------

int init()

{

SetIndexBuffer(0,buffh1);

SetIndexBuffer(1,buffl1);

SetIndexBuffer(2,buffh2);

SetIndexBuffer(3,buffl2);

SetIndexBuffer(4,buffh3);

SetIndexBuffer(5,buffl3);

return(0);

}

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

int limit = MathMin(Bars-counted_bars,Bars-1);

for (int i=limit; i>=0; i--)

{

int y = iBarShift(NULL,PERIOD_D1,Time);

buffh1 = iHigh(NULL,PERIOD_D1,y+1);

buffl1 = iLow(NULL,PERIOD_D1,y+1);

buffh2 = iHigh(NULL,PERIOD_D1,y+2);

buffl2 = iLow(NULL,PERIOD_D1,y+2);

buffh3 = iHigh(NULL,PERIOD_D1,y+3);

buffl3 = iLow(NULL,PERIOD_D1,y+3);

}

return(0);

}

PS:最粗的线是1天前,较细的线是2天前,虚线是3天前。

 

编码帮助...........

你好,这里所有的专家,谁能帮助我编码简单的EA,将自动修改最后一个工作订单的TP,与当前的订单一样,刚刚打开? 假设我有1个或更多的工作订单和一些挂单,当挂单成为工作订单,我希望EA将自动修改以前的工作订单的TP(目标价格),以当前的订单刚刚激活。谢谢....。

 
jeffyap:
编码帮助 pls........... hello all of the expert here , can anyone help me to code the simple EA that will automatic modify last working order 's TP same as current order just open ? Let say I have 1 or more working order and few pending order , when pending order become working order , I hope the EA will auto modify the prev working order's TP (target price) to current order just active ... thanks ....

你为什么不在所有的订单上简单地使用一个正常的追踪止损?这样,它们最终会被平衡(如果你有多个订单),而不需要开新的订单。

 

HI Mladen,

如果我想计算两个低点之间的柱子,怎样才能避免周日晚上23点到00点的柱子?

因为在4小时图上有该条,而且只持续一个小时.....,它也出现在日线图上。

谢谢

原因: