package jforex.converted;
import java.awt.Color;
import com.dukascopy.api.*;
import com.dukascopy.connector.engine.*;
/** Disclaimer: Don't post this code when reporting an issue, post the mq4 file instead!
* The following source code is to be used for troubleshooting purposes only.
* Please don't use it for strategy/indicator compilation.
* Please do all necessary modifications in mq4 code instead,
* because the MQL4Functions method signatures are subject to change.
*/
public class j3_Level_ZZ_Semafor_TRO_MODIFIED_VERSIONfull extends MQL4ConnectorIndicator {

protected void initProperties() {
if (properties == null) {
properties = new Properties();
}
properties.setProperty("connector_recalculate_all","true");
properties.setProperty("indicator_chart_window","true");
properties.setProperty("indicator_buffers","6");
properties.setProperty("link","asystem2000@yandex.ru");
properties.setProperty("indicator_color2","Chocolate");
properties.setProperty("copyright","asystem2000");
properties.setProperty("indicator_color1","Chocolate");
properties.setProperty("connector_timezone","GMT");
properties.setProperty("indicator_color5","Yellow");
properties.setProperty("indicator_color6","Yellow");
properties.setProperty("connector_calculate_once_per_bar","true");
properties.setProperty("indicator_color3","MediumVioletRed");
properties.setProperty("indicator_color4","MediumVioletRed");
properties.setProperty("connector_max_bars","500");
}
protected Color indicator_color2 = toColor(Chocolate);
protected Color indicator_color1 = toColor(Chocolate);
protected Color indicator_color5 = toColor(Yellow);
protected Color indicator_color6 = toColor(Yellow);
protected Color indicator_color3 = toColor(MediumVioletRed);
protected Color indicator_color4 = toColor(MediumVioletRed);
@Configurable("") public boolean Show_Legend=toBool(true);
@Configurable("") public boolean Show_Trendlines=toBool(true);
@Configurable("") public boolean Show_Retracelines=toBool(true);
@Configurable("") public boolean Show_Targetlines=toBool(true);
@Configurable("") public boolean Show_Medianline=toBool(true);
@Configurable("") public boolean Show_TrendLines3=toBool(true);
@Configurable("") public boolean Show_Fiblines=toBool(true);
@Configurable("") public boolean Show_Fiblines3=toBool(true);
@Configurable("") public boolean Show_Bars=toBool(true);
@Configurable("") public boolean Show_Label=toBool(true);
@Configurable("") public int ShiftLabel=toInt(10);
@Configurable("") public boolean Show_SupResLines3=toBool(true);
@Configurable("") public int mySRlevel=toInt(1);
@Configurable("") public int NumSRLines=toInt(5);
@Configurable("") public boolean Sound_Alert=toBool(false);
@Configurable("") public boolean Show_Comment=toBool(false);
@Configurable("") public int myBars=toInt(100);
@Configurable("") public int myThreshold=toInt(1);
@Configurable("") public int myRetracePips=toInt(20);
@Configurable("") public int myTargetPips=toInt(20);
@Configurable("") public int NumComments=toInt(5);
@Configurable("") public int yIncLegend=toInt(50);
public Color myUpperTrendLineColor=toColor(Red);
@Configurable("") public int myUpperTrendLineStyle=toInt(STYLE_SOLID);
@Configurable("") public int myUpperTrendLineWidth=toInt(2);
public String myUpperSoundFile=toString("ahooga.wav");
public Color myLowerTrendLineColor=toColor(Blue);
@Configurable("") public int myLowerTrendLineStyle=toInt(STYLE_SOLID);
@Configurable("") public int myLowerTrendLineWidth=toInt(2);
public String myLowerSoundFile=toString("siren.wav");
public Color myRetraceLineColor=toColor(Orange);
@Configurable("") public int myRetraceLineStyle=toInt(STYLE_DOT);
@Configurable("") public int myRetraceLineWidth=toInt(1);
public Color myTargetLineColor=toColor(Magenta);
@Configurable("") public int myTargetLineStyle=toInt(STYLE_DOT);
@Configurable("") public int myTargetLineWidth=toInt(1);
public Color myMedianLineColor=toColor(Violet);
@Configurable("") public int myMedianLineStyle=toInt(STYLE_DOT);
@Configurable("") public int myMedianLineWidth=toInt(1);
public Color myUpperTrendLine3Color=toColor(Red);
@Configurable("") public int myUpperTrendLine3Style=toInt(STYLE_SOLID);
@Configurable("") public int myUpperTrendLine3Width=toInt(3);
public Color myLowerTrendLine3Color=toColor(Blue);
@Configurable("") public int myLowerTrendLine3Style=toInt(STYLE_SOLID);
@Configurable("") public int myLowerTrendLine3Width=toInt(3);
public Color myUpperSRColor=toColor(Red);
@Configurable("") public int myUpperSRStyle=toInt(STYLE_DASH);
@Configurable("") public int myUpperSRWidth=toInt(1);
public Color myLowerSRColor=toColor(Blue);
@Configurable("") public int myLowerSRStyle=toInt(STYLE_DASH);
@Configurable("") public int myLowerSRWidth=toInt(1);
@Configurable("") public double iLevel1=toDouble(0.24);
@Configurable("") public double iLevel2=toDouble(0.382);
@Configurable("") public double iLevel3=toDouble(0.5);
@Configurable("") public double iLevel4=toDouble(0.618);
@Configurable("") public double iLevel5=toDouble(0.76);
public Color Fibcolor1=toColor(DarkSeaGreen);
public Color Fibcolor2=toColor(Khaki);
public Color Fibcolor3=toColor(Gray);
public Color Fibcolor4=toColor(Khaki);
public Color Fibcolor5=toColor(DarkSeaGreen);
@Configurable("") public int myFibLineStyle=toInt(STYLE_DASHDOTDOT);
@Configurable("") public int myFibLineWidth=toInt(1);
@Configurable("") public int myFibLine3Style=toInt(STYLE_DASHDOT);
@Configurable("") public int myFibLine3Width=toInt(1);
@Configurable("") public double Period1=toDouble(5);
@Configurable("") public double Period2=toDouble(13);
@Configurable("") public double Period3=toDouble(34);
public String Dev_Step_1=toString("1,3");
public String Dev_Step_2=toString("8,5");
public String Dev_Step_3=toString("13,8");
@Configurable("") public int Symbol_1_Kod=toInt(140);
@Configurable("") public int Symbol_2_Kod=toInt(141);
@Configurable("") public int Symbol_3_Kod=toInt(142);
@Configurable("") public int Symbol_1_Size=toInt(1);
@Configurable("") public int Symbol_2_Size=toInt(2);
@Configurable("") public int Symbol_3_Size=toInt(4);
@IndicatorBuffer ("") public double[] FP_BuferUp = new double[0];
@IndicatorBuffer ("") public double[] FP_BuferDn = new double[0];
@IndicatorBuffer ("") public double[] NP_BuferUp = new double[0];
@IndicatorBuffer ("") public double[] NP_BuferDn = new double[0];
@IndicatorBuffer ("") public double[] HP_BuferUp = new double[0];
@IndicatorBuffer ("") public double[] HP_BuferDn = new double[0];
int F_Period = 0;
int N_Period = 0;
int H_Period = 0;
int Dev1 = 0;
int Stp1 = 0;
int Dev2 = 0;
int Stp2 = 0;
int Dev3 = 0;
int Stp3 = 0;
String symbol = "";
String tChartPeriod = "";
String tShortName = "";
int digits = 0;
int period = 0;
boolean Trigger1 = false;
boolean Trigger2 = false;
boolean Trigger3 = false;
int OldBars=toInt(-1);
Color tColor=toColor(Yellow);
int i = 0;
int j = 0;
int k = 0;
int tltop = 0;
int tlbot = 0;
String[] Messages = new String[26];
String theMessage = "";
String space = "";
boolean roll = false;
double point = 0.0;
double[] upperTL1 = new double[2];
double[] lowerTL1 = new double[2];
double[] upperTL2 = new double[2];
double[] lowerTL2 = new double[2];
double[] upperTL3 = new double[2];
double[] lowerTL3 = new double[2];
double[] upperTL = new double[2];
double[] lowerTL = new double[2];
double UpperTrendLinePrice = 0.0;
double LowerTrendLinePrice = 0.0;
double UpperLimit = 0.0;
double LowerLimit = 0.0;
double xThreshold = 0.0;
double UpperRetracePrice = 0.0;
double LowerRetracePrice = 0.0;
double xRetracePips = 0.0;
double pUpperTargetPrice = 0.0;
double pLowerTargetPrice = 0.0;
double UpperTargetPrice = 0.0;
double LowerTargetPrice = 0.0;
double xTargetPips = 0.0;
int[] upperTLtime1 = new int[2];
int[] lowerTLtime1 = new int[2];
int[] upperTLtime2 = new int[2];
int[] lowerTLtime2 = new int[2];
int[] upperTLtime3 = new int[2];
int[] lowerTLtime3 = new int[2];
int[] upperTLtime = new int[2];
int[] lowerTLtime = new int[2];
long upperStime = 0;
long upperEtime = 0;
long lowerStime = 0;
long lowerEtime = 0;
String TAG=toString("3lzz");
String OBJ001 = "";
String OBJ002 = "";
String OBJ003 = "";
String OBJ004 = "";
String OBJ005 = "";
String OBJ006 = "";
String OBJ007 = "";
String OBJ008 = "";
double midpoint = 0.0;
double midstart = 0.0;
long midstarttime = 0;
int[] upperTL3time = new int[2];
int[] lowerTL3time = new int[2];
double upperTL3Max = 0.0;
double lowerTL3Min = 0.0;
double UpperTrendLine3Price = 0.0;
double LowerTrendLine3Price = 0.0;
int tl1top = 0;
int tl1bot = 0;
int tl2top = 0;
int tl2bot = 0;
int tl3top = 0;
int tl3bot = 0;
double upperSR = 0.0;
double lowerSR = 0.0;
double fibrange = 0.0;
double[] fibvalue = new double[5];
double[] fibvalue3 = new double[5];
double[] FIBLEVEL = new double[5];
double[] FIBCOLOR = new double[5];
long fibstarttime = 0;
int yIncL = 0;
String sFib = "";
int[] upperTLBars1 = new int[2];
int[] lowerTLBars1 = new int[2];
int[] upperTLBars2 = new int[2];
int[] lowerTLBars2 = new int[2];
int[] upperTLBars3 = new int[2];
int[] lowerTLBars3 = new int[2];
int[] upperTLBars = new int[2];
int[] lowerTLBars = new int[2];
public int init() throws JFException {
int CDev = 0;
int CSt = 0;
int[] Mass = new int[ARRAY_MAX_SIZE];
int C = 0;
period=toInt(Period());
tChartPeriod=toString(TimeFrameToString(toInt(period)));
symbol=toString(Instrument());
digits=toInt(Digits);
point=toDouble(Point);
if (equal(digits, 5)||equal(digits, 3)){
digits=toInt(digits-1);
point=toDouble(point*10);
}
tShortName=toString("tbb"+symbol+tChartPeriod);
xThreshold=toDouble(myThreshold*point);
xRetracePips=toDouble(myRetracePips*point);
xTargetPips=toDouble(myTargetPips*point);
OBJ001=toString(TAG+"001");
OBJ002=toString(TAG+"002");
OBJ003=toString(TAG+"003");
OBJ004=toString(TAG+"004");
OBJ005=toString(TAG+"005");
OBJ006=toString(TAG+"006");
OBJ007=toString(TAG+"007");
OBJ008=toString(TAG+"008");
setValue(FIBLEVEL, 0, toDouble(iLevel1));
setValue(FIBLEVEL, 1, toDouble(iLevel2));
setValue(FIBLEVEL, 2, toDouble(iLevel3));
setValue(FIBLEVEL, 3, toDouble(iLevel4));
setValue(FIBLEVEL, 4, toDouble(iLevel5));
setValue(FIBCOLOR, 0, toDouble(Fibcolor1));
setValue(FIBCOLOR, 1, toDouble(Fibcolor2));
setValue(FIBCOLOR, 2, toDouble(Fibcolor3));
setValue(FIBCOLOR, 3, toDouble(Fibcolor4));
setValue(FIBCOLOR, 4, toDouble(Fibcolor5));
if (greaterThan(Period1, 0)){
F_Period=toInt(MathCeil(toDouble(Period1*Period())));
} else {
F_Period=toInt(0);
}
if (greaterThan(Period2, 0)){
N_Period=toInt(MathCeil(toDouble(Period2*Period())));
} else {
N_Period=toInt(0);
}
if (greaterThan(Period3, 0)){
H_Period=toInt(MathCeil(toDouble(Period3*Period())));
} else {
H_Period=toInt(0);
}
if (greaterThan(Period1, 0)){
SetIndexStyle(toInt(0),toInt(DRAW_ARROW),toInt(0),toInt(Symbol_1_Size));
SetIndexArrow(toInt(0),toInt(Symbol_1_Kod));
SetIndexBuffer(toInt(0),FP_BuferUp);
SetIndexEmptyValue(toInt(0),toDouble(0.0));
SetIndexStyle(toInt(1),toInt(DRAW_ARROW),toInt(0),toInt(Symbol_1_Size));
SetIndexArrow(toInt(1),toInt(Symbol_1_Kod));
SetIndexBuffer(toInt(1),FP_BuferDn);
SetIndexEmptyValue(toInt(1),toDouble(0.0));
}
if (greaterThan(Period2, 0)){
SetIndexStyle(toInt(2),toInt(DRAW_ARROW),toInt(0),toInt(Symbol_2_Size));
SetIndexArrow(toInt(2),toInt(Symbol_2_Kod));
SetIndexBuffer(toInt(2),NP_BuferUp);
SetIndexEmptyValue(toInt(2),toDouble(0.0));
SetIndexStyle(toInt(3),toInt(DRAW_ARROW),toInt(0),toInt(Symbol_2_Size));
SetIndexArrow(toInt(3),toInt(Symbol_2_Kod));
SetIndexBuffer(toInt(3),NP_BuferDn);
SetIndexEmptyValue(toInt(3),toDouble(0.0));
}
if (greaterThan(Period3, 0)){
SetIndexStyle(toInt(4),toInt(DRAW_ARROW),toInt(0),toInt(Symbol_3_Size));
SetIndexArrow(toInt(4),toInt(Symbol_3_Kod));
SetIndexBuffer(toInt(4),HP_BuferUp);
SetIndexEmptyValue(toInt(4),toDouble(0.0));
SetIndexStyle(toInt(5),toInt(DRAW_ARROW),toInt(0),toInt(Symbol_3_Size));
SetIndexArrow(toInt(5),toInt(Symbol_3_Kod));
SetIndexBuffer(toInt(5),HP_BuferDn);
SetIndexEmptyValue(toInt(5),toDouble(0.0));
}
CDev = toInt(0);
CSt = toInt(0);
C = toInt(0);
if (equal(IntFromStr(toString(Dev_Step_1),toInt(C),Mass), 1)){
Stp1=toInt(getValue(Mass, 1));
Dev1=toInt(getValue(Mass, 0));
}
if (equal(IntFromStr(toString(Dev_Step_2),toInt(C),Mass), 1)){
Stp2=toInt(getValue(Mass, 1));
Dev2=toInt(getValue(Mass, 0));
}
if (equal(IntFromStr(toString(Dev_Step_3),toInt(C),Mass), 1)){
Stp3=toInt(getValue(Mass, 1));
Dev3=toInt(getValue(Mass, 0));
}
if(true)return toInt((0));return 0;
}
public void ObDeleteObjectsByPrefix(String Prefix) throws JFException {
int L = 0;
int i = 0;
String ObjName = "";
L = toInt(StringLen(toString(Prefix)));
i = toInt(0);
while (lessThan(i, ObjectsTotal())){
ObjName = toString(ObjectName(toInt(i)));
if (notEqual(StringSubstr(toString(ObjName),toInt(0),toInt(L)), Prefix)){
i++;
if(true)continue;}
ObjectDelete  (toString( ObjName));
}return ;
}
public int deinit() throws JFException {
Comment("");
ObDeleteObjectsByPrefix  (toString( TAG));
TRO();
if(true)return toInt((0));return 0;
}
public int start() throws JFException {
deinit();
if (notEqual(Bars, OldBars)){
Trigger1=toBool(true);
Trigger2=toBool(true);
Trigger3=toBool(true);
}
if (greaterThan(Period1, 0)){
CountZZ(FP_BuferUp,FP_BuferDn,toInt(Period1),toInt(Dev1),toInt(Stp1));
}
if (greaterThan(Period2, 0)){
CountZZ(NP_BuferUp,NP_BuferDn,toInt(Period2),toInt(Dev2),toInt(Stp2));
}
if (greaterThan(Period3, 0)){
CountZZ(HP_BuferUp,HP_BuferDn,toInt(Period3),toInt(Dev3),toInt(Stp3));
}
if (toBool(Trigger1)){
if (notEqual(getValue(FP_BuferUp, 0), 0)){
Trigger1=toBool(false);
if (toBool(Sound_Alert)){
Alert(symbol,"  ",tChartPeriod," Level 1 Lower "+DoubleToStr(toDouble(Close(toInt(0))),toInt(digits)));
}}
if (notEqual(getValue(FP_BuferDn, 0), 0)){
Trigger1=toBool(false);
if (toBool(Sound_Alert)){
Alert(symbol,"  ",tChartPeriod," Level 1 Upper "+DoubleToStr(toDouble(Close(toInt(0))),toInt(digits)));
}}}
if (toBool(Trigger2)){
if (notEqual(getValue(NP_BuferUp, 0), 0)){
Trigger2=toBool(false);
if (toBool(Sound_Alert)){
Alert(symbol,"  ",tChartPeriod," Level 2 Lower "+DoubleToStr(toDouble(Close(toInt(0))),toInt(digits)));
}}
if (notEqual(getValue(NP_BuferDn, 0), 0)){
Trigger2=toBool(false);
if (toBool(Sound_Alert)){
Alert(symbol,"  ",tChartPeriod," Level 2 Upper "+DoubleToStr(toDouble(Close(toInt(0))),toInt(digits)));
}}}
if (toBool(Trigger3)){
if (notEqual(getValue(HP_BuferUp, 0), 0)){
Trigger3=toBool(false);
if (toBool(Sound_Alert)){
Alert(symbol,"  ",tChartPeriod," Level 3 Lower "+DoubleToStr(toDouble(Close(toInt(0))),toInt(digits)));
}}
if (notEqual(getValue(HP_BuferDn, 0), 0)){
Trigger3=toBool(false);
if (toBool(Sound_Alert)){
Alert(symbol,"  ",tChartPeriod," Level 3 Upper "+DoubleToStr(toDouble(Close(toInt(0))),toInt(digits)));
}}}
tl3top=toInt(0);
tl3bot=toInt(0);
tl2top=toInt(0);
tl2bot=toInt(0);
tl1top=toInt(0);
tl1bot=toInt(0);
;
for(  j=toInt(0);lessThan(j, 1000);j++){
while (toBool(true)){
if (notEqual(getValue(HP_BuferUp, j), 0)&&lessThan(tl3bot, 2)){
setValue(lowerTLBars3, tl3bot, toInt(j));
setValue(lowerTL3, tl3bot, toDouble(getValue(HP_BuferUp, j)));
tl3bot=toInt(tl3bot+1);
break;}
if (notEqual(getValue(HP_BuferDn, j), 0)&&lessThan(tl3top, 2)){
setValue(upperTLBars3, tl3top, toInt(j));
setValue(upperTL3, tl3top, toDouble(getValue(HP_BuferDn, j)));
tl3top=toInt(tl3top+1);
break;}
if (notEqual(getValue(NP_BuferUp, j), 0)&&lessThan(tl2bot, 2)){
setValue(lowerTLBars2, tl2bot, toInt(j));
setValue(lowerTL2, tl2bot, toDouble(getValue(NP_BuferUp, j)));
tl2bot=toInt(tl2bot+1);
break;}
if (notEqual(getValue(NP_BuferDn, j), 0)&&lessThan(tl2top, 2)){
setValue(upperTLBars2, tl2top, toInt(j));
setValue(upperTL2, tl2top, toDouble(getValue(NP_BuferDn, j)));
tl2top=toInt(tl2top+1);
break;}
if (notEqual(getValue(FP_BuferUp, j), 0)&&lessThan(tl1bot, 2)){
setValue(lowerTLBars1, tl1bot, toInt(j));
setValue(lowerTL1, tl1bot, toDouble(getValue(FP_BuferUp, j)));
tl1bot=toInt(tl1bot+1);
break;}
if (notEqual(getValue(FP_BuferDn, j), 0)&&lessThan(tl1top, 2)){
setValue(upperTLBars1, tl1top, toInt(j));
setValue(upperTL1, tl1top, toDouble(getValue(FP_BuferDn, j)));
tl1top=toInt(tl1top+1);
break;}
break;}
if (greaterThanOrEqualTo(tl3bot, 2)&&greaterThanOrEqualTo(tl3top, 2)&&greaterThanOrEqualTo(tl2bot, 2)&&greaterThanOrEqualTo(tl2top, 2)&&greaterThanOrEqualTo(tl1bot, 2)&&greaterThanOrEqualTo(tl1top, 2)){
break;}
}
if (toBool(Show_Comment)){
k=toInt(0);
theMessage=toString("");
;
for(  i=toInt(0);lessThan(i, 26);i++){
setValue(Messages, i, toString(""));
}
;
for(  j=toInt(myBars);greaterThanOrEqualTo(j, 0);j--){
while (toBool(true)){
if (notEqual(getValue(HP_BuferUp, j), 0)){
DoRollMsg(toString(TimeToStr(toInt(Time(toInt(j))))+" bot 3 "));
break;}
if (notEqual(getValue(HP_BuferDn, j), 0)){
DoRollMsg(toString(TimeToStr(toInt(Time(toInt(j))))+" top 3 "));
break;}
if (notEqual(getValue(NP_BuferUp, j), 0)){
DoRollMsg(toString(TimeToStr(toInt(Time(toInt(j))))+" bot 2 "));
break;}
if (notEqual(getValue(NP_BuferDn, j), 0)){
DoRollMsg(toString(TimeToStr(toInt(Time(toInt(j))))+" top 2 "));
break;}
if (notEqual(getValue(FP_BuferUp, j), 0)){
DoRollMsg(toString(TimeToStr(toInt(Time(toInt(j))))+" bot 1 "));
break;}
if (notEqual(getValue(FP_BuferDn, j), 0)){
DoRollMsg(toString(TimeToStr(toInt(Time(toInt(j))))+" top 1 "));
break;}
break;}
}
;
for(  i=toInt(0);lessThan(i, NumComments);i++){
if (notEqual(getValue(Messages, i), "")){
theMessage=toString(theMessage+"\n"+getValue(Messages, i));
} else {
break;
}
}
Comment  ( theMessage);
}
if (toBool(Show_TrendLines3)){
tl3top=toInt(0);
tl3bot=toInt(0);
;
for(  j=toInt(0);lessThan(j, 1000);j++){
while (toBool(true)){
if (notEqual(getValue(HP_BuferUp, j), 0)&&lessThan(tl3bot, 2)){
setValue(lowerTL3time, tl3bot, toInt(Time(toInt(j))));
setValue(lowerTL3, tl3bot, toDouble(getValue(HP_BuferUp, j)));
tl3bot=toInt(tl3bot+1);
break;}
if (notEqual(getValue(HP_BuferDn, j), 0)&&lessThan(tl3top, 2)){
setValue(upperTL3time, tl3top, toInt(Time(toInt(j))));
setValue(upperTL3, tl3top, toDouble(getValue(HP_BuferDn, j)));
tl3top=toInt(tl3top+1);
break;}
break;}
if (greaterThanOrEqualTo(tl3bot, 2)&&greaterThanOrEqualTo(tl3top, 2)){
break;}
}
DrawPriceTrendLines(toString(OBJ001+"3"),toInt(getValue(upperTL3time, 1)),toInt(getValue(upperTL3time, 0)),toDouble(getValue(upperTL3, 1)),toDouble(getValue(upperTL3, 0)),toColor(myUpperTrendLine3Color),toInt(myUpperTrendLine3Style),toInt(myUpperTrendLine3Width));
DrawPriceTrendLines(toString(OBJ002+"3"),toInt(getValue(lowerTL3time, 1)),toInt(getValue(lowerTL3time, 0)),toDouble(getValue(lowerTL3, 1)),toDouble(getValue(lowerTL3, 0)),toColor(myLowerTrendLine3Color),toInt(myLowerTrendLine3Style),toInt(myLowerTrendLine3Width));
DrawPriceTrendLines(toString(OBJ003+"3"),toInt(getValue(upperTL3time, 0)),toInt(Time(toInt(0))),toDouble(getValue(upperTL3, 0)),toDouble(getValue(upperTL3, 0)),toColor(myUpperTrendLine3Color),toInt(myUpperTrendLine3Style),toInt(myUpperTrendLine3Width));
DrawPriceTrendLines(toString(OBJ004+"3"),toInt(getValue(lowerTL3time, 0)),toInt(Time(toInt(0))),toDouble(getValue(lowerTL3, 0)),toDouble(getValue(lowerTL3, 0)),toColor(myLowerTrendLine3Color),toInt(myLowerTrendLine3Style),toInt(myLowerTrendLine3Width));
}
if (toBool(Show_Trendlines)){
tltop=toInt(0);
tlbot=toInt(0);
;
for(  j=toInt(0);lessThan(j, 1000);j++){
while (toBool(true)){
if (notEqual(getValue(HP_BuferUp, j), 0)&&lessThan(tlbot, 2)){
setValue(lowerTLtime, tlbot, toInt(Time(toInt(j))));
setValue(lowerTL, tlbot, toDouble(getValue(HP_BuferUp, j)));
tlbot=toInt(tlbot+1);
break;}
if (notEqual(getValue(HP_BuferDn, j), 0)&&lessThan(tltop, 2)){
setValue(upperTLtime, tltop, toInt(Time(toInt(j))));
setValue(upperTL, tltop, toDouble(getValue(HP_BuferDn, j)));
tltop=toInt(tltop+1);
break;}
if (notEqual(getValue(NP_BuferUp, j), 0)&&lessThan(tlbot, 2)){
setValue(lowerTLtime, tlbot, toInt(Time(toInt(j))));
setValue(lowerTL, tlbot, toDouble(getValue(NP_BuferUp, j)));
tlbot=toInt(tlbot+1);
break;}
if (notEqual(getValue(NP_BuferDn, j), 0)&&lessThan(tltop, 2)){
setValue(upperTLtime, tltop, toInt(Time(toInt(j))));
setValue(upperTL, tltop, toDouble(getValue(NP_BuferDn, j)));
tltop=toInt(tltop+1);
break;}
if (notEqual(getValue(FP_BuferUp, j), 0)&&lessThan(tlbot, 2)){
setValue(lowerTLtime, tlbot, toInt(Time(toInt(j))));
setValue(lowerTL, tlbot, toDouble(getValue(FP_BuferUp, j)));
tlbot=toInt(tlbot+1);
break;}
if (notEqual(getValue(FP_BuferDn, j), 0)&&lessThan(tltop, 2)){
setValue(upperTLtime, tltop, toInt(Time(toInt(j))));
setValue(upperTL, tltop, toDouble(getValue(FP_BuferDn, j)));
tltop=toInt(tltop+1);
break;}
break;}
if (greaterThanOrEqualTo(tlbot, 2)&&greaterThanOrEqualTo(tltop, 2)){
break;}
}
DrawPriceTrendLines(toString(OBJ001),toInt(getValue(upperTLtime, 1)),toInt(getValue(upperTLtime, 0)),toDouble(getValue(upperTL, 1)),toDouble(getValue(upperTL, 0)),toColor(myUpperTrendLineColor),toInt(myUpperTrendLineStyle),toInt(myUpperTrendLineWidth));
DrawPriceTrendLines(toString(OBJ002),toInt(getValue(lowerTLtime, 1)),toInt(getValue(lowerTLtime, 0)),toDouble(getValue(lowerTL, 1)),toDouble(getValue(lowerTL, 0)),toColor(myLowerTrendLineColor),toInt(myLowerTrendLineStyle),toInt(myLowerTrendLineWidth));
DrawPriceTrendLines(toString(OBJ003),toInt(getValue(upperTLtime, 0)),toInt(Time(toInt(0))),toDouble(getValue(upperTL, 0)),toDouble(getValue(upperTL, 0)),toColor(myUpperTrendLineColor),toInt(myUpperTrendLineStyle),toInt(myUpperTrendLineWidth));
DrawPriceTrendLines(toString(OBJ004),toInt(getValue(lowerTLtime, 0)),toInt(Time(toInt(0))),toDouble(getValue(lowerTL, 0)),toDouble(getValue(lowerTL, 0)),toColor(myLowerTrendLineColor),toInt(myLowerTrendLineStyle),toInt(myLowerTrendLineWidth));
if (toBool(Show_Medianline)){
midpoint=toDouble(MathAbs(toDouble(getValue(upperTL, 0)+getValue(lowerTL, 0)))*0.50);
;
for(  j=toInt(0);lessThan(j, 1000);j++){
if (greaterThan(Time(toInt(j)), getValue(upperTLtime, 0))&&greaterThan(Time(toInt(j)), getValue(lowerTLtime, 0))){
if(true)continue;}
if (lessThan(midpoint, High(toInt(j)))&&greaterThan(midpoint, Low(toInt(j)))){
break;}
}
if (greaterThan(getValue(lowerTLtime, 1), getValue(upperTLtime, 1))){
midstarttime=toInt(getValue(lowerTLtime, 1));
midstart=toDouble(getValue(lowerTL, 1));
} else {
midstarttime=toInt(getValue(upperTLtime, 1));
midstart=toDouble(getValue(upperTL, 1));
}
DrawPriceTrendLines(toString(OBJ004+"pf"),toInt(midstarttime),toInt(Time(toInt(j))),toDouble(midstart),toDouble(midpoint),toColor(myMedianLineColor),toInt(myMedianLineStyle),toInt(myMedianLineWidth));
}
if (toBool(Show_Retracelines)){
UpperRetracePrice=toDouble(getValue(upperTL, 0)-xRetracePips);
LowerRetracePrice=toDouble(getValue(lowerTL, 0)+xRetracePips);
DrawPriceTrendLines(toString(OBJ005),toInt(getValue(upperTLtime, 0)),toInt(Time(toInt(0))),toDouble(UpperRetracePrice),toDouble(UpperRetracePrice),toColor(myRetraceLineColor),toInt(myRetraceLineStyle),toInt(myRetraceLineWidth));
DrawPriceTrendLines(toString(OBJ006),toInt(getValue(lowerTLtime, 0)),toInt(Time(toInt(0))),toDouble(LowerRetracePrice),toDouble(LowerRetracePrice),toColor(myRetraceLineColor),toInt(myRetraceLineStyle),toInt(myRetraceLineWidth));
}
if (toBool(Show_Targetlines)){
pUpperTargetPrice=toDouble(UpperTargetPrice);
pLowerTargetPrice=toDouble(LowerTargetPrice);
UpperTargetPrice=toDouble(getValue(upperTL, 0)+xTargetPips);
LowerTargetPrice=toDouble(getValue(lowerTL, 0)-xTargetPips);
DrawPriceTrendLines(toString(OBJ007),toInt(getValue(upperTLtime, 0)),toInt(Time(toInt(0))),toDouble(pUpperTargetPrice),toDouble(pUpperTargetPrice),toColor(myTargetLineColor),toInt(myTargetLineStyle),toInt(myTargetLineWidth));
DrawPriceTrendLines(toString(OBJ008),toInt(getValue(lowerTLtime, 0)),toInt(Time(toInt(0))),toDouble(pLowerTargetPrice),toDouble(pLowerTargetPrice),toColor(myTargetLineColor),toInt(myTargetLineStyle),toInt(myTargetLineWidth));
}
UpperTrendLinePrice=toDouble(ObjectGetValueByShift(toString(OBJ001),toInt(0)));
LowerTrendLinePrice=toDouble(ObjectGetValueByShift(toString(OBJ002),toInt(0)));
UpperLimit=toDouble(Ask+xThreshold);
LowerLimit=toDouble(Bid-xThreshold);
if (toBool(Sound_Alert)){
if (greaterThanOrEqualTo(UpperTrendLinePrice, LowerLimit)&&lessThanOrEqualTo(UpperTrendLinePrice, UpperLimit)){
PlaySound  (toString( myUpperSoundFile));
}
if (greaterThanOrEqualTo(LowerTrendLinePrice, LowerLimit)&&lessThanOrEqualTo(LowerTrendLinePrice, UpperLimit)){
PlaySound  (toString( myLowerSoundFile));
}
if (greaterThanOrEqualTo(getValue(upperTL, 0), LowerLimit)&&lessThanOrEqualTo(getValue(upperTL, 0), UpperLimit)){
PlaySound  (toString( myUpperSoundFile));
}
if (greaterThanOrEqualTo(getValue(lowerTL, 0), LowerLimit)&&lessThanOrEqualTo(getValue(lowerTL, 0), UpperLimit)){
PlaySound  (toString( myLowerSoundFile));
}}}
if (toBool(Show_SupResLines3)){
tl3top=toInt(0);
tl3bot=toInt(0);
;
for(  j=toInt(0);lessThan(j, 1000);j++){
if (equal(mySRlevel, 3)){
upperSR=toDouble(getValue(HP_BuferUp, j));
lowerSR=toDouble(getValue(HP_BuferDn, j));
} else 
if (equal(mySRlevel, 2)){
upperSR=toDouble(getValue(NP_BuferUp, j));
lowerSR=toDouble(getValue(NP_BuferDn, j));
} else {
upperSR=toDouble(getValue(FP_BuferUp, j));
lowerSR=toDouble(getValue(FP_BuferDn, j));
}
if (notEqual(upperSR, 0)&&lessThan(tl3bot, NumSRLines)){
tl3bot=toInt(tl3bot+1);
DrawPriceTrendLines(toString(OBJ003+"SR"+j),toInt(Time(toInt(j))),toInt(Time(toInt(0))),toDouble(upperSR),toDouble(upperSR),toColor(myLowerSRColor),toInt(myLowerSRStyle),toInt(myLowerSRWidth));
}
if (notEqual(lowerSR, 0)&&lessThan(tl3top, NumSRLines)){
tl3top=toInt(tl3top+1);
DrawPriceTrendLines(toString(OBJ004+"SR"+j),toInt(Time(toInt(j))),toInt(Time(toInt(0))),toDouble(lowerSR),toDouble(lowerSR),toColor(myUpperSRColor),toInt(myUpperSRStyle),toInt(myUpperSRWidth));
}
if (greaterThanOrEqualTo(tl3bot, NumSRLines)&&greaterThanOrEqualTo(tl3top, NumSRLines)){
break;}
}
}
if (toBool(Show_Fiblines)){
tltop=toInt(0);
tlbot=toInt(0);
;
for(  j=toInt(0);lessThan(j, 1000);j++){
while (toBool(true)){
if (notEqual(getValue(HP_BuferUp, j), 0)&&lessThan(tlbot, 1)){
setValue(lowerTLtime, tlbot, toInt(Time(toInt(j))));
setValue(lowerTL, tlbot, toDouble(getValue(HP_BuferUp, j)));
tlbot=toInt(tlbot+1);
break;}
if (notEqual(getValue(HP_BuferDn, j), 0)&&lessThan(tltop, 1)){
setValue(upperTLtime, tltop, toInt(Time(toInt(j))));
setValue(upperTL, tltop, toDouble(getValue(HP_BuferDn, j)));
tltop=toInt(tltop+1);
break;}
if (notEqual(getValue(NP_BuferUp, j), 0)&&lessThan(tlbot, 1)){
setValue(lowerTLtime, tlbot, toInt(Time(toInt(j))));
setValue(lowerTL, tlbot, toDouble(getValue(NP_BuferUp, j)));
tlbot=toInt(tlbot+1);
break;}
if (notEqual(getValue(NP_BuferDn, j), 0)&&lessThan(tltop, 1)){
setValue(upperTLtime, tltop, toInt(Time(toInt(j))));
setValue(upperTL, tltop, toDouble(getValue(NP_BuferDn, j)));
tltop=toInt(tltop+1);
break;}
if (notEqual(getValue(FP_BuferUp, j), 0)&&lessThan(tlbot, 1)){
setValue(lowerTLtime, tlbot, toInt(Time(toInt(j))));
setValue(lowerTL, tlbot, toDouble(getValue(FP_BuferUp, j)));
tlbot=toInt(tlbot+1);
break;}
if (notEqual(getValue(FP_BuferDn, j), 0)&&lessThan(tltop, 1)){
setValue(upperTLtime, tltop, toInt(Time(toInt(j))));
setValue(upperTL, tltop, toDouble(getValue(FP_BuferDn, j)));
tltop=toInt(tltop+1);
break;}
break;}
if (greaterThanOrEqualTo(tlbot, 1)&&greaterThanOrEqualTo(tltop, 1)){
break;}
}
fibstarttime=toInt(MathMin(toDouble(getValue(upperTLtime, 0)),toDouble(getValue(lowerTLtime, 0))));
fibrange=toDouble(getValue(upperTL, 0)-getValue(lowerTL, 0));
;
for(  j=toInt(0);lessThan(j, 5);j++){
setValue(fibvalue, j, toDouble(getValue(lowerTL, 0)+(fibrange*getValue(FIBLEVEL, j))));
setValue(fibvalue, j, toDouble(NormalizeDouble(toDouble(getValue(fibvalue, j)),toInt(Digits))));
DrawPriceTrendLines(toString(OBJ003+"FIB"+j),toInt(fibstarttime),toInt(Time(toInt(0))),toDouble(getValue(fibvalue, j)),toDouble(getValue(fibvalue, j)),toColor(getValue(FIBCOLOR, j)),toInt(myFibLineStyle),toInt(myFibLineWidth));
}
}
if (toBool(Show_Fiblines3)){
tltop=toInt(0);
tlbot=toInt(0);
;
for(  j=toInt(0);lessThan(j, 1000);j++){
while (toBool(true)){
if (notEqual(getValue(HP_BuferUp, j), 0)&&lessThan(tlbot, 1)){
setValue(lowerTLtime, tlbot, toInt(Time(toInt(j))));
setValue(lowerTL, tlbot, toDouble(getValue(HP_BuferUp, j)));
tlbot=toInt(tlbot+1);
break;}
if (notEqual(getValue(HP_BuferDn, j), 0)&&lessThan(tltop, 1)){
setValue(upperTLtime, tltop, toInt(Time(toInt(j))));
setValue(upperTL, tltop, toDouble(getValue(HP_BuferDn, j)));
tltop=toInt(tltop+1);
break;}
break;}
if (greaterThanOrEqualTo(tlbot, 1)&&greaterThanOrEqualTo(tltop, 1)){
break;}
}
fibstarttime=toInt(MathMin(toDouble(getValue(upperTLtime, 0)),toDouble(getValue(lowerTLtime, 0))));
fibrange=toDouble(getValue(upperTL, 0)-getValue(lowerTL, 0));
;
for(  j=toInt(0);lessThan(j, 5);j++){
setValue(fibvalue3, j, toDouble(getValue(lowerTL, 0)+(fibrange*getValue(FIBLEVEL, j))));
setValue(fibvalue3, j, toDouble(NormalizeDouble(toDouble(getValue(fibvalue3, j)),toInt(Digits))));
DrawPriceTrendLines(toString(OBJ003+"FIB3"+j),toInt(fibstarttime),toInt(Time(toInt(0))),toDouble(getValue(fibvalue3, j)),toDouble(getValue(fibvalue3, j)),toColor(getValue(FIBCOLOR, j)),toInt(myFibLine3Style),toInt(myFibLine3Width));
}
}
if (toBool(Show_Legend)){
DoShowLegend();
}
OldBars=toInt(Bars);
if(true)return toInt((0));return 0;
}
public String TimeFrameToString(int tf) throws JFException {
String tfs = "";
switch (toInt(tf)){
case PERIOD_M1: 
tfs=toString("M1");
break;
case PERIOD_M5: 
tfs=toString("M5");
break;
case PERIOD_M15: 
tfs=toString("M15");
break;
case PERIOD_M30: 
tfs=toString("M30");
break;
case PERIOD_H1: 
tfs=toString("H1");
break;
case PERIOD_H4: 
tfs=toString("H4");
break;
case PERIOD_D1: 
tfs=toString("D1");
break;
case PERIOD_W1: 
tfs=toString("W1");
break;
case PERIOD_MN1: 
tfs=toString("MN");
}
if(true)return toString((tfs));return "";
}
public int CountZZ(double[] ExtMapBuffer, double[] ExtMapBuffer2, int ExtDepth, int ExtDeviation, int ExtBackstep) throws JFException {
int shift = 0;
int back = 0;
int lasthighpos = 0;
int lastlowpos = 0;
double val = 0.0;
double res = 0.0;
double curlow = 0.0;
double curhigh = 0.0;
double lasthigh = 0.0;
double lastlow = 0.0;
;
for(  shift=toInt(Bars-ExtDepth);greaterThanOrEqualTo(shift, 0);shift--){
val=toDouble(Low(toInt(Lowest(toInstrument(null),toPeriod(0),toInt(MODE_LOW),toInt(ExtDepth),toInt(shift)))));
if (equal(val, lastlow)){
val=toDouble(0.0);
} else {
lastlow=toDouble(val);
if (greaterThan((Low(toInt(shift))-val), (ExtDeviation*Point))){
val=toDouble(0.0);
} else {
;
for(  back=toInt(1);lessThanOrEqualTo(back, ExtBackstep);back++){
res=toDouble(getValue(ExtMapBuffer, shift+back));
if ((notEqual(res, 0))&&(greaterThan(res, val))){
setValue(ExtMapBuffer, shift+back, toDouble(0.0));
}
}
}
}
setValue(ExtMapBuffer, shift, toDouble(val));
val=toDouble(High(toInt(Highest(toInstrument(null),toPeriod(0),toInt(MODE_HIGH),toInt(ExtDepth),toInt(shift)))));
if (equal(val, lasthigh)){
val=toDouble(0.0);
} else {
lasthigh=toDouble(val);
if (greaterThan((val-High(toInt(shift))), (ExtDeviation*Point))){
val=toDouble(0.0);
} else {
;
for(  back=toInt(1);lessThanOrEqualTo(back, ExtBackstep);back++){
res=toDouble(getValue(ExtMapBuffer2, shift+back));
if ((notEqual(res, 0))&&(lessThan(res, val))){
setValue(ExtMapBuffer2, shift+back, toDouble(0.0));
}
}
}
}
setValue(ExtMapBuffer2, shift, toDouble(val));
}
lasthigh=toDouble(-1);
lasthighpos=toInt(-1);
lastlow=toDouble(-1);
lastlowpos=toInt(-1);
;
for(  shift=toInt(Bars-ExtDepth);greaterThanOrEqualTo(shift, 0);shift--){
curlow=toDouble(getValue(ExtMapBuffer, shift));
curhigh=toDouble(getValue(ExtMapBuffer2, shift));
if ((equal(curlow, 0))&&(equal(curhigh, 0))){
if(true)continue;}
if (notEqual(curhigh, 0)){
if (greaterThan(lasthigh, 0)){
if (lessThan(lasthigh, curhigh)){
setValue(ExtMapBuffer2, lasthighpos, toDouble(0));
} else {
setValue(ExtMapBuffer2, shift, toDouble(0));
}}
if (lessThan(lasthigh, curhigh)||lessThan(lasthigh, 0)){
lasthigh=toDouble(curhigh);
lasthighpos=toInt(shift);
}
lastlow=toDouble(-1);
}
if (notEqual(curlow, 0)){
if (greaterThan(lastlow, 0)){
if (greaterThan(lastlow, curlow)){
setValue(ExtMapBuffer, lastlowpos, toDouble(0));
} else {
setValue(ExtMapBuffer, shift, toDouble(0));
}}
if ((lessThan(curlow, lastlow))||(lessThan(lastlow, 0))){
lastlow=toDouble(curlow);
lastlowpos=toInt(shift);
}
lasthigh=toDouble(-1);
}
}
;
for(  shift=toInt(Bars-1);greaterThanOrEqualTo(shift, 0);shift--){
if (greaterThanOrEqualTo(shift, Bars-ExtDepth)){
setValue(ExtMapBuffer, shift, toDouble(0.0));
} else {
res=toDouble(getValue(ExtMapBuffer2, shift));
if (notEqual(res, 0.0)){
setValue(ExtMapBuffer2, shift, toDouble(res));
}
}
}
return 0;
}
public int Str2Massive(String VStr, int M_Count, int[] VMass) throws JFException {
int val = 0;
int mc = 0;
val = toInt(StrToInteger(toString(VStr)));
if (greaterThan(val, 0)){
M_Count++;
mc = toInt(ArrayResize(VMass,toInt(M_Count)));
if (equal(mc, 0)){
if(true)return toInt((-1));}
setValue(VMass, M_Count-1, toInt(val));
if(true)return toInt((1));
} else {
if(true)return toInt((0));
}return 0;
}
public int IntFromStr(String ValStr, int M_Count, int[] VMass) throws JFException {
String SS = "";
int NP = 0;
String CS = "";
if (equal(StringLen(toString(ValStr)), 0)){
if(true)return toInt((-1));}
SS = toString(ValStr);
NP = toInt(0);
M_Count=toInt(0);
ArrayResize(VMass,toInt(M_Count));
while (greaterThan(StringLen(toString(SS)), 0)){
NP=toInt(StringFind(toString(SS),toString(",")));
if (greaterThan(NP, 0)){
CS=toString(StringSubstr(toString(SS),toInt(0),toInt(NP)));
SS=toString(StringSubstr(toString(SS),toInt(NP+1),toInt(StringLen(toString(SS)))));
} else 
if (greaterThan(StringLen(toString(SS)), 0)){
CS=toString(SS);
SS=toString("");
}
if (equal(Str2Massive(toString(CS),toInt(M_Count),VMass), 0)){
if(true)return toInt((-2));}}
if(true)return toInt((1));return 0;
}
public String fFill(String filled, int f) throws JFException {
String FILLED = "";
FILLED=toString(StringSubstr(toString(filled+"                                         "),toInt(0),toInt(f)));
if(true)return toString((FILLED));return "";
}
public void DoRollMsg(String msg) throws JFException {
int m=toInt(23);
if (notEqual(msg, "")){
roll=toBool(true);
;
for(   m=toInt(23);greaterThanOrEqualTo(m, 0);m--){
setValue(Messages, m+1, toString(getValue(Messages, m)));
}
setValue(Messages, 0, toString(fFill(toString(msg),toInt(30))));
}return ;
}
public void DrawPriceTrendLines(String objname, long x1, long x2, double y1, double y2, Color lineColor, int style, int width) throws JFException {
String Obj0002 = "";
ObjectDelete  (toString( objname));
ObjectCreate(toString(objname),toInt(OBJ_TREND),toInt(0),toInt(x1),toDouble(y1),toInt(x2),toDouble(y2),toInt(0),toDouble(0));
ObjectSet(toString(objname),toInt(OBJPROP_RAY),toDouble(true));
ObjectSet(toString(objname),toInt(OBJPROP_COLOR),toDouble(lineColor));
ObjectSet(toString(objname),toInt(OBJPROP_STYLE),toDouble(style));
ObjectSet(toString(objname),toInt(OBJPROP_WIDTH),toDouble(width));
if (toBool(Show_Label)&&equal(y1, y2)){
Obj0002 = toString(objname+"linelbl");
ObjectDelete  (toString( Obj0002));
if (notEqual(ObjectFind(toString(Obj0002)), 0)){
ObjectCreate(toString(Obj0002),toInt(OBJ_TEXT),toInt(0),toInt(Time(toInt(0))+period*60),toDouble(y1));
ObjectSetText(toString(Obj0002),toString(DoubleToStr(toDouble(y1),toInt(digits))),toInt(8),toString("Arial"),toColor(lineColor));
} else {
ObjectMove(toString(Obj0002),toInt(0),toInt(Time(toInt(0))+period*60),toDouble(y1));
}}return ;
}
public void DoShowLegend() throws JFException {
yIncL=toInt(0);
if (toBool(Show_Trendlines)){
setObject(toString(TAG+"ut"),toString("Upper Target  "+DoubleToStr(toDouble(pUpperTargetPrice),toInt(digits))),toInt(30),toInt(yIncLegend),toColor(myTargetLineColor));
setObject(toString(TAG+"ut1"),toString("l"),toInt(10),toInt(yIncLegend),toColor(myTargetLineColor),toString("Wingdings"));
yIncL=toInt(yIncL+20);
setObject(toString(TAG+"us"),toString("Upper Semafor "+DoubleToStr(toDouble(getValue(upperTL, 0)),toInt(digits))),toInt(30),toInt(yIncLegend+yIncL),toColor(myUpperTrendLineColor));
setObject(toString(TAG+"us1"),toString("l"),toInt(10),toInt(yIncLegend+yIncL),toColor(myUpperTrendLineColor),toString("Wingdings"));
yIncL=toInt(yIncL+20);
setObject(toString(TAG+"ur"),toString("Upper Retrace "+DoubleToStr(toDouble(UpperRetracePrice),toInt(digits))),toInt(30),toInt(yIncLegend+yIncL),toColor(myRetraceLineColor));
setObject(toString(TAG+"ur1"),toString("l"),toInt(10),toInt(yIncLegend+yIncL),toColor(myRetraceLineColor),toString("Wingdings"));
yIncL=toInt(yIncL+20);
setObject(toString(TAG+"lr"),toString("Lower Retrace "+DoubleToStr(toDouble(LowerRetracePrice),toInt(digits))),toInt(30),toInt(yIncLegend+yIncL),toColor(myRetraceLineColor));
setObject(toString(TAG+"lr1"),toString("l"),toInt(10),toInt(yIncLegend+yIncL),toColor(myRetraceLineColor),toString("Wingdings"));
yIncL=toInt(yIncL+20);
setObject(toString(TAG+"ls"),toString("Lower Semafor "+DoubleToStr(toDouble(getValue(lowerTL, 0)),toInt(digits))),toInt(30),toInt(yIncLegend+yIncL),toColor(myLowerTrendLineColor));
setObject(toString(TAG+"ls1"),toString("l"),toInt(10),toInt(yIncLegend+yIncL),toColor(myLowerTrendLineColor),toString("Wingdings"));
yIncL=toInt(yIncL+20);
setObject(toString(TAG+"lt"),toString("Lower Target  "+DoubleToStr(toDouble(pLowerTargetPrice),toInt(digits))),toInt(30),toInt(yIncLegend+yIncL),toColor(myTargetLineColor));
setObject(toString(TAG+"lt1"),toString("l"),toInt(10),toInt(yIncLegend+yIncL),toColor(myTargetLineColor),toString("Wingdings"));
yIncL=toInt(yIncL+20);
setObject(toString(TAG+"ml"),toString("Median Line   "+DoubleToStr(toDouble(midpoint),toInt(digits))),toInt(30),toInt(yIncLegend+yIncL),toColor(myMedianLineColor));
setObject(toString(TAG+"ml1"),toString("l"),toInt(10),toInt(yIncLegend+yIncL),toColor(myMedianLineColor),toString("Wingdings"));
}
if (toBool(Show_Fiblines3)){
yIncL=toInt(yIncL+20);
;
for(  j=toInt(4);greaterThanOrEqualTo(j, 0);j--){
yIncL=toInt(yIncL+20);
sFib=toString(DoubleToStr(toDouble(getValue(FIBLEVEL, j)*100),toInt(1))+"%    ");
setObject(toString(TAG+"Fib3."+j),toString("Fib3 "+sFib+DoubleToStr(toDouble(getValue(fibvalue3, j)),toInt(digits))),toInt(30),toInt(yIncLegend+yIncL),toColor(getValue(FIBCOLOR, j)));
setObject(toString(TAG+"fib31."+j),toString("l"),toInt(10),toInt(yIncLegend+yIncL),toColor(getValue(FIBCOLOR, j)),toString("Wingdings"));
}
}
if (toBool(Show_Fiblines)){
yIncL=toInt(yIncL+20);
;
for(  j=toInt(4);greaterThanOrEqualTo(j, 0);j--){
yIncL=toInt(yIncL+20);
sFib=toString(DoubleToStr(toDouble(getValue(FIBLEVEL, j)*100),toInt(1))+"%     ");
setObject(toString(TAG+"Fib"+j),toString("Fib "+sFib+DoubleToStr(toDouble(getValue(fibvalue, j)),toInt(digits))),toInt(30),toInt(yIncLegend+yIncL),toColor(getValue(FIBCOLOR, j)));
setObject(toString(TAG+"fib1"+j),toString("l"),toInt(10),toInt(yIncLegend+yIncL),toColor(getValue(FIBCOLOR, j)),toString("Wingdings"));
}
}
if (toBool(Show_Bars)){
yIncL=toInt(yIncL+40);
setObject(toString(TAG+"sem3u"),toString("Upper Semafor "+DoubleToStr(toDouble(getValue(upperTL3, 0)),toInt(digits))+"["+getValue(upperTLBars3, 0)+"]"),toInt(30),toInt(yIncLegend+yIncL),toColor(indicator_color6));
setObject(toString(TAG+"sem3u1"),toString(CharToStr(toInt(Symbol_3_Kod))),toInt(10),toInt(yIncLegend+yIncL),toColor(indicator_color6),toString("Wingdings"));
yIncL=toInt(yIncL+20);
setObject(toString(TAG+"sem3l"),toString("Lower Semafor "+DoubleToStr(toDouble(getValue(lowerTL3, 0)),toInt(digits))+"["+getValue(lowerTLBars3, 0)+"]"),toInt(30),toInt(yIncLegend+yIncL),toColor(indicator_color6));
setObject(toString(TAG+"sem3l1"),toString(CharToStr(toInt(Symbol_3_Kod))),toInt(10),toInt(yIncLegend+yIncL),toColor(indicator_color6),toString("Wingdings"));
yIncL=toInt(yIncL+20);
setObject(toString(TAG+"sem2u"),toString("Upper Semafor "+DoubleToStr(toDouble(getValue(upperTL2, 0)),toInt(digits))+"["+getValue(upperTLBars2, 0)+"]"),toInt(30),toInt(yIncLegend+yIncL),toColor(indicator_color4));
setObject(toString(TAG+"sem2u1"),toString(CharToStr(toInt(Symbol_2_Kod))),toInt(10),toInt(yIncLegend+yIncL),toColor(indicator_color4),toString("Wingdings"));
yIncL=toInt(yIncL+20);
setObject(toString(TAG+"sem2l"),toString("Lower Semafor "+DoubleToStr(toDouble(getValue(lowerTL2, 0)),toInt(digits))+"["+getValue(lowerTLBars2, 0)+"]"),toInt(30),toInt(yIncLegend+yIncL),toColor(indicator_color4));
setObject(toString(TAG+"sem2l1"),toString(CharToStr(toInt(Symbol_2_Kod))),toInt(10),toInt(yIncLegend+yIncL),toColor(indicator_color4),toString("Wingdings"));
yIncL=toInt(yIncL+20);
setObject(toString(TAG+"sem1u"),toString("Upper Semafor "+DoubleToStr(toDouble(getValue(upperTL1, 0)),toInt(digits))+"["+getValue(upperTLBars1, 0)+"]"),toInt(30),toInt(yIncLegend+yIncL),toColor(indicator_color2));
setObject(toString(TAG+"sem1u1"),toString(CharToStr(toInt(Symbol_1_Kod))),toInt(10),toInt(yIncLegend+yIncL),toColor(indicator_color2),toString("Wingdings"));
yIncL=toInt(yIncL+20);
setObject(toString(TAG+"sem1l"),toString("Lower Semafor "+DoubleToStr(toDouble(getValue(lowerTL1, 0)),toInt(digits))+"["+getValue(lowerTLBars1, 0)+"]"),toInt(30),toInt(yIncLegend+yIncL),toColor(indicator_color2));
setObject(toString(TAG+"sem1l1"),toString(CharToStr(toInt(Symbol_1_Kod))),toInt(10),toInt(yIncLegend+yIncL),toColor(indicator_color2),toString("Wingdings"));
}return ;
}
void setObject(String labelName, String text, int x, int y, Color theColor, String font, int size) throws JFException {
setObject(toString(labelName), toString(text), toInt(x), toInt(y), toColor(theColor), toString(font), toInt(size), toInt(0));
}
void setObject(String labelName, String text, int x, int y, Color theColor, String font) throws JFException {
setObject(toString(labelName), toString(text), toInt(x), toInt(y), toColor(theColor), toString(font), toInt(10), toInt(0));
}
void setObject(String labelName, String text, int x, int y, Color theColor) throws JFException {
setObject(toString(labelName), toString(text), toInt(x), toInt(y), toColor(theColor), toString("Courier New"), toInt(10), toInt(0));
}
public void setObject(String labelName, String text, int x, int y, Color theColor, String font, int size, int angle) throws JFException {
if (equal(ObjectFind(toString(labelName)), -1)){
ObjectCreate(toString(labelName),toInt(OBJ_LABEL),toInt(0),toInt(0),toDouble(0));
ObjectSet(toString(labelName),toInt(OBJPROP_CORNER),toDouble(0));
if (notEqual(angle, 0)){
ObjectSet(toString(labelName),toInt(OBJPROP_ANGLE),toDouble(angle));
}}
ObjectSet(toString(labelName),toInt(OBJPROP_XDISTANCE),toDouble(x));
ObjectSet(toString(labelName),toInt(OBJPROP_YDISTANCE),toDouble(y));
ObjectSetText(toString(labelName),toString(text),toInt(size),toString(font),toColor(theColor));
return ;
}
public void TRO() throws JFException {
String tObjName03 = "";
tObjName03 = toString("TROTAG");
ObjectCreate(toString(tObjName03),toInt(OBJ_LABEL),toInt(0),toInt(0),toDouble(0));
ObjectSetText(toString(tObjName03),toString(CharToStr(toInt(78))),toInt(12),toString("Wingdings"),toColor(DimGray));
ObjectSet(toString(tObjName03),toInt(OBJPROP_CORNER),toDouble(3));
ObjectSet(toString(tObjName03),toInt(OBJPROP_XDISTANCE),toDouble(5));
ObjectSet(toString(tObjName03),toInt(OBJPROP_YDISTANCE),toDouble(5));
return ;
}

/**/};