编码帮助 - 页 288

 

你好。

首先道歉,如果这是在错误的地方,我正在看一个枢轴,但我的问题是与编码有关的,我可以把它放在MTF中,但我认为这是最好的开始。

在MT4中,我们有日、周、月=W1、D1、MN1

但是否有年度功能,或季度功能。

例如,在所附的枢轴指标中,你如何获得1年,是(或可以选择)滚动的12个月还是固定的前一年2013年的例子。同样的,我怎样才能让它计算出季度枢轴。

我有理由相信我可以修改附件,但我不知道如何开始将数据输入,使其输出季度或年度。

allpivots_monthly.mq4

谢谢

凯文

附加的文件:
 
mladen:
你把它改为使用 "#pollan indy",我不知道这个指标是做什么的(如果它像其他的 "pollan "指标一样,那么它就会重绘,这可能会导致你的问题,但现在只是在做猜测游戏)。

亲爱的MLADEN先生...

你能不能用你的任何其他指标取代这个(#pollan indy)......也许可以调用#VQ bars....。请试一试....,因为我确实有一个指标缓冲区的读数,如附图......但我无法在我的EA中通过iCustom调用来进一步测试这个 "#pollan indy"......

希望能尽快再次收到你的信息......谢谢

您真正的

AZRUL

附加的文件:
my_vq.jpg  48 kb
 
12BPRO:
亲爱的MLADEN先生...

你能不能用你的任何其他指标取代这个(#pollan indy)......可能会调用#VQ bars....。请试一试....,因为我确实有一个指标缓冲区的读数,如附图......但我无法在我的EA中通过iCustom调用来进一步测试这个 "#pollan indy"......

希望能尽快再次收到你的信息......谢谢

您真诚的

AZRUL

没有必要用#VQ来代替#VQ(它已经在计算波动率质量)。

如果它在普通的#VQ下能正常工作,那么唯一合乎逻辑的结论就是 "#pollan indy "有问题。

 

编码帮助

大家早上好

你好,mladen

我正在尝试创建我的第一个代码。

从其他代码中学习,因为我的语言中没有MT4手册。

我祈祷不要嘲笑我的代码。

请帮助我,它可以工作。

这是一个简单的指标,标志着十字星的产生。

我请求您的帮助。

非常感谢你的帮助。

最好的问候。

赫莫。

PD。编译正常,但不工作。

附加的文件:
 
Hermo:
大家早上好

你好mladen

我正在尝试创建我的第一个代码。

从其他代码中学习,因为我的语言中没有MT4手册。

我希望不要嘲笑我的代码。

请帮助我,它可以工作。

这是一个简单的指标,标志着十字星的产生。

我请求您的帮助。

非常感谢你事先的帮助。

最好的问候。

赫莫。

PD。编译正常,但不工作。

Hermo

检查

现在等待欧洲央行新闻发布会:):)

 
12BPRO:
亲爱的MLADEN先生...

这就是为什么一开始我没有发布我的#VQ....,也许你是对的,关于 "Pollan indy "和YES它重绘有问题....。

对我来说,我只是想用这个指标来尝试我的理论,看看结果如何....。

问题是,我无法在我的EA中调用指标缓冲区......可能是由于我的#VQ的修改版本阻止了对我的EA的iCustom调用造成的....

在原来的#VQ下,它工作得很好......我可以运行我的EA....,但在修改后的#VQ(我的)下,我不能过度,但仍然有一个值,如前面的线程所示。

我认为问题出在我修改后的#VQ版本....,可能是语法错误......如果你有时间,请看一下,看看它是否能正常工作.....。

谢谢......并对任何负面意见表示歉意.....

您真正的...

AZRUL

AZRUL

在没有看到代码的情况下,我根本无法知道你的 "Pollan indy "发生了什么。

我所能做的就是猜测,而在编码中猜测是非常、非常糟糕的。

万事如意

 
mladen:
没有必要用#VQ代替#VQ(它已经在计算波动率质量),如果它在普通的#VQ下能正常工作,那么唯一合乎逻辑的结论就是 "#pollan indy "有问题。

