ICustom函数 - 页 22

 
SantaClaus:
英语不是我的母语,但我真的不认为我的问题有什么错误。与其说是 "标记文字",不如说是为我的问题找一个解决方案吧。我再次尝试这个问题。

我的EA从我的指标中识别简单的看跌和看涨的最佳方法是什么?

很明显,我的代码没有起作用,我试图按照你的要求将 "1 "改为 "0"。

把你不工作的代码贴在这里(附上)--你正在测试的和你到目前为止写的mql文件

 

这是我的私人代码,所以我不想分享它。但是,除了我提供的代码,你还需要看到什么?

有什么是我忘记的吗?

 
SantaClaus:
这是我的私人代码,所以我不想分享它。但除了我提供的代码,你还需要看什么呢? 有什么是我忘记的吗?

你的意思是,你希望有人帮助你编码,但你不想展示代码来检查 错误,而是声称你收到的所有建议,在成千上万的其他代码中都是有效的,但对你不起作用?

好吧。我现在明白你的立场了。祝你的编码工作顺利

交易愉快

 

不起作用的私人代码?有趣的是

 

我的两个帖子被删除了,我不知道是什么原因。

然而,遇到的问题是,我有一些其他的缓冲区,干扰了我试图读取的那个缓冲区。我现在有了一个可行的解决方案。

 

