#property indicator_chart_window extern double Livello_Base=1.06; extern double Scostamento_Percentuale_1=0.25; extern double Scostamento_Percentuale_2=0.50; extern double Scostamento_Percentuale_3=0.75; extern double Scostamento_Percentuale_4=1; extern color Scarto_Positivo=clrGreen; extern color Scarto_Negativo=clrRed; extern color Colore_Livello_Base=clrBlue; long cid; int OnCalculate(const int rates_total, const int prev_calculated, const datetime& time[], const double& open[], const double& high[], const double& low[], const double& close[], const long& tick_volume[], const long& volume[], const int& spread[]) { cid=ChartID(); double h1=Livello_Base*(1+(Scostamento_Percentuale_1/100)); double h2=Livello_Base*(1+(Scostamento_Percentuale_2/100)); double h3=Livello_Base*(1+(Scostamento_Percentuale_3/100)); double h4=Livello_Base*(1+(Scostamento_Percentuale_4/100)); double l1=Livello_Base/(1+(Scostamento_Percentuale_1/100)); double l2=Livello_Base/(1+(Scostamento_Percentuale_2/100)); double l3=Livello_Base/(1+(Scostamento_Percentuale_3/100)); double l4=Livello_Base/(1+(Scostamento_Percentuale_4/100)); double r=((100/Livello_Base)*Bid)-100; ObjectCreate(cid,"lh1",OBJ_HLINE,0,0,h1); ObjectSetInteger(cid,"lh1",OBJPROP_COLOR,Scarto_Positivo); ObjectSetInteger(cid,"lh1",OBJPROP_STYLE,2); ObjectCreate(cid,"lh2",OBJ_HLINE,0,0,h2); ObjectSetInteger(cid,"lh2",OBJPROP_COLOR,Scarto_Positivo); ObjectSetInteger(cid,"lh2",OBJPROP_STYLE,2); ObjectCreate(cid,"lh3",OBJ_HLINE,0,0,h3); ObjectSetInteger(cid,"lh3",OBJPROP_COLOR,Scarto_Positivo); ObjectSetInteger(cid,"lh3",OBJPROP_STYLE,2); ObjectCreate(cid,"lh4",OBJ_HLINE,0,0,h4); ObjectSetInteger(cid,"lh4",OBJPROP_COLOR,Scarto_Positivo); ObjectSetInteger(cid,"lh4",OBJPROP_STYLE,2); ObjectCreate(cid,"lb",OBJ_HLINE,0,0,Livello_Base); ObjectSetInteger(cid,"lb",OBJPROP_COLOR,Colore_Livello_Base); ObjectSetInteger(cid,"lb",OBJPROP_STYLE,0); ObjectSetInteger(cid,"lb",OBJPROP_WIDTH,2); ObjectCreate(cid,"ll1",OBJ_HLINE,0,0,l1); ObjectSetInteger(cid,"ll1",OBJPROP_COLOR,Scarto_Negativo); ObjectSetInteger(cid,"ll1",OBJPROP_STYLE,2); ObjectCreate(cid,"ll2",OBJ_HLINE,0,0,l2); ObjectSetInteger(cid,"ll2",OBJPROP_COLOR,Scarto_Negativo); ObjectSetInteger(cid,"ll2",OBJPROP_STYLE,2); ObjectCreate(cid,"ll3",OBJ_HLINE,0,0,l3); ObjectSetInteger(cid,"ll3",OBJPROP_COLOR,Scarto_Negativo); ObjectSetInteger(cid,"ll3",OBJPROP_STYLE,2); ObjectCreate(cid,"ll4",OBJ_HLINE,0,0,l4); ObjectSetInteger(cid,"ll4",OBJPROP_COLOR,Scarto_Negativo); ObjectSetInteger(cid,"ll4",OBJPROP_STYLE,2); ObjectCreate("r",OBJ_TEXT,0,TimeCurrent(),Bid); ObjectSetText("r","Scostamento: "+DoubleToStr(r,2)+" %",10,"Arial",Colore_Livello_Base); ObjectMove("r",0,Time[0]+(Period()*1600),Bid); ObjectCreate("ph1",OBJ_TEXT,0,TimeCurrent(),h1); ObjectSetText("ph1",DoubleToStr(Scostamento_Percentuale_1,2)+" %",10,"Arial",Scarto_Positivo); ObjectSetInteger(cid,"ph1",OBJPROP_TIME,Time[0]+(Period()*1600)); ObjectCreate("ph2",OBJ_TEXT,0,TimeCurrent(),h2); ObjectSetText("ph2",DoubleToStr(Scostamento_Percentuale_2,2)+" %",10,"Arial",Scarto_Positivo); ObjectSetInteger(cid,"ph2",OBJPROP_TIME,Time[0]+(Period()*1600)); ObjectCreate("ph3",OBJ_TEXT,0,TimeCurrent(),h3); ObjectSetText("ph3",DoubleToStr(Scostamento_Percentuale_3,2)+" %",10,"Arial",Scarto_Positivo); ObjectSetInteger(cid,"ph3",OBJPROP_TIME,Time[0]+(Period()*1600)); ObjectCreate("ph4",OBJ_TEXT,0,TimeCurrent(),h4); ObjectSetText("ph4",DoubleToStr(Scostamento_Percentuale_4,2)+" %",10,"Arial",Scarto_Positivo); ObjectSetInteger(cid,"ph4",OBJPROP_TIME,Time[0]+(Period()*1600)); ObjectCreate("pl1",OBJ_TEXT,0,TimeCurrent(),l1); ObjectSetText("pl1","- "+DoubleToStr(Scostamento_Percentuale_1,2)+" %",10,"Arial",Scarto_Negativo); ObjectSetInteger(cid,"pl1",OBJPROP_TIME,Time[0]+(Period()*1600)); ObjectCreate("pl2",OBJ_TEXT,0,TimeCurrent(),l2); ObjectSetText("pl2","- "+DoubleToStr(Scostamento_Percentuale_2,2)+" %",10,"Arial",Scarto_Negativo); ObjectSetInteger(cid,"pl2",OBJPROP_TIME,Time[0]+(Period()*1600)); ObjectCreate("pl3",OBJ_TEXT,0,TimeCurrent(),l3); ObjectSetText("pl3","- "+DoubleToStr(Scostamento_Percentuale_3,2)+" %",10,"Arial",Scarto_Negativo); ObjectSetInteger(cid,"pl3",OBJPROP_TIME,Time[0]+(Period()*1600)); ObjectCreate("pl4",OBJ_TEXT,0,TimeCurrent(),l4); ObjectSetText("pl4","- "+DoubleToStr(Scostamento_Percentuale_4,2)+" %",10,"Arial",Scarto_Negativo); ObjectSetInteger(cid,"pl4",OBJPROP_TIME,Time[0]+(Period()*1600)); ObjectCreate("plb",OBJ_TEXT,0,TimeCurrent(),Livello_Base); ObjectSetText("plb","OPEN",10,"Arial",Colore_Livello_Base); ObjectSetInteger(cid,"plb",OBJPROP_TIME,Time[0]+(Period()*1600)); return(rates_total); } void OnDeinit(const int reason) { ObjectDelete(ChartID(),"lh1"); ObjectDelete(ChartID(),"lh2"); ObjectDelete(ChartID(),"lh3"); ObjectDelete(ChartID(),"lh4"); ObjectDelete(ChartID(),"ll1"); ObjectDelete(ChartID(),"ll2"); ObjectDelete(ChartID(),"ll3"); ObjectDelete(ChartID(),"ll4"); ObjectDelete(ChartID(),"lb"); ObjectDelete("r"); ObjectDelete("ph1"); ObjectDelete("ph2"); ObjectDelete("ph3"); ObjectDelete("ph4"); ObjectDelete("pl1"); ObjectDelete("pl2"); ObjectDelete("pl3"); ObjectDelete("pl4"); }