亲爱的MLADEN先生...

这就是为什么一开始我没有发布我的#VQ....,也许你是对的,"Pollan indy "有问题,而且是它重绘....。

对我来说,我只是想用这个指标来尝试我的理论,看看结果如何....。

问题是,我无法在我的EA中调用指标缓冲区......可能是由于我的#VQ的修改版本阻止了对我的EA的iCustom调用造成的....

在原来的#VQ下,它工作得很好......我可以运行我的EA....,但在修改后的#VQ(我的)下,我不能过度,但仍然有一个值,如前面的线程所示。

我认为问题出在我修改后的#VQ版本....,可能是一些语法错误......如果你有时间,请看一下,看看它是否能正常工作.....,只是为了学习....。

谢谢...我现在已经运行了该EA并进行了测试,如果你有兴趣知道结果,我将在Pollan线程中发布.....。

你真正的...

AZRUL

 
mladen:
AZRUL

在没有看到代码的情况下,我根本无法知道你的 "Pollan indy "发生了什么。

我所能做的就是猜测,而在编码方面的猜测是非常、非常糟糕的。

万事如意

我现在已经让那个EA运行并进行了测试,如果你有兴趣知道结果,我会把它贴在Pollan thread.....。

是我的#vq版本不工作......。

谢谢...

你真正的...

AZRUL

 

你好,CODESGURUS。

我有一个关于多时间框架的一般问题....,如附件所示

左边的第一张图片是5M时间框架上的RSI指标...

第二张是RSI多时间框架的5M在15M时间框架上......

问题是为什么在红色圆圈中显示的数值有差异....。

谁能解释并纠正这个RsiMA-MTF代码........

#property indicator_separate_window

#property indicator_buffers 6

#属性 indicator_color1 Lime

#属性指示器_颜色2 红色

#属性指示器_颜色3 水色

#属性指示器_颜色4 黄色

#属性指示器_color5 白色

#属性指示器_颜色6 品红

#属性指示器宽度1 1

#属性指示器宽度2 1

#属性指示器宽度3 1

#perty indicator_width4 1

#属性指示器宽度5 1

#属性指示器宽度6 1

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

//-----

//extern string TimeFrames = "M15; M60";

外部 bool TimeFrame1bool = true;

外置 int TimeFrame1 = 0;

extern bool TimeFrame2bool = False;

外部的int TimeFrame2 = 0;

extern bool TimeFrame3bool = False;

外置 int TimeFrame3 = 0;

//int period[]={1,5,15,30,60,240,1440,43200};

//string periodString[]={"M1","M5","M15","M30","H1","H4","D1",MN1"};

//再创建一个包含指标名称的数组

//string signalNameString[]={"MA"};

int ExtCountedBars=0。

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

int TF;

//---- 缓冲区

double ExtMapBuffer1[];

double ExtMapBuffer2[];

double ExtMapBuffer3[];

双倍ExtMapBuffer4[]。

双倍ExtMapBuffer5[]。

双倍ExtMapBuffer6[]。

//-------

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

int init()

