DislikedJust need to add this line to the code at the top, just under the line with the similar setting for x=: input int y = 6; // Indent from top then delete this line from the code at void DrawRules(): int y=6;Ignored
Thanks a lot for your help.
But now all "signals" are overwritten and the problem with the y-space is not solved yet.
Attached is the Code and a pic.
Regards Zack
#property copyright " honestknave (2015)"
#property version "1.02"
#property strict
#property indicator_separate_window
const string tag = "Entry-Rules";
input string Signal1 ="1 Mit dem Trend:"; // Signal 1
input string Signal2 ="-Divergence TDI zur letzten Candle"; // Signal 2
input string Signal3 ="-Divergence BO 68/32-Level"; // Signal 3
input string Signal4 ="-Divergence u. Bounce";// Signal 4
input string Signal5 ="2 Gegen den Trend";// Signal 5
input string Signal6 ="-3. Divergence in Folge!!";// Signal 6
input int x = 6; // Indent from left
input int y = 50; // Indent from top
input int space = 22; // Spacing between lines
input color colT = clrDarkOrange; // Title color
input color colR = clrDarkOrange; // Rule color
input color colH = clrAqua; // Highlight color
input string font = "Berlin Sans FB"; // Font
input int fsize = 14; // Font size
input int NotUsed = 0;
int OnInit()
{
IndicatorShortName("Signals");
DrawRules();
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason)
{
if(reason<2 || reason==5)
{
int len=StringLen(tag);
for(int i=ObjectsTotal()-1; i>=0; i--)
{
string name=ObjectName(i);
if(StringSubstr(name,0,len)==tag) { ObjectDelete(name); }
}
}
}
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[])
{
return(rates_total);
}
void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam)
{
if(StringSubstr(sparam,0,StringLen(tag))!=tag) { return ;}
if(id==CHARTEVENT_OBJECT_CLICK)
{
ObjectSetInteger(0,sparam,OBJPROP_SELECTED,false);
color col=(color)ObjectGetInteger(0,sparam,OBJPROP_COLOR);
if(col!=colH) { col=colH; }
else { col=(sparam==tag+"T")?colT:colR; }
ObjectSetInteger(0,sparam,OBJPROP_COLOR,col);
}
}
void DrawRules()
{
if(Signal1!="") { CreateLabel(tag+"1", Signal1, colR,0,false,fsize,font); }
if(Signal2!="") { CreateLabel(tag+"2", Signal2, colR,0,false,fsize,font); }
if(Signal3!="") { CreateLabel(tag+"3", Signal3, colR,0,false,fsize,font); }
if(Signal4!="") { CreateLabel(tag+"4", Signal4, colR,0,false,fsize,font); }
if(Signal5!="") { CreateLabel(tag+"5", Signal5, colR,0,false,fsize,font); }
if(Signal6!="") { CreateLabel(tag+"6", Signal6, colR,0,false,fsize,font); }
}
void CreateLabel (string name, string text, color col, int corner, bool back=false, int fontsize=12, string fontname="MS Sans Serif")
{
if(ObjectFind(0,name)<0)
{
ObjectCreate (0,name,OBJ_LABEL,WindowOnDropped(),0,0);
ObjectSetInteger(0,name,OBJPROP_BACK, back);
ObjectSetInteger(0,name,OBJPROP_CORNER, corner);
ObjectSetInteger(0,name,OBJPROP_COLOR, col);
}
ObjectSetString (0,name,OBJPROP_TEXT, text);
ObjectSetString (0,name,OBJPROP_FONT, fontname);
ObjectSetInteger(0,name,OBJPROP_FONTSIZE, fontsize);
ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x);
ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y);
}