我需要一些帮助。如果我不使用函数,我把符号名称放在双引号中,它可以工作,例如icustom("EURUSDmicro",0,channel-signal",2,1),但当我使用函数时,双引号没有被传递过来,请看以下代码我的意思

空白的OnTick()

{

CalcDisplay("EURUSDmicro"); //--------FUNCTION CALL-------

}

void CalcDisplay(string TxtCurrency) //--------FUNCTION-------

{

double Value=icustom(TxtCurrency,0,channel-signal",2,1)。

...

...

..

}

 
Richard Sidric:
我需要一些帮助...如果我不使用函数,我把符号名称放在双引号中,它可以工作,例如icustom("EURUSDmicro",0,channel-signal",2,1),但当我使用函数时,双引号没有被传递过来。

空白的OnTick()

{

CalcDisplay("EURUSDmicro"); //--------FUNCTION CALL-------

}

void CalcDisplay(string TxtCurrency) //--------FUNCTION-------

{

double Value=icustom(TxtCurrency,0,channel-signal",2,1)。

...

...

..

}

你不需要传递引号。所需要的是它是一个字符串。

___________________

PS:在你的iCiustom调用中,你缺少一个引号。现在是这样的:

double Value=icustom(TxtCurrency,0,channel-signal",2,1)。

而它应该是这样的。

double Value=icustom(TxtCurrency,0, "channel-signal",2,1)。

 

我有一个T4指标,附在下面,我想知道我怎么能把它用于机器人交易,机器人交易或EA是否相同?

(我已经在使用它进行手动交易,但还是坐在电脑前)

如果我把它用于自动交易,那么如何请帮助我。

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

// 原始版本和第一次执行者:Mony

// tris版本由mladen提供

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

#财产版权 "mony & mladen"

#property link "made at www.forex.tsd.com"

#属性 indicator_chart_window

#属性 indicator_buffers 5

#perty indicator_color1 MediumBlue

#属性 indicator_color2 红色

#属性indicator_color3中蓝

#属性indicator_color4 红色

#属性 indicator_color5 红色

#属性指示器宽度3 3

#属性指示器宽度4 3

#perty indicator_width5 3

#perty strict

//

//

//

//

//

//

enum enDisplay

{

dis_line, // 显示有颜色的线

dis_bars, // 显示有颜色的条形图

dis_both // 同时显示彩色线条和条形图案

};

extern int CCIperiod = 3; // CCI周期

extern int ATRperiod = 300; // ATR周期

extern ENUM_APPLIED_PRICE applied_price = PRICE_TYPICAL; // 使用的价格

extern enDisplay DisplayType = dis_line; // 显示类型

extern bool alertsOn = true; // 打开警报器

extern bool alertsOnCurrent = false; // 在当前(仍然打开)的条上发出警报

extern bool alertsMessage = true; // 警报应该显示弹出式信息

extern bool alertsSound = true; // 警报应该播放声音。

extern bool alertsNotify = true; // 警报应该发送通知。

extern bool alertsEmail = false; // 警报应该发送邮件

extern string soundFile = "o.wma"; // 用于声音警报的声音文件

double TrLine[];

double TrendDowna[];

double TrendDownb[];

double HistUp[];

double HistDn[];

double trend[];

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

//

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

//

//

//

//

//

int init()

{

IndicatorBuffers(6);

int styleLine = DRAW_LINE; if (DisplayType==dis_bars) styleLine=DRAW_NONE;

int styleBars = DRAW_HISTOGRAM; if (DisplayType==dis_line) styleBars=DRAW_NONE;

SetIndexBuffer(0, HistUp); SetIndexStyle(0,styleBars);

SetIndexBuffer(1, HistDn); SetIndexStyle(1,styleBars);

SetIndexBuffer(2, TrLine); SetIndexStyle(2,styleLine);

SetIndexBuffer(3, TrendDowna); SetIndexStyle(3,styleLine);

SetIndexBuffer(4, TrendDownb); SetIndexStyle(4,styleLine);

SetIndexBuffer(5, trend)。

返回(0)。

}

int deinit(){ return(0); }

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

//

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

//

//

//

//

//

int start()

{

int counted_bars=IndicatorCounted()。

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

如果(counted_bars>0) counted_bars--。

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

//

//

//

//

//

if (trend[limit]==-1) CleanPoint(limit,TrendDowna,TrendDownb);

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

{

double cciTrendNow = iCCI(NULL, 0, CCIperiod, applied_price, i)。

如果(ciTrendNow >= 0)

{

TrLine = NormalizeDouble(Low - iATR(NULL, 0, ATRperiod, i),Digits);

如果(i<(Bars-1) && TrLine < TrLine) TrLine = TrLine;

}

如果(cciTrendNow <= 0)

{

TrLine = NormalizeDouble(High + iATR(NULL, 0, ATRperiod, i),Digits)。

如果(i TrLine) TrLine = TrLine;

}

//

//

//

//

//

TrendDowna = EMPTY_VALUE;

TrendDownb = EMPTY_VALUE;

如果(i<(Bars-1))

{

trend = trend;

if (TrLine> TrLine) trend = 1;

如果(TrLine< TrLine) trend =-1;

如果(trend == -1) PlotPoint(i,TrendDowna,TrendDownb,TrLine);

如果(trend == 1) { HistUp = High; HistDn = Low; }

如果(trend == -1) { HistDn = 高; HistUp = 低; }

}

}

manageAlerts()。

return(0);

}

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

//|

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

//

//

//

//

//

空白管理提示()。

{

如果(alertsOn)

{

int whichBar = 1; if (alertsOnCurrent) whichBar = 0;

如果(趋势[whichBar] !=趋势[whichBar+1])。

{

如果(trend[whichBar] == 1) doAlert(whichBar, "up")。

如果(trend[whichBar] ==-1) doAlert(whichBar, "down");

}

}

}

//

//

//

//

//

void doAlert(int forBar, string doWhat)

{

静态字符串previousAlert="无"。

static datetime previousTime;

字符串信息。

如果(previousAlert != doWhat || previousTime != Time[forBar]) {

previousAlert = doWhat;

previousTime = Time[forBar];

//

//

//

//

//

message = Symbol()+" at "+TimeToStr(TimeLocal(),TIME_SECONDS)+" SP MY trend changed to "+doWhat;

if (alertsMessage) Alert(message);

如果(alertsNotify) SendNotification(message);

如果(alertsEmail) SendMail(Symbol()+" S P MY",message);

如果(alertsSound) PlaySound(soundFile);

}

}

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

//

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

//

//

//

//

//

void CleanPoint(int i,double& first[],double& second[])

{

如果(i>=Bars-3)返回。

如果((second != EMPTY_VALUE) && (second != EMPTY_VALUE))

second = EMPTY_VALUE。

否则

如果((first != EMPTY_VALUE) && (first != EMPTY_VALUE) && (first == EMPTY_VALUE))

first = EMPTY_VALUE。

}

void PlotPoint(int i,double& first[],double& second[], double& from[])

{

如果(i>=Bars-2)返回。

如果(first == EMPTY_VALUE)

如果(first == EMPTY_VALUE)

{ first = from; first = from; second = EMPTY_VALUE; }

else { second = from; second = from; first = EMPTY_VALUE; }

else { first = from; second = EMPTY_VALUE; }

}

s_p_mony__alerts_1.01.mq4

附加的文件:
 
mony:
嗨,我有一个T4指标,下面有一个附件,我想知道我怎么能用它来做机器人交易,机器人交易或EA是否相同?

(我已经在使用它的手动交易,坐在电脑前,但)

如果我用它来进行自动交易,那么请帮助我,谢谢。

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

// 原始设计和首次实施:MONY

// tris版本由mladen编写

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

#财产版权 "mony & mladen"

#property link "made at www.forex.tsd.com"

#属性 indicator_chart_window

#属性 indicator_buffers 5

#perty indicator_color1 MediumBlue

#属性 indicator_color2 红色

#属性indicator_color3中蓝

#属性indicator_color4 红色

#属性 indicator_color5 红色

#属性指示器宽度3 3

#属性指示器宽度4 3

#perty indicator_width5 3

#perty strict

//

//

//

//

//

//

enum enDisplay

{

dis_line, // 显示有颜色的线

dis_bars, // 显示有颜色的条形图

dis_both // 同时显示彩色线条和条形图案

};

extern int CCIperiod = 3; // CCI周期

extern int ATRperiod = 300; // ATR周期

extern ENUM_APPLIED_PRICE applied_price = PRICE_TYPICAL; // 使用的价格

extern enDisplay DisplayType = dis_line; // 显示类型

extern bool alertsOn = true; // 打开警报器

extern bool alertsOnCurrent = false; // 在当前(仍然打开)的条上发出警报

extern bool alertsMessage = true; // 警报应该显示弹出式信息

extern bool alertsSound = true; // 警报应该播放声音。

extern bool alertsNotify = true; // 警报应该发送通知。

extern bool alertsEmail = false; // 警报应该发送邮件

extern string soundFile = "o.wma"; // 用于声音警报的声音文件

double TrLine[];

double TrendDowna[];

double TrendDownb[];

double HistUp[];

double HistDn[];

double trend[];

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

//

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

//

//

//

//

//

int init()

{

IndicatorBuffers(6);

int styleLine = DRAW_LINE; if (DisplayType==dis_bars) styleLine=DRAW_NONE;

int styleBars = DRAW_HISTOGRAM; if (DisplayType==dis_line) styleBars=DRAW_NONE;

SetIndexBuffer(0, HistUp); SetIndexStyle(0,styleBars);

SetIndexBuffer(1, HistDn); SetIndexStyle(1,styleBars);

SetIndexBuffer(2, TrLine); SetIndexStyle(2,styleLine);

SetIndexBuffer(3, TrendDowna); SetIndexStyle(3,styleLine);

SetIndexBuffer(4, TrendDownb); SetIndexStyle(4,styleLine);

SetIndexBuffer(5, trend)。

返回(0)。

}

int deinit(){ return(0); }

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

//

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

//

//

//

//

//

int start()

{

int counted_bars=IndicatorCounted()。

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

如果(counted_bars>0) counted_bars--。

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

//

//

//

//

//

if (trend[limit]==-1) CleanPoint(limit,TrendDowna,TrendDownb);

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

{

double cciTrendNow = iCCI(NULL, 0, CCIperiod, applied_price, i)。

如果(ciTrendNow >= 0)

{

TrLine = NormalizeDouble(Low - iATR(NULL, 0, ATRperiod, i),Digits);

如果(i<(Bars-1) && TrLine < TrLine) TrLine = TrLine;

}

如果(cciTrendNow <= 0)

{

TrLine = NormalizeDouble(High + iATR(NULL, 0, ATRperiod, i),Digits)。

如果(i TrLine) TrLine = TrLine;

}

//

//

//

//

//

TrendDowna = EMPTY_VALUE;

TrendDownb = EMPTY_VALUE;

如果(i<(Bars-1))

{

trend = trend;

if (TrLine> TrLine) trend = 1;

如果(TrLine< TrLine) trend =-1;

如果(trend == -1) PlotPoint(i,TrendDowna,TrendDownb,TrLine);

如果(trend == 1) { HistUp = High; HistDn = Low; }

如果(trend == -1) { HistDn = 高; HistUp = 低; }

}

}

manageAlerts()。

return(0);

}

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

//|

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

//

//

//

//

//

空白管理提示()。

{

如果(alertsOn)

{

int whichBar = 1; if (alertsOnCurrent) whichBar = 0;

如果(趋势[whichBar] !=趋势[whichBar+1])。

{

如果(trend[whichBar] == 1) doAlert(whichBar, "up")。

如果(trend[whichBar] ==-1) doAlert(whichBar, "down");

}

}

}

//

//

//

//

//

void doAlert(int forBar, string doWhat)

{

静态字符串previousAlert="无"。

static datetime previousTime;

字符串信息。

如果(previousAlert != doWhat || previousTime != Time[forBar]) {

previousAlert = doWhat;

previousTime = Time[forBar];

//

//

//

//

//

message = Symbol()+" at "+TimeToStr(TimeLocal(),TIME_SECONDS)+" SP MY trend changed to "+doWhat;

if (alertsMessage) Alert(message);

如果(alertsNotify) SendNotification(message);

如果(alertsEmail) SendMail(Symbol()+" S P MY",message);

如果(alertsSound) PlaySound(soundFile);

}

}

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

//

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

//

//

//

//

//

void CleanPoint(int i,double& first[],double& second[])

{

如果(i>=Bars-3)返回。

如果((second != EMPTY_VALUE) && (second != EMPTY_VALUE))

second = EMPTY_VALUE。

否则

如果((first != EMPTY_VALUE) && (first != EMPTY_VALUE) && (first == EMPTY_VALUE))

first = EMPTY_VALUE。

}

void PlotPoint(int i,double& first[],double& second[], double& from[])

{

如果(i>=Bars-2)返回。

如果(first == EMPTY_VALUE)

如果(first == EMPTY_VALUE)

{ first = from; first = from; second = EMPTY_VALUE; }

else { second = from; second = from; first = EMPTY_VALUE; }

else { first = from; second = EMPTY_VALUE; }

}

s_p_mony__alerts_1.01.mq4

你试过从EA中使用iCustom()调用了吗?

你所要做的就是用iCustom()函数调用指标,读取趋势缓冲区(metatrader nomination中的缓冲区5),当它的值从-1变为+1或从+1变为-1时,你就有一个信号。

 

先生,我很抱歉,先生.........,我不知道什么是iCustom()调用......以及我在哪里可以尝试?...... 我在MT4中哪里找到它,或者在修改指标时,请告诉我如何将这个S P mony指标用于自动交易/机器人交易,就是这样,先生 ..................

如果这都是冗长的过程,那么请原谅我,请忘记上面的帖子,谢谢你,先生。