{

SetIndexBuffer(0, ExtMapBuffer1);

SetIndexBuffer(1, ExtMapBuffer2);

SetIndexBuffer(2, ExtMapBuffer3);

SetIndexBuffer(3, ExtMapBuffer4);

SetIndexBuffer(4, ExtMapBuffer5);

SetIndexBuffer(5, ExtMapBuffer6)。

//-----

SetIndexStyle(0, DRAW_LINE);

SetIndexStyle(1, DRAW_LINE);

SetIndexStyle(2, DRAW_LINE);

SetIndexStyle(3, DRAW_LINE);

SetIndexStyle(4, DRAW_LINE);

SetIndexStyle(5, DRAW_LINE);

// SetIndexStyle(0,DRAW_LINE,EMPTY,1);

// SetIndexBuffer(0,ExtMapBuffer1)。

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

int M1 = PERIOD_M1;

int M5 = PERIOD_M5;

int M15 = PERIOD_M15;

int M30 = PERIOD_M30;

int H1 = PERIOD_H1;

int H4 = PERIOD_H4;

int D1 = PERIOD_D1;

int WK1 = PERIOD_W1;

int MN1 = PERIOD_M1;

TF=Period()。

if (TF==PERIOD_M1) { TimeFrame1 = M1; TimeFrame2 = M1; TimeFrame3 = M1;}

else if (TF==PERIOD_M5) { TimeFrame1 = M1; TimeFrame2 = M5; TimeFrame3 = M15;}

else if (TF==PERIOD_M15) { TimeFrame1 = M5; TimeFrame2 = M15; TimeFrame3 = H1; }

else if (TF==PERIOD_M30) { TimeFrame1 = M5; TimeFrame2 = M15; TimeFrame3 = H1; }

else if (TF==PERIOD_H1) { TimeFrame1 = M15; TimeFrame2 = H1; TimeFrame3 = H4; }

else if (TF==PERIOD_H4) { TimeFrame1 = H4; TimeFrame2 = H4; TimeFrame3 = D1; }

else if (TF==PERIOD_D1) { TimeFrame1 = H4; TimeFrame2 = D1; TimeFrame3 = WK1;}.

else if (TF==PERIOD_W1) { TimeFrame1 = D1; TimeFrame2 = WK1; TimeFrame3 = MN1;}

else if (TF==PERIOD_MN1) { TimeFrame1 = D1; TimeFrame2 = WK1; TimeFrame3 = MN1;}.

否则 { TimeFrame1 = D1; TimeFrame2 = WK1; TimeFrame3 = MN1;}。

//-----

return(0);

}

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

int start()

{

日期时间TimeArray1[]。

日期时间TimeArray2[];

数据时间TimeArray3[]。

int limit, i,y=0;

// int counted_bars = IndicatorCounted();

ExtCountedBars=IndicatorCounted()。

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

如果(ExtCountedBars > 0) ExtCountedBars--。

limit = Bars - ExtCountedBars。

//-----

ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),TimeFrame1)。

ArrayCopySeries(TimeArray2,MODE_TIME,Symbol(),TimeFrame2);

ArrayCopySeries(TimeArray3,MODE_TIME,Symbol(),TimeFrame3)。

for(i=0,y=0;i<limit;i++)

{

如果(TimeFrame1bool)

{

如果(Time<TimeArray1[y]) y++;

{

//ExtMapBuffer1

ExtMapBuffer1 = iCustom(NULL,TimeFrame1 , "#RSI-MA", 0, y);

ExtMapBuffer2 = iCustom(NULL,TimeFrame1 , "#RSI-MA",3, y);

}

}

//-----

如果(TimeFrame2bool)

{

如果(Time<TimeArray2[y])y++。

{

//ExtMapBuffer1

ExtMapBuffer3 = iCustom(NULL,TimeFrame2 , "#RSI-MA",0,y);

ExtMapBuffer4 = iCustom(NULL,TimeFrame2 , "#RSI-MA",3,y);

}

}

//-----

如果(TimeFrame3bool)

{

如果(Time<TimeArray3[y])y++。

{

//ExtMapBuffer1

ExtMapBuffer5 = iCustom(NULL,TimeFrame3 , "#RSI-MA", 0, y);

ExtMapBuffer6 = iCustom(NULL,TimeFrame3 , "#RSI-MA",3, y);

}

}

}

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

//=======================================================

return(0);

}

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

int deinit()

{

return(0);

}

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

附加的文件:
rsi-mtf_diff.jpg  290 kb
 

这是rsi-ma的一个副本........

#property indicator_separate_window

#property indicator_buffers 4

#属性 indicator_color1 LimeGreen

#属性 indicator_color2 红色

#属性 indicator_color3 黄色

#perty indicator_color4 White ////DarkGray

#属性指示器宽度1 3

#perty indicator_width2 3

#perty indicator_width3 3 #perty indicator_width3 3

#perty indicator_width4 1

#perty indicator_levelcolor Aqua

