Próbowałem różnych składni i żadna nie wyświetla mi tekstu
z tą składnią także choć wydaje mi się odpowiednia
Kod: Zaznacz cały
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 LightBlue
#property indicator_color2 Tomato
#property indicator_color3 Aqua
#property indicator_color4 Orange
extern int CountPeriods=10;
extern string TimePeriod="W1";
extern bool Plot_pivots=true;
extern bool Plot_middle=False;
extern bool Plot_camarilla=false;
datetime time1;
datetime time2;
double open,close,high,low;
double P,R1,R2,R3,S1,S2,S3,M0,M1,M2,M3,M4,M5;
double H1,H2,H3,H4,L1,L2,L3,L4,Range;
double pstyle, mstyle,cstyle;
int shift, num, period;
void ObjDel()
{
for (;num<=CountPeriods;num++)
{
ObjectDelete("WCP["+num+"]");
ObjectDelete("WR1["+num+"]");
ObjectDelete("WR2["+num+"]");
ObjectDelete("WR3["+num+"]");
ObjectDelete("WS1["+num+"]");
ObjectDelete("WS2["+num+"]");
ObjectDelete("WS3["+num+"]");
ObjectDelete("WM0["+num+"]");
ObjectDelete("WM1["+num+"]");
ObjectDelete("WM2["+num+"]");
ObjectDelete("WM3["+num+"]");
ObjectDelete("WM4["+num+"]");
ObjectDelete("WM5["+num+"]");
ObjectDelete("WH1["+num+"]");
ObjectDelete("WH2["+num+"]");
ObjectDelete("WH3["+num+"]");
ObjectDelete("WH4["+num+"]");
ObjectDelete("WL1["+num+"]");
ObjectDelete("WL2["+num+"]");
ObjectDelete("WL3["+num+"]");
ObjectDelete("WL4["+num+"]");
}
}
void PlotLine(string name,double value,double line_color,double style)
{
ObjectCreate(name,OBJ_TREND,0,time1,value,time2,value);
ObjectSet(name, OBJPROP_WIDTH, 1);
ObjectSet(name, OBJPROP_STYLE, style);
ObjectSet(name, OBJPROP_RAY, false);
ObjectSet(name, OBJPROP_BACK, true);
ObjectSet(name, OBJPROP_COLOR, line_color);
}
int init()
{
if (TimePeriod=="H1" || TimePeriod=="60") period=PERIOD_H1;
else
if (TimePeriod=="H4" || TimePeriod=="240") period=PERIOD_H4;
else
if (TimePeriod=="D1" || TimePeriod=="1440") period=PERIOD_D1;
else
if (TimePeriod=="W1" || TimePeriod=="10080") period=PERIOD_W1;
else
if (TimePeriod=="MN" || TimePeriod=="43200") period=PERIOD_MN1;
else
{
Comment("Wrong TimePeriod. Must be H1, H4, D1, W1 or MN");
return(0);
}
return(0);
}
int deinit()
{
ObjDel();
Comment("");
return(0);
}
int start()
{
int i;
ObjDel();
num=0;
for (shift=CountPeriods-1;shift>=0;shift--)
{
time1=iTime(NULL,period,shift);
high = iHigh(NULL,period,shift+1);
low = iLow(NULL,period,shift+1);
open = iOpen(NULL,period,shift+1);
close = iClose(NULL,period,shift+1);
P = (high+low+close)/3.0;
R1 = 2*P-low;
R2 = P+(high - low);
R3 = (2*P)+(high-(2*low));
S1 = 2*P-high;
S2 = P-(high - low);
S3 = (2*P)-((2*high)-low);
M0=0.5*(S2+S3);
M1=0.5*(S1+S2);
M2=0.5*(P+S1);
M3=0.5*(P+R1);
M4=0.5*(R1+R2);
M5=0.5*(R2+R3);
Range = high - low;
H4 = close + (Range * 1.1/2.0);
H3 = close + (Range * 1.1/4.0);
H2 = close + (Range * 1.1/6.0);
H1 = close + (Range * 1.1/12.0);
L1 = close - (Range * 1.1/12.0);
L2 = close - (Range * 1.1/6.0);
L3 = close - (Range * 1.1/4.0);
L4 = close - (Range * 1.1/2.0);
time2=time1+period*60;
pstyle=1;
mstyle=3;
cstyle=1;
num=shift;
PlotLine("WCP["+num+"]",P,Gray,pstyle);
if(Plot_pivots)
{
PlotLine("WR1["+num+"]",R1,Red,pstyle);
PlotLine("WR2["+num+"]",R2,FireBrick,pstyle);
PlotLine("WR3["+num+"]",R3,Maroon,pstyle);
PlotLine("WS1["+num+"]",S1,Lime,pstyle);
PlotLine("WS2["+num+"]",S2,Green,pstyle);
PlotLine("WS3["+num+"]",S3,DarkGreen,pstyle);
}
if(Plot_middle)
{
PlotLine("WM0["+num+"]",M0,White,pstyle);
PlotLine("WM1["+num+"]",M1,White,pstyle);
PlotLine("WM2["+num+"]",M2,White,pstyle);
PlotLine("WM3["+num+"]",M3,White,pstyle);
PlotLine("WM4["+num+"]",M4,White,pstyle);
PlotLine("WM5["+num+"]",M5,White,pstyle);
}
if(Plot_camarilla)
{
PlotLine("WH4["+num+"]",H4,LightBlue,cstyle);
PlotLine("WH3["+num+"]",H3,DeepSkyBlue,cstyle);
PlotLine("WH2["+num+"]",H2,MediumSlateBlue,cstyle);
PlotLine("WH1["+num+"]",H1,RoyalBlue,cstyle);
PlotLine("WL1["+num+"]",L1,Chocolate,cstyle);
PlotLine("WL2["+num+"]",L2,Orange,cstyle);
PlotLine("WL3["+num+"]",L3,Goldenrod,cstyle);
PlotLine("WL4["+num+"]",L4,Yellow,cstyle);
}
{
ObjectCreate ( "WCP["+num+"]" , OBJ_LABEL , 0 , 0 ,P ) ;
ObjectSetText ("WCP["+num+"]" , " PIVIOT " , 10 , " Ariel " , Red ) ;
ObjectSet ( "WCP["+num+"]" , OBJPROP_CORNER , 0 ) ;
ObjectMove("WCP["+num+"]", 0, 0,0);
}
}
return(0);
}
//+------------------------------------------------------------------+
-- Dodano: ndz 21-08-2016, 11:24 --
Zmieniłem tak że wyświetla mi tekst ale w innym miejscu niż ,a być. powinno byc przy lini pivota, nie moge rozgryść gdzie popełniam błąd.
Kod: Zaznacz cały
//+------------------------------------------------------------------+
//| Fibo pivots ROGER |
//| Copyright © 2016,|
//| Written by Roger r.suwala@wp.pl |
//+------------------------------------------------------------------+
#property copyright "Fibo pivots ROGER"
#property indicator_chart_window
#property indicator_buffers 5
extern int CountPeriods=10;
extern string TimePeriod="W1";
extern bool Plot_pivots=true;
extern bool pivot_Month=false;
extern string FontName = "Arial";
extern int FontSize = 10;
extern int LabelCandleOffset=3;
extern string comment1 = "";
extern string comment2 = "Weekle PIVOT";
extern color chose_color_pivot = clrBlue;
extern color label_color_pivot = clrBlue;
extern int width_of_pivot_line = 1;
extern int line_style_of_pivot = 0;
extern string comment3 = "Weekle R";
extern color chose_color_Wr38 = clrYellow;
extern color label_color_Wr38 = clrYellow;
extern color chose_color_Wr61 = clrLime;
extern color label_color_Wr61 = clrLime;
extern color chose_color_Wr78 = clrRed;
extern color label_color_Wr78 = clrRed;
extern color chose_color_Wr100 = clrAqua;
extern color label_color_Wr100 = clrAqua;
extern color chose_color_Wr138 = clrOrange;
extern color label_color_Wr138 = clrOrange;
extern color chose_color_Wr161 = clrBrown;
extern color label_color_Wr161 = clrBrown;
extern color chose_color_Wr200 = clrBlack;
extern color label_color_Wr200 = clrBlack;
extern string comment4 = "Weekle S";
extern color chose_color_Ws38 = clrYellow;
extern color label_color_Ws38 = clrYellow;
extern color chose_color_Ws61 = clrLime;
extern color label_color_Ws61 = clrLime;
extern color chose_color_Ws78 = clrGreen;
extern color label_color_Ws78 = clrGreen;
extern color chose_color_Ws100 = clrAqua;
extern color label_color_Ws100 = clrAqua;
extern color chose_color_Ws138 = clrOrange;
extern color label_color_Ws138 = clrOrange;
extern color chose_color_Ws161 = clrBrown;
extern color label_color_Ws161 = clrBrown;
extern color chose_color_Ws200 = clrBlack;
extern color label_color_Ws200 = clrBlack;
datetime time1;
datetime time2;
double open,close,high,low,mhigh,mlow,mclose,mopen;
double P,R1,R2,R3,R4,R5,R6,R7,S1,S2,S3,S4,S5,S6,S7;
double H1,H2,H3,H4,H5,H6,H7,L1,L2,L3,L4,L5,L6,L7,Range;
double Wr38,Wr61,Wr78,Wr100,Wr138,Wr161,Wr200,Ws38,Ws61,Ws78,Ws100,Ws138,Ws161,Ws200;
double pstyle, mstyle,cstyle,pstylem;
int shift, num, period;
void ObjDel()
{
for (;num<=CountPeriods;num++)
{
ObjectDelete("W PIVOT["+num+"]");
ObjectDelete("Wr38["+num+"]");
ObjectDelete("Wr61["+num+"]");
ObjectDelete("Wr78["+num+"]");
ObjectDelete("Wr100["+num+"]");
ObjectDelete("Wr138["+num+"]");
ObjectDelete("Wr161["+num+"]");
ObjectDelete("Wr200["+num+"]");
ObjectDelete("Ws38["+num+"]");
ObjectDelete("Ws61["+num+"]");
ObjectDelete("Ws78["+num+"]");
ObjectDelete("Ws100["+num+"]");
ObjectDelete("Ws138["+num+"]");
ObjectDelete("Ws161["+num+"]");
ObjectDelete("Ws200["+num+"]");
ObjectDelete("W PIVOT["+num+"]");
}
}
void PlotLine(string name,double value,double line_color,double style)
{
ObjectCreate(name,OBJ_TREND,0,time1,value,time2,value);
ObjectSet(name, OBJPROP_WIDTH, width_of_pivot_line);
ObjectSet(name, OBJPROP_STYLE, line_style_of_pivot);
ObjectSet(name, OBJPROP_RAY, false);
ObjectSet(name, OBJPROP_BACK, true);
ObjectSet(name, OBJPROP_COLOR, line_color);
}
void objText(string name, string tex, datetime time, double price, int window=0, color tex_color=White, string tex_font="Arial", int tex_size=12)
{
}
int init()
{
if (TimePeriod=="H1" || TimePeriod=="60") period=PERIOD_H1;
else
if (TimePeriod=="H4" || TimePeriod=="240") period=PERIOD_H4;
else
if (TimePeriod=="D1" || TimePeriod=="1440") period=PERIOD_D1;
else
if (TimePeriod=="W1" || TimePeriod=="10080") period=PERIOD_W1;
else
if (TimePeriod=="MN" || TimePeriod=="43200") period=PERIOD_MN1;
else
{
Comment("Wrong TimePeriod. Must be H1, H4, D1, W1 or MN");
return(0);
}
return(0);
}
int deinit()
{
ObjDel();
Comment("");
return(0);
}
int start()
{
int i;
ObjDel();
num=0;
for (shift=CountPeriods-1;shift>=0;shift--)
{
time1=iTime(NULL,period,shift);
high = iHigh(NULL,PERIOD_W1,shift+1);
low = iLow(NULL,PERIOD_W1,shift+1);
open = iOpen(NULL,PERIOD_W1,shift+1);
close = iClose(NULL,PERIOD_W1,shift+1);
P = (high+low+close)/3;
R1 = (high-low)*0.382+P;
R2 = (high-low)*0.618+P;
R3 = (high-low)*0.764+P;
R4 = (high-low)*1.00+P;
R5 = (high-low)*1.382+P;
R6 = (high-low)*1.618+P;
R7 = (high-low)*2.00+P;
S1 = P-(high-low)*0.382;
S2 = P-(high-low)*0.618;
S3 = P-(high-low)*0.764;
S4 = P-(high-low)*1.00;
S5 = P-(high-low)*1.382;
S6 = P-(high-low)*1.618;
S7 = P-(high-low)*2.00;
mhigh = iHigh(NULL,PERIOD_MN1,shift+1);
mlow = iLow(NULL,PERIOD_MN1,shift+1);
mopen = iOpen(NULL,PERIOD_MN1,shift+1);
mclose = iClose(NULL,PERIOD_MN1,shift+1);
time2=time1+period*60;
pstyle=line_style_of_pivot;
mstyle=1;
cstyle=3;
num=shift;
PlotLine("W PIVOT["+num+"]",P,chose_color_pivot,pstyle);
if(Plot_pivots)
{
{
}
PlotLine("Wr 38,2["+num+"]",R1,chose_color_Wr38,pstyle);
PlotLine("Wr 61,8["+num+"]",R2,chose_color_Wr61,pstyle);
PlotLine("Wr 76,4["+num+"]",R3,chose_color_Wr78,pstyle);
PlotLine("Wr 100["+num+"]",R4,chose_color_Wr100,pstyle);
PlotLine("Wr 138,2["+num+"]",R5,chose_color_Wr138,pstyle);
PlotLine("Wr 161,8["+num+"]",R6,chose_color_Wr161,pstyle);
PlotLine("Wr 200["+num+"]",R7,chose_color_Wr200,pstyle);
PlotLine("Ws 38,2["+num+"]",S1,chose_color_Ws38,pstyle);
PlotLine("Ws 61,8["+num+"]",S2,chose_color_Ws61,pstyle);
PlotLine("Ws 76,4["+num+"]",S3,chose_color_Ws78,pstyle);
PlotLine("Ws 100["+num+"]",S4,chose_color_Ws100,pstyle);
PlotLine("Ws 138,2["+num+"]",S5,chose_color_Ws138,pstyle);
PlotLine("Ws 161,8["+num+"]",S6,chose_color_Ws161,pstyle);
PlotLine("Ws 200["+num+"]",S7,chose_color_Ws200,pstyle);
}
{
ObjectCreate ( "W PIVOT LINE["+num+"]" , OBJ_LABEL , 0 , 0 ,P ) ;
ObjectSetText ("W PIVOT LINE["+num+"]" , " PIVIOT " , 10 , " Ariel " , Red ) ;
ObjectSet ( "W PIVOT LINE["+num+"]" , OBJPROP_CORNER , 0 ) ;
ObjectMove("W PIVO1 LINE["+num+"]", 0, 0,0);
}
{
}
}
return(0);
}
//+------------------------------------------------------------------+