顺水外汇EA交易网MT4
标题:
求助:osc指标运行无错,但没显示
[打印本页]
作者:
pang1688
时间:
2018-1-11 13:28
标题:
求助:osc指标运行无错,但没显示
求大师帮忙看看这码,怎么在附图上没显示画线呢,谢谢!!
//+------------------------------------------------------------------+
//| TSI-Osc.mq4 |
//| Copyright ?2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_maximum 100
#property indicator_minimum -100
#property indicator_level1 0
#property indicator_level2 50
#property indicator_level3 -50
//---- input parameters
// M5 and M15 , 8,8,8
// M30 7,7,7
// H1 and H4 6,6,6
extern int First_R = 7;
extern int Second_S = 7;
extern int SignalPeriod = 7;
//---- buffers
double TSI_Buffer[];
double SignalBuffer[];
double MTM_Buffer[];
double EMA_MTM_Buffer[];
double EMA2_MTM_Buffer[];
double ABSMTM_Buffer[];
double EMA_ABSMTM_Buffer[];
double EMA2_ABSMTM_Buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(8);
SetIndexBuffer(2, MTM_Buffer);
SetIndexBuffer(3, EMA_MTM_Buffer);
SetIndexBuffer(4, EMA2_MTM_Buffer);
SetIndexBuffer(5, ABSMTM_Buffer);
SetIndexBuffer(6, EMA_ABSMTM_Buffer);
SetIndexBuffer(7, EMA2_ABSMTM_Buffer);
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, TSI_Buffer);
SetIndexLabel(0, "TSI");
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(1, SignalBuffer);
SetIndexLabel(1, "Signal");
//----
IndicatorShortName("TSIOsc" + "(" + First_R + "," + Second_S + "," + SignalPeriod + ")");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars = IndicatorCounted();
int limit, i;
limit = Bars - counted_bars - 1;
for(i = Bars - 1; i >= 0; i--)
{
MTM_Buffer[i] = (Close[i] - Close[i+1]);
MTM_Buffer[i]=((High[i]+Low[i])/2)-((High[i+1]+Low[i+1])/2);
MTM_Buffer[i]=(((Close[i]-Close[i+1])/Close[i+1])+Point);
MTM_Buffer[i]=iMomentum(NULL,0,1,PRICE_CLOSE,i)-iMomentum(NULL,0,1,PRICE_CLOSE,i+1);
MTM_Buffer[i]=iMomentum(NULL,0,1,PRICE_CLOSE,i)-iMomentum(NULL,0,1,PRICE_CLOSE,i+1);
MTM_Buffer[i]=iMomentum(NULL,0,1,PRICE_CLOSE,i)-iMomentum(NULL,0,1,PRICE_CLOSE,i+1);
ABSMTM_Buffer[i] = MathAbs(MTM_Buffer[i]);
}
for(i = Bars - 1; i >= 0; i--)
{
EMA_MTM_Buffer[i] = iMAOnArray(MTM_Buffer, 0, First_R, 0, MODE_EMA, i);
EMA_ABSMTM_Buffer[i] = iMAOnArray(ABSMTM_Buffer, 0, First_R, 0, MODE_EMA, i);
}
for(i = Bars - 1; i >= 0; i--)
{
EMA2_MTM_Buffer[i] = iMAOnArray(EMA_MTM_Buffer, 0, Second_S, 0, MODE_EMA, i);
EMA2_ABSMTM_Buffer[i] = iMAOnArray(EMA_ABSMTM_Buffer, 0, Second_S, 0, MODE_EMA, i);
}
for(i = limit; i >= 0; i--)
{
TSI_Buffer[i] = 100.0*EMA2_MTM_Buffer[i] / EMA2_ABSMTM_Buffer[i];
}
for(i = limit; i >= 0; i--)
{
SignalBuffer[i] = iMAOnArray(TSI_Buffer, 0, SignalPeriod, 0, MODE_EMA, i);
}
return(0);
}
//+------------------------------------------------------------------+
作者:
panda88
时间:
2018-1-11 13:56
找大师帮忙
作者:
pang1688
时间:
2018-1-11 14:49
求大师现身
作者:
siung85
时间:
2018-1-11 15:54
感谢分享。
作者:
wbl_1
时间:
2018-1-11 16:45
哪个呦,发这么好的帖子,顶你
作者:
ggg750075
时间:
2018-1-11 17:19
顶你顶你顶你
作者:
349309448
时间:
2018-1-11 18:03
谢谢分享
作者:
wbl_1
时间:
2018-1-11 18:11
没看完~~~~~~ 先顶,好同志
作者:
wbl_1
时间:
2018-1-11 19:43
参考参考,我认为很好,大家说说
作者:
wbl_1
时间:
2018-1-11 20:43
要顶的啊,楼主辛苦了,谢谢
作者:
wbl_1
时间:
2018-1-11 21:48
我顶啊。接着顶
作者:
wbl_1
时间:
2018-1-11 22:35
真的牛,双手赞成,谢谢了
作者:
wbl_1
时间:
2018-1-11 22:54
感激涕零,谢谢楼主的好贴
作者:
wbl_1
时间:
2018-1-12 00:04
真不错,赞一个,继续努力啊
作者:
wbl_1
时间:
2018-1-12 01:37
这么好的帖子不顶就太对不起楼主了
欢迎光临 顺水外汇EA交易网MT4 (http://waterforex.com/)
Powered by Discuz! X3.2