كود:
void OnInit()
{
datetime currentDate = iTime(_Symbol, PERIOD_D1, 0);
string day = StringSubstr("00"+TimeDay(currentDate),StringLen("00"+TimeDay(currentDate))-2,2);
string month = StringSubstr("00"+TimeMonth(currentDate),StringLen("00"+TimeMonth(currentDate))-2,2);
int d0=int(StringSubstr(day,0,1));
int d1=int(StringSubstr(day,1,1));
int m0=int(StringSubstr(month,0,1));
int m1=int(StringSubstr(month,1,1));
int result=d0+d1+m0+m1;
string res=StringSubstr("0000"+result,StringLen("0000"+result)-4,4);
d0=int(StringSubstr(res,0,1));
d1=int(StringSubstr(res,1,1));
m0=int(StringSubstr(res,2,1));
m1=int(StringSubstr(res,3,1));
result=d0+d1+m0+m1;
double P1=result/10000.0*MathPow(10,6-Digits);
double P2=result/100000.0*MathPow(10,6-Digits);
double Price=int((iOpen(_Symbol, PERIOD_D1, 0)/_Point)/1000)*_Point*1000;
double PriceLow=Price;
double PriceHigh=Price+1000*_Point;
double PL1=PriceLow+P1;
double PH1=PriceHigh+P1;
double PL2=PriceLow+P2;
double PH2=PriceHigh+P2;
Print(day,"//",PL1,"//",PL2,"//",PH1,"//",PH2);
string name="PL1";
ObjectDelete(name);
ObjectCreate(name, OBJ_HLINE, 0, 0, PL1);
ObjectSet(name, OBJPROP_COLOR, clrRed);
ObjectSet(name, OBJPROP_WIDTH, 1);
name="PL2";
ObjectDelete(name);
ObjectCreate(name, OBJ_HLINE, 0, 0, PL2);
ObjectSet(name, OBJPROP_COLOR, clrYellow);
ObjectSet(name, OBJPROP_WIDTH, 1);
name="PH1";
ObjectDelete(name);
ObjectCreate(name, OBJ_HLINE, 0, 0, PH1);
ObjectSet(name, OBJPROP_COLOR, clrYellow);
ObjectSet(name, OBJPROP_WIDTH, 1);
name="PH2";
ObjectDelete(name);
ObjectCreate(name, OBJ_HLINE, 0, 0, PH2);
ObjectSet(name, OBJPROP_COLOR, clrRed);
ObjectSet(name, OBJPROP_WIDTH, 1);
}