2楼
zoom out 再看一下........
有多乱的.........Snap3.png
韬客社区www.talkfx.co
3楼
//+------------------------------------------------------------------+
//| rsi_test.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright " "
#property link ""
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Black
#property indicator_color2 Black
//---- input parameters
extern int buys=30;
extern int sells=70;
extern int periods=9;
//---- buffers
double ExtMapBuffer1;
double ExtMapBuffer2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW,0,1);
SetIndexArrow(0,234);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW,0,1);
SetIndexArrow(1,233);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(int i=0; isells){
//sell signal
if(iRSI(NULL,0,periods,PRICE_CLOSE,i-1)iRSI(NULL,0,periods,PRICE_CLOSE,i) && iRSI(NULL,0,periods,PRICE_CLOSE,i-1)>buys && iRSI(NULL,0,periods,PRICE_CLOSE,i-2)>buys && iRSI(NULL,0,periods,PRICE_CLOSE,i-1) !=0){
ExtMapBuffer2=Low-3*Point;
}
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
韬客社区www.talkfx.co
发表于:2005-11-27 13:43只看该作者
4楼
你没有清空这样当新的历史数据过来时候就会和以前的数据重叠从而出现那种情况, 修正该问题后的代码如下:
//+------------------------------------------------------------------+
//| rsi_test.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright " "
#property link ""
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- input parameters
extern int buys=30;
extern int sells=70;
extern int periods=9;
//---- buffers
double ExtMapBuffer1;
double ExtMapBuffer2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW,0,1);
SetIndexArrow(0,234);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW,0,1);
SetIndexArrow(1,233);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int pos;
if (Bars < periods) return (0);
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
pos=Bars-counted_bars-1;
int i;
//---- zero initial values
if(counted_bars<1) {
for(i=1;i=2; i--){
rsi0 = iRSI(NULL,0,periods,PRICE_CLOSE,i);
rsi1 = iRSI(NULL,0,periods,PRICE_CLOSE,i-1);
rsi2 = iRSI(NULL,0,periods,PRICE_CLOSE,i-2);
if(rsi0 > sells && rsi1 < rsi0 && rsi1 < sells && rsi2 < sells && rsi1 != 0) {
//sell signal
ExtMapBuffer1=High+3*Point;
} else {
ExtMapBuffer1=0;
}
if(rsi0 < buys && rsi1 > rsi0 && rsi1 > buys && rsi2 > buys && rsi1 !=0){
//buy signal
ExtMapBuffer2=Low-3*Point;
} else {
ExtMapBuffer2=0;
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
韬客社区www.talkfx.co
5楼
:)
谢谢 , 先去研究一下
韬客社区www.talkfx.co
发表于:2005-12-20 01:57只看该作者
6楼
韬客还有这样的技术专家啊?
猜顶猜底要不的
逆势而为最危险
发表于:2005-12-22 04:25只看该作者
7楼
藏龙卧虎!
韬客社区www.talkfx.co