darma system
//+------------------------------------------------------------------+
//| Darma System Indicator (beta).mq4 |
//| tonyc2a@yahoo.com |
//| |
//+------------------------------------------------------------------+
#property copyright "tonyc2a@yahoo.com"
#property link ""
#property indicator_chart_window
#property indicator_buffers 4
//---- input parameters
extern int WingDings_Symbol = 108;
//---- buffers
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];
double Buffer5[];
double Buffer6[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2,Blue);
SetIndexBuffer(0,Buffer1);
SetIndexLabel(0,"Blue Bar");
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2,Red);
SetIndexBuffer(1,Buffer2);
SetIndexLabel(1,"Red Bar");
SetIndexStyle(2,DRAW_ARROW,STYLE_DOT,2,Blue);
SetIndexBuffer(2,Buffer3);
SetIndexLabel(2,"Blue Dot");
SetIndexArrow(2,WingDings_Symbol);
SetIndexStyle(3,DRAW_ARROW,STYLE_DOT,2,Red);
SetIndexBuffer(3,Buffer4);
SetIndexLabel(3,"Red Dot");
SetIndexArrow(3,WingDings_Symbol);
//SetIndexStyle(4,DRAW_SECTION,STYLE_SOLID,1,Blue);
//SetIndexBuffer(4,Buffer5);
//SetIndexLabel(4,"Blue");
//SetIndexStyle(5,DRAW_SECTION,STYLE_SOLID,1,Red);
//SetIndexBuffer(5,Buffer6);
//SetIndexLabel(5,"Red");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//---- TODO: add your code here
int adjustment=0; //change this value to make the indicator behave slightly differently. valid values are 0-4.
int periods=3;
int extremes=0;
double smin, smax, SsMax, SsMin, pivothi, pivotlo, margins;
bool flag1, flag2;
for(int i=0;i<Bars;i++){
if(extremes!=0){
SsMax = High;
SsMin = Low;
}
else{
SsMax = Open;
SsMin = Open;
}
smin = SsMin+(SsMax-SsMin)*margins/100;
smax = SsMax-(SsMax-SsMin)*margins/100;
pivothi=((2*High)+Low+(2*Close))/5;
pivotlo=(High+(2*Low)+(2*Close))/5;
if(pivotlo>smin && pivothi>smax) flag1=true; else flag1=false;
if(pivothi<smax && pivotlo<smin) flag2=true; else flag2=false;
if(flag1){
Buffer1=High;
Buffer2=Low;
}
if(flag2){
Buffer1=Low;
Buffer2=High;
}
double sig=iSAR(NULL,0,0.5,1,i);
if(sig<Low) Buffer3=sig;
if(sig>High) Buffer4=sig;
/*
double sig2=iSAR(NULL,0,1,0.2,i);
if(sig2<Low) {Buffer5=sig2; Buffer6=-1;}
if(sig2>High) {Buffer6=sig2; Buffer5=-1;}
*/
}//end for
//----
return(0);
}
//+------------------------------------------------------------------+
用试试,看看效果是不是及时 我抢、我抢、我抢沙发~ 谢谢楼主分享 学习了,不错 谢谢楼主分享 谢谢楼主分享 谢谢楼主分享 帮你顶下哈!! 帮你顶下哈!!
页:
[1]
2