外部字符串 TimeFrame = "当前时间框架"。

extern int RsiOma_Period = 13;

Extern int RsiOma_Price = 0;

外部int RsiOma_Mode = MODE_LWMA;

外置int MaPeriod = 8;

外部int MaType = MODE_LWMA;

外置双数levelOb = 88;

外置双料levelOs = 13;

外部int OB_RSI = 80;

外置int OS_RSI = 15;

extern string note = "turn on Alert = true; turn off = false";

extern bool alertsOn = true; ///false;

extern bool alertsOnCurrent = true;

extern bool alertsMessage = true;

extern bool alertsSound = true; ///false;

外置 bool alertsEmail = false;

extern string soundfile = "connect.wav"; ///"alert2.wav";

extern string SoundUp = "ok.wav";

外部字符串SoundDown = "stop.wav"。

double rsi[];

double rsida[];

double rsidb[];

double ma[];

double mab[];

双重趋势[]。

双重斜率[]。

字符串 indicatorFileName;

int Char, timeFrame;

bool returnBars;

bool calculateValue。

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

int init()

{

IndicatorBuffers(7);

SetIndexBuffer(0,rsi);

SetIndexBuffer(1,rsida);

SetIndexBuffer(2,rsidb);

SetIndexBuffer(3,ma);

SetIndexBuffer(4,mab);

SetIndexBuffer(5,trend);

SetIndexBuffer(6,slope);

SetLevelValue(0,levelOs);

SetLevelValue(1,levelOb);

indicatorFileName = WindowExpertName();

calculateValue = (TimeFrame=="calculateValue"); 如果(calculateValue)返回(0)。

returnBars = (TimeFrame=="returnBars"); if (returnBars) return(0);

timeFrame = stringToTimeFrame(TimeFrame)。

IndicatorShortName(timeFrameToString(timeFrame)+" Rsi-Ma MaxMin ("+RsiOma_Period+", "+MaPeriod+")"。

SetIndexLabel(0, "RSI")。

SetIndexLabel(1, "RSIDA");

SetIndexLabel(2, "RSIDB");

SetIndexLabel(3, "MA")。

返回(0)。

}

int deinit() { return(0); }

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

int start()

{

int counted_bars=IndicatorCounted();

int i,limit;

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

如果(counted_bars>0) counted_bars--。

limit = MathMin(Bars-counted_bars,Bars-1)。

如果(returnBars) { rsi[0] = limit+1; return(0); }

如果(calculateValue || timeFrame==Period())

{

如果(slope[limit] == -1) ClearPoint(limit,rsida,rsidb);

for (i=limit; i >= 0; i--) mab = iMA(NULL,0,RsiOma_Period,0,RsiOma_Mode,RsiOma_Price,i)。

for (i=limit; i >= 0; i--) rsi = iRSIOnArray(mab,0,RsiOma_Period,i);

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

{

ma = iMAOnArray(rsi,0,MaPeriod,0,MaType,i)。

rsida = EMPTY_VALUE;

rsidb = EMPTY_VALUE;

斜率 = 斜率。

trend = 趋势。

如果((rsi > rsi) && (rsi > OB_RSI))

slope=1。

如果((rsi < rsi) && (rsi < OS_RSI))

slope=-1。

如果((rsi > ma) && (rsi > OB_RSI))

trend=1。

如果((rsi < ma) && (rsi < OS_RSI))

trend=-1。

如果(斜率==-1)

PlotPoint(i,rsida,rsidb,rsi);

}

manageAlerts()。

return(0);

}

limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,indicatorFileName, "returnBars",0,0)*timeFrame/Period())。

如果(slope[limit]==-1) ClearPoint(limit,rsida,rsidb)。

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

