求翻译MT4 的德马克 [开拓者 TB]
- 咨询内容: //---- indicator settings
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Green
extern color BuySetup=Red;
extern color SellSetup=Green;
extern color Countdown=Orange;
//---- indicator parameters
//---- indicator buffers
double R[];
double G[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW,0,1.5);
SetIndexBuffer(0,R);
SetIndexArrow(0,234);
SetIndexStyle(1,DRAW_ARROW,0,1.5);
SetIndexBuffer(1,G);
SetIndexArrow(1,233);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
for(int i=0;i<Bars;i++) {
ObjectDelete(""+i);
ObjectDelete("cd"+i); }
return(0);
}
//+------------------------------------------------------------------+
//| TD Sequential |
//+------------------------------------------------------------------+
int start()
{
int bc=0;
int sc=0;
double tfm=Point*MathSqrt(Period())/1.05;
double tfm2=Point*MathSqrt(Period());
int x;
int fbc=0;
int fsc=0;
double low;
double high;
int bcd=0;
int scd=0;
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars+10;
for(int i=limit; i>0; i--) {
//+-- Buy Setup Start --|
if(Close[i]<Close[i+4] && Close[i+1]>=Close[i+5] && bc==0) {
bc=1;
ObjectCreate(""+i,OBJ_TEXT,0,Time[i],High[i]+tfm);
ObjectSetText(""+i,""+bc,8,"Arial",BuySetup);
fbc=i;
scd=0;}
if(Close[i]<Close[i+4] && bc!=0 && ObjectFind(""+i)==-1 && fbc!=i) {
bc++;
if(bc==9) {
if(Low[i+2]>Low[i+3]) low=Low[i+3];
else low=Low[i+2];
if(Low[i]<low || Low[i+1]<low) {
ObjectCreate(""+i,OBJ_TEXT,0,Time[i],High[i]+tfm);
ObjectSetText(""+i,""+bc,10,"Arial Black",BuySetup); }
else {
ObjectCreate(""+i,OBJ_TEXT,0,Time[i],High[i]+tfm);
ObjectSetText(""+i,""+bc,8,"Arial",BuySetup); }
bc=0;
G[i]=Low[i]-tfm2;
if(bcd==0) bcd=1; }
else {
ObjectCreate(""+i,OBJ_TEXT,0,Time[i],High[i]+tfm);
ObjectSetText(""+i,""+bc,8,"Arial",BuySetup); } }
else if(Close[i]>=Close[i+4]) {
for(x=i+1; x<=i+bc; x++) ObjectDelete(""+x);
bc=0; }
if(bcd==1) bcd=-1*i;
if(bcd==-1*(i+1)) bcd=1;
if(bcd==13 && Close[i]<=Close[i+5]) {
ObjectCreate("cd"+i,OBJ_TEXT,0,Time[i],High[i]+tfm*2.5);
ObjectSetText("cd"+i,""+bcd,8,"Arial Black",Countdown);
bcd=0; }
if(bcd==13 && Close[i]<=Close[i+2] && Close[i]>Close[i+5]) {
ObjectCreate("cd"+i,OBJ_TEXT,0,Time[i],High[i]+tfm*2.5);
ObjectSetText("cd"+i,""+bcd,8,"Arial",Countdown);
bcd=0; }
if(bcd>=1 && Close[i]<=Close[i+2] && bcd<13) {
ObjectCreate("cd"+i,OBJ_TEXT,0,Time[i],High[i]+tfm*2.5);
ObjectSetText("cd"+i,""+bcd,8,"Arial",Countdown);
bcd++; }
//+-- Sell Setup Start --|
if(Close[i]>Close[i+4] && Close[i+1]<=Close[i+5] && sc==0) {
sc=1;
ObjectCreate(""+i,OBJ_TEXT,0,Time[i],Low[i]-tfm);
ObjectSetText(""+i,""+sc,8,"Arial",SellSetup);
fsc=i;
bcd=0;}
if(Close[i]>Close[i+4] && sc!=0 && fsc!=i && ObjectFind(""+i)==-1) {
sc++;
if(sc==9) {
if(High[i+2]>High[i+3]) high=High[i+2];
else high=High[i+3];
if(High[i]>high || High[i+1]>high) {
ObjectCreate(""+i,OBJ_TEXT,0,Time[i],Low[i]-tfm);
ObjectSetText(""+i,""+sc,10,"Arial Black",SellSetup); }
else {
ObjectCreate(""+i,OBJ_TEXT,0,Time[i],Low[i]-tfm);
ObjectSetText(""+i,""+sc,8,"Arial",SellSetup); }
sc=0;
R[i]=High[i]+tfm2;
if(scd==0) scd=1; }
else {
ObjectCreate(""+i,OBJ_TEXT,0,Time[i],Low[i]-tfm);
ObjectSetText(""+i,""+sc,8,"Arial",SellSetup); } }
else if(Close[i]<=Close[i+4]) {
for(x=i+1; x<=i+sc; x++) ObjectDelete(""+x);
sc=0; }
if(scd==1) scd=-1*i;
if(scd==-1*(i+1)) scd=1;
if(scd==13) {
if(Close[i]>=Close[i+5]) {
ObjectCreate("cd"+i,OBJ_TEXT,0,Time[i],Low[i]-tfm*2.5);
ObjectSetText("cd"+i,""+scd,8,"Arial Black",Countdown);
scd=0; }
if(Close[i]>=Close[i+2] && Close[i]<Close[i+5]) {
ObjectCreate("cd"+i,OBJ_TEXT,0,Time[i],Low[i]-tfm*2.5);
ObjectSetText("cd"+i,""+scd,8,"Arial",Countdown);
scd=0; }}
if(scd>=1 && Close[i]>=Close[i+2] && scd<13) {
ObjectCreate("cd"+i,OBJ_TEXT,0,Time[i],Low[i]-tfm*2.5);
ObjectSetText("cd"+i,""+scd,8,"Arial",Countdown);
scd++; }
}
return(0);
}
//+------------------------------------------------------------------+
- TB技术人员:
QQ截图20130331005331.png (12.15 KB, 下载次数: 0) 前天 00:53 上传下载次数: 0
这个是干什么用的,怎么用 什么周期下?有用的话或许会用TB照写一个 - TB客服: 剔除那些有关指标显示有关的代码,核心的程序没几条。就是几个收盘价的比较逻辑而已。
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 262069696 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容