2楼
下面是网上找到的代码,可是我运行不成功
#property link "[email protected]"
#property copyright "?2006, mankurt"
#property indicator_chart_window
//+------------------------------------------------------------------------------------------------+
extern int TimeFrame=60;
extern color UpCandle=DarkGreen;
extern color DnCandle=Purple;
extern color DojiColor=Blue;
extern int Width=1;
extern boolBGCandle=True;
//+------------------------------------------------------------------------------------------------+
int Nbar,OpenBar,timer,i,timerTF,name,MidBar;
double HighPrevBar,LowPrevBar,ClosePrevBar;
double OpenNewBar,HighNewBar,LowNewBar,CloseNewBar;
double HighCurBar,LowCurBar,CloseCurBar;
double priceNewSH,priceNewSL,pricePrevSH,pricePrevSL,priceCurSH,priceCurSL;
string nameNewCandle,namePrevCandle;
string nameNewShadowH,nameNewShadowL,namePrevShadowH,namePrevShadowL;
string NameBar, NameHigh, NameLow;
datetime TimeOpenNewBar,TimeCloseNewBar,TimeClosePrevBar;
datetime timeNewShadow,timePrevShadow;
bool NewBar;
//+------------------------------------------------------------------------------------------------+
int init(){
IndicatorShortName("M"+TimeFrame+" 磬 M"+Period());
Nbar=TimeFrame/Period();
timer=Period()*60;
timerTF=TimeFrame*60;
name=0;
TimeOpenNewBar=Time;
OpenNewBar=Open;
NewBar=false;
NameBar="Bar M"+TimeFrame+"-";
NameHigh="High M"+TimeFrame+"-";
NameLow="Low M"+TimeFrame+"-";
return(0);}
//+------------------------------------------------------------------------------------------------+
int deinit(){
for(int DelOBJ=1; DelOBJ<=name; DelOBJ++){
ObjectDelete(NameBar+DelOBJ);
ObjectDelete(NameHigh+DelOBJ);
ObjectDelete(NameLow+DelOBJ);}
Comment("");
return(0);}
//+------------------------------------------------------------------------------------------------+
int start(){
if(TimeFrame>1440)
{Comment("\n"," TimeFrame more than D1 is not supporting!!!");return(0);}
if(Period()>240)
{Comment("\n"," Period more than H4 is not supporting!!!");return(0);}
if(TimeFrame<=Period()||MathMod(TimeFrame,Period())!=0)
{Comment("\n"," TimeFrame should be more or divisible by M",Period());return(0);}
i=Bars-IndicatorCounted();
while(i>0){i--;
while(i>=0) if(Time==TimeOpenNewBar||BarNew(i,TimeFrame)==false)i--;
else{NewBar=true; name++; break;}
if(i<0) i=0;
if(NewBar==true){
//+-----------------------------------------Previos Bar--------------------------------------------+
OpenBar=iBarShift(0,0,TimeOpenNewBar,false);
TimeClosePrevBar=Time;
ClosePrevBar=Close;
HighPrevBar=High;
LowPrevBar=Low;
namePrevCandle=NameBar+(name-1);
MidBar=OpenBar-MathRound((OpenBar-i)/2);
timePrevShadow=Time;
pricePrevSH=PriceShadow(OpenNewBar,ClosePrevBar,0);
pricePrevSL=PriceShadow(OpenNewBar,ClosePrevBar,1);
namePrevShadowH=NameHigh+(name-1);
namePrevShadowL=NameLow+(name-1);
//+----------------------------------Modifi Previos Bar & Shadow-----------------------------------+
if(ObjectFind(namePrevCandle)==0){
ObjectMove(namePrevCandle,1,TimeClosePrevBar,ClosePrevBar);
PropBar(OpenNewBar,ClosePrevBar,namePrevCandle);
if(OpenBar==i+1) ObjectSet(namePrevCandle,OBJPROP_WIDTH, Width*3);}
if(ObjectFind(namePrevShadowH)==0){
if(pricePrevSH==HighPrevBar) ObjectDelete(namePrevShadowH);
else{ObjectMove(namePrevShadowH,0,timePrevShadow,pricePrevSH);
ObjectMove(namePrevShadowH,1,timePrevShadow,HighPrevBar);
ColorShadow(OpenNewBar,ClosePrevBar,namePrevShadowH);
ObjectSetText(namePrevShadowH,"High="+DoubleToStr(HighPrevBar,Digits),7,"Tahoma");}}
if(ObjectFind(namePrevShadowL)==0){
if(pricePrevSL==LowPrevBar) ObjectDelete(namePrevShadowL);
else{ObjectMove(namePrevShadowL,0,timePrevShadow,pricePrevSL);
ObjectMove(namePrevShadowL,1,timePrevShadow,LowPrevBar);
ColorShadow(OpenNewBar,ClosePrevBar,namePrevShadowL);
ObjectSetText(namePrevShadowL,"Low="+DoubleToStr(LowPrevBar,Digits),7,"Tahoma");}}
//+-------------------------------------------New Bar----------------------------------------------+
OpenNewBar=Open;
TimeOpenNewBar=Time;
HighNewBar=High;
LowNewBar=Low;
CloseNewBar=Close;
TimeCloseNewBar=Time+timerTF-timer;
nameNewCandle=NameBar+name;
timeNewShadow=Time+MathRound(Nbar/2)*timer;
priceNewSH=PriceShadow(OpenNewBar,CloseNewBar,0);
priceNewSL=PriceShadow(OpenNewBar,CloseNewBar,1);
nameNewShadowH=NameHigh+name;
nameNewShadowL=NameLow+name;
NewBar=false;}
else{
//+------------------------------------------Current Bar-------------------------------------------+
OpenBar=iBarShift(0,0,TimeOpenNewBar,false);
CloseCurBar=Close;
HighCurBar=High;
LowCurBar=Low;
priceCurSH=PriceShadow(OpenNewBar,CloseCurBar,0);
priceCurSL=PriceShadow(OpenNewBar,CloseCurBar,1);}
//+------------------------------Create New Object & Modifi Current--------------------------------+
if(ObjectFind(nameNewCandle)!=0){
ObjectCreate(nameNewCandle,OBJ_RECTANGLE,0,TimeOpenNewBar,OpenNewBar,TimeCloseNewBar,CloseNewBar);
ObjectSet(nameNewCandle,OBJPROP_STYLE, STYLE_SOLID);
PropBar(OpenNewBar,CloseNewBar,nameNewCandle);}
else{
ObjectMove(nameNewCandle,1,TimeCloseNewBar,CloseCurBar);
PropBar(OpenNewBar,CloseCurBar,nameNewCandle);}
if(ObjectFind(nameNewShadowH)!=0){
ObjectCreate(nameNewShadowH,OBJ_TREND,0,timeNewShadow,priceNewSH,timeNewShadow,HighNewBar);
ObjectSet(nameNewShadowH,OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(nameNewShadowH,OBJPROP_WIDTH, Width);
ObjectSet(nameNewShadowH,OBJPROP_RAY, false);
ColorShadow(OpenNewBar,CloseNewBar,nameNewShadowH);}
else{
ObjectMove(nameNewShadowH,0,timeNewShadow,priceCurSH);
ObjectMove(nameNewShadowH,1,timeNewShadow,HighCurBar);
ColorShadow(OpenNewBar,CloseCurBar,nameNewShadowH);}
if(ObjectFind(nameNewShadowL)!=0){
ObjectCreate(nameNewShadowL,OBJ_TREND,0,timeNewShadow,priceNewSL,timeNewShadow,LowNewBar);
ObjectSet(nameNewShadowL,OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(nameNewShadowL,OBJPROP_WIDTH, Width);
ObjectSet(nameNewShadowL,OBJPROP_RAY, false);
ColorShadow(OpenNewBar,CloseNewBar,nameNewShadowL);}
else{
ObjectMove(nameNewShadowL,0,timeNewShadow,priceCurSL);
ObjectMove(nameNewShadowL,1,timeNewShadow,LowCurBar);
ColorShadow(OpenNewBar,CloseCurBar,nameNewShadowL);}}
//+-------------------------------------Comment OHLC-----------------------------------------------+
Comment(Symbol(),",M",TimeFrame," O=",OpenNewBar,",H=",HighCurBar,
",L=",LowCurBar,",C=",CloseCurBar,"\n");
return(0);}
//+---------------------Main Function "New Bar or Old Bar"-----------------------------------------+
bool BarNew (int j, int tmf)
{int t0=1440*(TimeDayOfWeek(Time)-1)+60*TimeHour(Time)+TimeMinute(Time),
t1=1440*(TimeDayOfWeek(Time)-1)+60*TimeHour(Time)+TimeMinute(Time);
if(MathMod(t0,tmf)-MathMod(t1,tmf)==t0-t1)return(false);
else return(true);}
//+---------------------Function "Price Shadow"----------------------------------------------------+
double PriceShadow (double OpnB, double ClsB, int swt)
{double prH, prL;
if(OpnBClsB){prH=OpnB; prL=ClsB;}
if(OpnB==ClsB){prH=ClsB; prL=ClsB;}
switch(swt){case 0:return(prH);break;
case 1:return(prL);break;}}
//+---------------------Function "Properti Bars"---------------------------------------------------+
void PropBar (double OpPr, double ClPr, string NmOBJ)
{string Cl=" Close="+DoubleToStr(ClPr,Digits);
string Op=" Open="+DoubleToStr(OpPr,Digits);
if(OpPr==ClPr){ObjectSet(NmOBJ,OBJPROP_BACK, false);
ObjectSet(NmOBJ,OBJPROP_COLOR,DojiColor);
ObjectSetText(NmOBJ,"Doji "+Op+Cl,7,"Tahoma");}
if(OpPrClPr){ObjectSet(NmOBJ,OBJPROP_COLOR,DnCandle);
ObjectSet(NmOBJ,OBJPROP_BACK, BGCandle);
ObjectSetText(NmOBJ,"DnBar "+Op+Cl,7,"Tahoma");}
ObjectSet(NmOBJ,OBJPROP_WIDTH, Width);}
//+----------------------Function "Color Shadow"---------------------------------------------------+
void ColorShadow (double OP, double CP, string NOBJ)
{if(OP==CP)ObjectSet(NOBJ,OBJPROP_COLOR,DojiColor);
if(OPCP)ObjectSet(NOBJ,OBJPROP_COLOR,DnCandle);}
//+----------------------------------------------END-----------------------------------------------+
韬客社区www.talkfx.co
发表于:2017-08-17 05:12只看该作者
3楼
原图的哪里看到的??????
韬客社区www.talkfx.co
发表于:2017-08-17 05:24只看该作者
4楼
难点不是在切换周期按钮上,而是附图如何显示蜡烛线
韬客社区www.talkfx.co
发表于:2017-08-17 05:34只看该作者
5楼
你用代码模式发代码 就是<>这个图标点一下,黏贴代码,不然代码中很多东西都 没有了
韬客社区www.talkfx.co
发表于:2017-08-17 05:37只看该作者
6楼
不用发了,我找到你贴的代码了,和你主图的内容不是同一指标吧
韬客社区www.talkfx.co
发表于:2017-08-17 05:47只看该作者
7楼
韬客社区www.talkfx.co
发表于:2017-08-17 05:51只看该作者
8楼
scalping 发表于 2017-8-17 13:47
下面的明显的不是副图,两张都是主图。不知道怎么弄到一起去的。
点评
发表于 2017-08-17 06:00
韬客社区www.talkfx.co
发表于:2017-08-17 06:00只看该作者
9楼
tempasdf 发表于 2017-8-17 13:51
明白人,以前也见过类似的一张图,那图是把副图显示在主图的上面....
点评
发表于 2017-08-17 06:30
发表于:2017-08-17 06:30只看该作者
10楼
scalping 发表于 2017-8-17 14:00
我是看见代码的第三行写着这个指标使用主图。
点评
发表于 2017-08-17 07:44
韬客社区www.talkfx.co
发表于:2017-08-17 06:40只看该作者
11楼
看了一下程序,这个就是在小周期上显示大周期K线的程序,比如在H1周期上显示,结果就是一个H4的大K线套住4个H1周期的小K线。
大周期的值通过参数设定,比如TimeFrame=60是H1,240是H4
12楼
tempasdf 发表于 2017-8-17 14:30
楼主发的代码是这个样的,和他发图的效果不是一个意思
韬客社区www.talkfx.co
13楼
scalping 发表于 2017-8-17 13:47
下面的明显的不是副图,两张都是主图。不知道怎么弄到一起去的。
韬客社区www.talkfx.co
15楼
tempasdf 发表于 2017-8-17 17:56
p的图呀? 那就别想了,做不到,还是为是别人的指标做出来的
韬客社区www.talkfx.co
发表于:2017-08-18 02:07只看该作者
16楼
韬客社区www.talkfx.co
17楼
scalping 发表于 2017-8-18 10:07
楼主这个程序还是不错的。 比如我把M5和H1的图套在一起,基本上没有研究H1裸K的必要了。
韬客社区www.talkfx.co
发表于:2017-08-18 02:16只看该作者
18楼
看到你还在研究k线,我长舒一口气
19楼
scalping 发表于 2017-8-18 10:07
楼主这个程序还是不错的。 比如我把M5和H1的图套在一起,基本上没有研究H1裸K的必要了。
点评
发表于 2017-08-18 05:41
韬客社区www.talkfx.co
韬客社区www.talkfx.co