{

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

rsi = iCustom(NULL,timeFrame,indicatorFileName, "calculateValue",RsiOma_Period,RsiOma_Price,RsiOma_Mode,MaPeriod,MaType,0,y) 。

rsida = EMPTY_VALUE;

rsidb = EMPTY_VALUE;

ma = iCustom(NULL,timeFrame,indicatorFileName, "calculateValue",RsiOma_Period,RsiOma_Price,RsiOma_Mode,MaPeriod,MaType,3,y);

trend = iCustom(NULL,timeFrame,indicatorFileName, "calculateValue",RsiOma_Period,RsiOma_Price,RsiOma_Mode,MaPeriod,MaType,5,y);

slope = iCustom(NULL,timeFrame,indicatorFileName, "calculateValue",RsiOma_Period,RsiOma_Price,RsiOma_Mode,MaPeriod,MaType,6,y) 。

}

for (i=limit;i>=0;i--) if (slope==-1) PlotPoint(i,rsida,rsidb,rsi) 。

manageAlerts()。

返回(0)。

}

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

string sTfTable[] = {"M1", "M5", "M15", "M30", "H1", "H4", "D1", "W1", "MN" };

int iTfTable[] = {1,5,15,30,60,240,1440,10080,43200};

int stringToTimeFrame(string tfs)

{

tfs = stringUpperCase(tfs);

for (int i=ArraySize(iTfTable)-1; i>=0; i--)

if (tfs==sTfTable || tfs==""+iTfTable) return(MathMax(iTfTable,Period() ))。

return(Period())。

}

string timeFrameToString(int tf)

{

for (int i=ArraySize(iTfTable)-1; i>=0; i--)

if (tf==iTfTable) return(sTfTable);

return("")。

}

stringUpperCase(string str)

{

string s = str;

for (int length=StringLen(str)-1; length>=0; length--)

{

Char = StringGetChar(s, length);

如果((Char > 96 && Char 223 && Char < 256))

s = StringSetChar(s, length, Char - 32)。

否则如果(Char > -33 && Char < 0)

s = StringSetChar(s, length, Char + 224);

}

return(s);

}

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

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

{

if ((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[])

{

如果(first == EMPTY_VALUE)

{

如果(first == EMPTY_VALUE)

{

first = from;

first = from;

第二 = EMPTY_VALUE。

}

否则

{

second = from;

second = from;

first = EMPTY_VALUE;

}

}

否则

{

first = from;

second = EMPTY_VALUE;

}

}

空白管理提示()

{

如果(!calculateValue && alertsOn)

{

如果 (alertsOnCurrent)

int whichBar = 0;

否则 whichBar = 1; whichBar = iBarShift(NULL,0,iTime(NULL,timeFrame,whichBar))。

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

{

如果(trend[whichBar] ==1)

//doAlert(whichBar, "trend");

doAlerts(whichBar, "UP RSI-MA "+Symbol()+" (tf: "+Period()+")" ,SoundUp)。

如果(趋势[whichBar] ==-1)

//doAlert(whichBar, "no trend")。

doAlerts(whichBar, "DOWN RSI-MA "+Symbol()+" (tf: "+Period()+")",SoundDown)。

}

}

}

void doAlerts(int forBar, string doWhat, string SoundFile) {

静态字符串previousAlert="无"。

static datetime previousTime;

字符串信息。

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

previousAlert = doWhat;

previousTime = Time[forBar];

消息 = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," - ",timeFrameToString(timeFrame)+" rsioma ",doWhat) 。

如果(alertsMessage)警报(消息)。

如果(alertsSound) PlaySound(SoundFile);

如果(alertsEmail) SendMail(StringConcatenate(Symbol()," rsioma "),message)。

}

}

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

void doAlert(int forBar, string doWhat)

{

static string previousAlert="nothing";

static datetime previousTime;

字符串信息。

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

previousAlert = doWhat;

previousTime = Time[forBar];

消息 = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," - ",timeFrameToString(timeFrame)+" rsioma ",doWhat) 。

如果(alertsMessage) Alert(message);

如果(alertsEmail) SendMail(StringConcatenate(Symbol()," rsioma "),message)。

如果(alertsSound) PlaySound(soundfile)。

}

}

THANKS ALL.....

最好的问候

AZRUL..........

PS......我如何在这里附上这些FILES代码.....对不起,这里很乱....