|
@@ -84,69 +84,29 @@ datetime time_to_place_trade = 0.0;
|
|
|
//+------------------------------------------------------------------+
|
|
//+------------------------------------------------------------------+
|
|
|
void Bos(int i)
|
|
void Bos(int i)
|
|
|
{
|
|
{
|
|
|
-//Print("in boss");
|
|
|
|
|
-//Print("trend is ",trend);
|
|
|
|
|
|
|
+ int save_bullish_index = 0;
|
|
|
|
|
+ int save_bearish_index = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
if(trend == "uptrend")
|
|
if(trend == "uptrend")
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
- //high = iHigh(Symbol(),PERIOD_CURRENT,high_index);
|
|
|
|
|
high1 = iHigh(Symbol(),PERIOD_CURRENT,i);
|
|
high1 = iHigh(Symbol(),PERIOD_CURRENT,i);
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
double close = iClose(Symbol(),PERIOD_CURRENT,i);
|
|
double close = iClose(Symbol(),PERIOD_CURRENT,i);
|
|
|
-
|
|
|
|
|
- //Print("high is ",high);
|
|
|
|
|
- //Print("close is ", close,"time is ",iTime(Symbol(),PERIOD_CURRENT,i));
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
if(close > high)
|
|
if(close > high)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //--------------
|
|
|
|
|
-
|
|
|
|
|
- // ObjectCreate(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),high);
|
|
|
|
|
- // ObjectSetString(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
|
|
|
- //
|
|
|
|
|
- // store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
|
|
- // Print(store_last_bos_index_time);
|
|
|
|
|
- //
|
|
|
|
|
- // Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
|
|
|
- //
|
|
|
|
|
- //
|
|
|
|
|
- // Print("last bos index is ",Store_bos_last_index);
|
|
|
|
|
-
|
|
|
|
|
- //------------------
|
|
|
|
|
-
|
|
|
|
|
high_index = iBarShift(Symbol(), PERIOD_CURRENT, high_index_time, false);
|
|
high_index = iBarShift(Symbol(), PERIOD_CURRENT, high_index_time, false);
|
|
|
-
|
|
|
|
|
- // Print("high index ",high_index);
|
|
|
|
|
-
|
|
|
|
|
- int count = (high_index-1) - i;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // Print("count is ",count);
|
|
|
|
|
-
|
|
|
|
|
- for(int j=count; j >= 1; j--)
|
|
|
|
|
|
|
+ for(int j=high_index-1; j > i; j--)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
- if(checkCandle(high_index-j) == "Bearish")
|
|
|
|
|
|
|
+ if(checkCandle(j) == "Bearish")
|
|
|
{
|
|
{
|
|
|
|
|
+ save_bullish_index = j;
|
|
|
if(object_find("high") > 0)
|
|
if(object_find("high") > 0)
|
|
|
{
|
|
{
|
|
|
ObjectDelete(0,"high");
|
|
ObjectDelete(0,"high");
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
high = high1;
|
|
high = high1;
|
|
|
|
|
|
|
|
- // Print(" high is updated : ",high);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
|
|
ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
|
|
|
ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
|
|
ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
|
|
|
ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
|
|
ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
|
|
@@ -155,21 +115,13 @@ void Bos(int i)
|
|
|
ObjectSetString(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
ObjectSetString(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
|
|
|
|
|
|
store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
- //Print(store_last_bos_index_time);
|
|
|
|
|
-
|
|
|
|
|
- Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- // Print("last bos index is ",Store_bos_last_index);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // Print("bearish candle found and its low is ",low);
|
|
|
|
|
|
|
+ Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
|
|
|
|
|
|
- low = iLow(Symbol(),PERIOD_CURRENT,high_index-j);
|
|
|
|
|
- // Print("bearish candle found and its low is ",low);
|
|
|
|
|
|
|
+ low = iLow(Symbol(),PERIOD_CURRENT,j);
|
|
|
bearish_found = true;
|
|
bearish_found = true;
|
|
|
- count = high_index-j;
|
|
|
|
|
- index_of_low_time = iTime(Symbol(),PERIOD_CURRENT,high_index-j);
|
|
|
|
|
|
|
+ index_of_low_time = iTime(Symbol(),PERIOD_CURRENT,j);
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -179,7 +131,7 @@ void Bos(int i)
|
|
|
if(bearish_found == true)
|
|
if(bearish_found == true)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
- for(int k=count-1; k > Store_bos_last_index ; k--)
|
|
|
|
|
|
|
+ for(int k=save_bullish_index; k > i ; k--)
|
|
|
{
|
|
{
|
|
|
low1 = iLow(Symbol(),PERIOD_CURRENT,k);
|
|
low1 = iLow(Symbol(),PERIOD_CURRENT,k);
|
|
|
if(low1 < low)
|
|
if(low1 < low)
|
|
@@ -187,17 +139,8 @@ void Bos(int i)
|
|
|
|
|
|
|
|
low = low1;
|
|
low = low1;
|
|
|
index_of_low_time = iTime(Symbol(),PERIOD_CURRENT,k);
|
|
index_of_low_time = iTime(Symbol(),PERIOD_CURRENT,k);
|
|
|
-
|
|
|
|
|
- //index_of_low = high_index- k;
|
|
|
|
|
-
|
|
|
|
|
- // Print(" ------------------index of low ",index_of_low);
|
|
|
|
|
bearish_found = false;
|
|
bearish_found = false;
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(object_find("low") > 0)
|
|
if(object_find("low") > 0)
|
|
@@ -205,7 +148,7 @@ void Bos(int i)
|
|
|
|
|
|
|
|
if(ObjectDelete(0,"low"))
|
|
if(ObjectDelete(0,"low"))
|
|
|
{
|
|
{
|
|
|
- Print("object deleted :");
|
|
|
|
|
|
|
+ //Print("object deleted :");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -220,76 +163,30 @@ void Bos(int i)
|
|
|
|
|
|
|
|
ObjectSetInteger(0,"low",OBJPROP_COLOR,clrRed);
|
|
ObjectSetInteger(0,"low",OBJPROP_COLOR,clrRed);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- // Print("high of uptrend is ", high);
|
|
|
|
|
- // Print("low of uptrend is ", low);
|
|
|
|
|
-
|
|
|
|
|
high_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
high_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(trend == "downtrend")
|
|
if(trend == "downtrend")
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //low = iLow(Symbol(),PERIOD_CURRENT,low_index);
|
|
|
|
|
low1 = iLow(Symbol(),PERIOD_CURRENT,i);
|
|
low1 = iLow(Symbol(),PERIOD_CURRENT,i);
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
double close1 = iClose(Symbol(),PERIOD_CURRENT,i);
|
|
double close1 = iClose(Symbol(),PERIOD_CURRENT,i);
|
|
|
-
|
|
|
|
|
if(close1 < low)
|
|
if(close1 < low)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // here the update
|
|
|
|
|
-
|
|
|
|
|
- // ObjectCreate(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),low);
|
|
|
|
|
- // ObjectSetString(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
|
|
|
- //
|
|
|
|
|
- //
|
|
|
|
|
- // store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
|
|
- // Print(store_last_bos_index_time);
|
|
|
|
|
- //
|
|
|
|
|
- // Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
|
|
|
- //
|
|
|
|
|
- //
|
|
|
|
|
- // Print("last bos index is ",Store_bos_last_index);
|
|
|
|
|
-
|
|
|
|
|
- // to this
|
|
|
|
|
-
|
|
|
|
|
- //Store_bos_last_index = i;
|
|
|
|
|
-
|
|
|
|
|
low_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
|
|
low_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
|
|
|
-
|
|
|
|
|
- // Print("low index ",low_index);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- int count = (low_index-1) - i;
|
|
|
|
|
- // Print("count is ",count);
|
|
|
|
|
-
|
|
|
|
|
- for(int j=count; j >= 1; j--)
|
|
|
|
|
|
|
+ for(int j=low_index - 1; j > i; j--)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
- if(checkCandle(low_index-j) == "Bullish")
|
|
|
|
|
|
|
+ if(checkCandle(j) == "Bullish")
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+ save_bullish_index = j;
|
|
|
if(object_find("low") > 0)
|
|
if(object_find("low") > 0)
|
|
|
{
|
|
{
|
|
|
ObjectDelete(0,"low");
|
|
ObjectDelete(0,"low");
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
low = low1;
|
|
low = low1;
|
|
|
ObjectCreate(0,"low",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),low,iTime(Symbol(),PERIOD_CURRENT,0),low);
|
|
ObjectCreate(0,"low",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),low,iTime(Symbol(),PERIOD_CURRENT,0),low);
|
|
@@ -297,34 +194,18 @@ void Bos(int i)
|
|
|
|
|
|
|
|
ObjectSetInteger(0,"low",OBJPROP_COLOR,clrRed);
|
|
ObjectSetInteger(0,"low",OBJPROP_COLOR,clrRed);
|
|
|
|
|
|
|
|
- // -----
|
|
|
|
|
-
|
|
|
|
|
ObjectCreate(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),low);
|
|
ObjectCreate(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),low);
|
|
|
ObjectSetString(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
ObjectSetString(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
|
|
|
|
|
|
-
|
|
|
|
|
store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
- // Print(store_last_bos_index_time);
|
|
|
|
|
|
|
|
|
|
Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- // Print("last bos index is ",Store_bos_last_index);
|
|
|
|
|
-
|
|
|
|
|
- //------
|
|
|
|
|
low_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
|
|
low_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
|
|
|
|
|
|
|
|
- // Print("low index ",low_index);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // Print("bullish candle found and its high is ",high);
|
|
|
|
|
-
|
|
|
|
|
- high = iHigh(Symbol(),PERIOD_CURRENT,low_index-j);
|
|
|
|
|
- // Print("bullish candle found and its high is ",high);
|
|
|
|
|
|
|
+ high = iHigh(Symbol(),PERIOD_CURRENT,j);
|
|
|
bullish_found = true;
|
|
bullish_found = true;
|
|
|
- count = low_index-j;
|
|
|
|
|
- index_of_high_time = iTime(Symbol(),PERIOD_CURRENT,low_index-j);
|
|
|
|
|
|
|
+ index_of_high_time = iTime(Symbol(),PERIOD_CURRENT,j);
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -336,7 +217,7 @@ void Bos(int i)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
- for(int k=count-1; k > Store_bos_last_index ; k--)
|
|
|
|
|
|
|
+ for(int k=save_bullish_index; k > i ; k--)
|
|
|
{
|
|
{
|
|
|
high1 = iHigh(Symbol(),PERIOD_CURRENT,k);
|
|
high1 = iHigh(Symbol(),PERIOD_CURRENT,k);
|
|
|
if(high1 > high)
|
|
if(high1 > high)
|
|
@@ -344,16 +225,10 @@ void Bos(int i)
|
|
|
|
|
|
|
|
high = high1;
|
|
high = high1;
|
|
|
index_of_high_time = iTime(Symbol(),PERIOD_CURRENT,k);
|
|
index_of_high_time = iTime(Symbol(),PERIOD_CURRENT,k);
|
|
|
-
|
|
|
|
|
- //index_of_low = high_index- k;
|
|
|
|
|
-
|
|
|
|
|
bullish_found = false;
|
|
bullish_found = false;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -371,9 +246,6 @@ void Bos(int i)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- // Print("high is ", high);
|
|
|
|
|
- // Print("low is ", low);
|
|
|
|
|
low_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
low_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -688,6 +560,9 @@ void bos2(int i)
|
|
|
double find_high = 0.0;
|
|
double find_high = 0.0;
|
|
|
datetime find_high_time = 0.0;
|
|
datetime find_high_time = 0.0;
|
|
|
|
|
|
|
|
|
|
+ int save_bullish_index = 0;
|
|
|
|
|
+ int save_bearish_index = 0;
|
|
|
|
|
+
|
|
|
double find_low = 0.0;
|
|
double find_low = 0.0;
|
|
|
datetime find_low_time = 0.0;
|
|
datetime find_low_time = 0.0;
|
|
|
|
|
|
|
@@ -713,21 +588,30 @@ void bos2(int i)
|
|
|
{
|
|
{
|
|
|
if(checkCandle(m) == "Bullish")
|
|
if(checkCandle(m) == "Bullish")
|
|
|
{
|
|
{
|
|
|
|
|
+ save_bullish_index = m;
|
|
|
candle_bullish = true;
|
|
candle_bullish = true;
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- choch_index = iBarShift(Symbol(), PERIOD_CURRENT, choch_index_time, false);
|
|
|
|
|
|
|
|
|
|
- find_high = iHigh(Symbol(),PERIOD_CURRENT,choch_index);
|
|
|
|
|
- for(int j=choch_index; j>=i; j--)
|
|
|
|
|
- {
|
|
|
|
|
- double find_high1 = iHigh(Symbol(),PERIOD_CURRENT,j);
|
|
|
|
|
|
|
|
|
|
|
|
+ find_high = iHigh(Symbol(),PERIOD_CURRENT,save_bullish_index);
|
|
|
|
|
+ for(int m=save_bullish_index; m>i; m--)
|
|
|
|
|
+ {
|
|
|
|
|
+ double find_high1 = iHigh(Symbol(),PERIOD_CURRENT,m);
|
|
|
|
|
+ find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
|
if(find_high < find_high1)
|
|
if(find_high < find_high1)
|
|
|
{
|
|
{
|
|
|
find_high = find_high1;
|
|
find_high = find_high1;
|
|
|
- find_high_time = iTime(Symbol(),PERIOD_CURRENT,j);
|
|
|
|
|
|
|
+ find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ for(int j=choch_index; j>=i; j--)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
|
|
|
if(iClose(Symbol(),PERIOD_CURRENT,j) < iClose(Symbol(),PERIOD_CURRENT,i) || iLow(Symbol(),PERIOD_CURRENT,j) < iLow(Symbol(),PERIOD_CURRENT,i))
|
|
if(iClose(Symbol(),PERIOD_CURRENT,j) < iClose(Symbol(),PERIOD_CURRENT,i) || iLow(Symbol(),PERIOD_CURRENT,j) < iLow(Symbol(),PERIOD_CURRENT,i))
|
|
|
{
|
|
{
|
|
@@ -744,21 +628,27 @@ void bos2(int i)
|
|
|
{
|
|
{
|
|
|
if(checkCandle(m) == "Bullish")
|
|
if(checkCandle(m) == "Bullish")
|
|
|
{
|
|
{
|
|
|
|
|
+ save_bullish_index = m;
|
|
|
candle_bullish = true;
|
|
candle_bullish = true;
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
|
|
|
|
|
|
|
|
- find_high = iHigh(Symbol(),PERIOD_CURRENT,Store_bos_last_index);
|
|
|
|
|
- for(int j=Store_bos_last_index; j>=i; j--)
|
|
|
|
|
- {
|
|
|
|
|
- double find_high1 = iHigh(Symbol(),PERIOD_CURRENT,j);
|
|
|
|
|
|
|
|
|
|
|
|
+ find_high = iHigh(Symbol(),PERIOD_CURRENT,save_bullish_index);
|
|
|
|
|
+ for(int m=save_bullish_index; m>i; m--)
|
|
|
|
|
+ {
|
|
|
|
|
+ double find_high1 = iHigh(Symbol(),PERIOD_CURRENT,m);
|
|
|
|
|
+ find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
|
if(find_high < find_high1)
|
|
if(find_high < find_high1)
|
|
|
{
|
|
{
|
|
|
find_high = find_high1;
|
|
find_high = find_high1;
|
|
|
- find_high_time = iTime(Symbol(),PERIOD_CURRENT,j);
|
|
|
|
|
|
|
+ find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for(int j=Store_bos_last_index; j>=i; j--)
|
|
|
|
|
+ {
|
|
|
if(iClose(Symbol(),PERIOD_CURRENT,j) < iClose(Symbol(),PERIOD_CURRENT,i) || iLow(Symbol(),PERIOD_CURRENT,j) < iLow(Symbol(),PERIOD_CURRENT,i))
|
|
if(iClose(Symbol(),PERIOD_CURRENT,j) < iClose(Symbol(),PERIOD_CURRENT,i) || iLow(Symbol(),PERIOD_CURRENT,j) < iLow(Symbol(),PERIOD_CURRENT,i))
|
|
|
{
|
|
{
|
|
|
cnd = false;
|
|
cnd = false;
|
|
@@ -780,6 +670,7 @@ void bos2(int i)
|
|
|
}
|
|
}
|
|
|
high = find_high;
|
|
high = find_high;
|
|
|
index_of_high = iBarShift(Symbol(), PERIOD_CURRENT, find_high_time, false);
|
|
index_of_high = iBarShift(Symbol(), PERIOD_CURRENT, find_high_time, false);
|
|
|
|
|
+ Print("time is ----------------------",find_high_time);
|
|
|
ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,index_of_high),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
|
|
ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,index_of_high),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
|
|
|
ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
|
|
ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
|
|
|
ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
|
|
ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
|
|
@@ -847,19 +738,29 @@ void bos2(int i)
|
|
|
{
|
|
{
|
|
|
// Print("found bearish at index ",iTime(Symbol(),PERIOD_CURRENT,m));
|
|
// Print("found bearish at index ",iTime(Symbol(),PERIOD_CURRENT,m));
|
|
|
candle_bearish = true;
|
|
candle_bearish = true;
|
|
|
|
|
+ save_bearish_index = m;
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- find_low = iLow(Symbol(),PERIOD_CURRENT,Store_bos_last_index);
|
|
|
|
|
- for(int j=Store_bos_last_index; j>=i; j--)
|
|
|
|
|
- {
|
|
|
|
|
|
|
|
|
|
- double find_low1 = iLow(Symbol(),PERIOD_CURRENT,j);
|
|
|
|
|
|
|
+ find_low = iLow(Symbol(),PERIOD_CURRENT,save_bearish_index);
|
|
|
|
|
|
|
|
|
|
+ for(int m=save_bearish_index; m>i; m--)
|
|
|
|
|
+ {
|
|
|
|
|
+ double find_low1 = iLow(Symbol(),PERIOD_CURRENT,m);
|
|
|
|
|
+ find_low_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
|
if(find_low > find_low1)
|
|
if(find_low > find_low1)
|
|
|
{
|
|
{
|
|
|
find_low = find_low1;
|
|
find_low = find_low1;
|
|
|
- find_low_time = iTime(Symbol(),PERIOD_CURRENT,j);
|
|
|
|
|
|
|
+ find_low_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ for(int j=Store_bos_last_index; j>=i; j--)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
if(iClose(Symbol(),PERIOD_CURRENT,j) > iClose(Symbol(),PERIOD_CURRENT,i) || iHigh(Symbol(),PERIOD_CURRENT,j) > iHigh(Symbol(),PERIOD_CURRENT,i))
|
|
if(iClose(Symbol(),PERIOD_CURRENT,j) > iClose(Symbol(),PERIOD_CURRENT,i) || iHigh(Symbol(),PERIOD_CURRENT,j) > iHigh(Symbol(),PERIOD_CURRENT,i))
|
|
|
{
|
|
{
|
|
@@ -877,19 +778,24 @@ void bos2(int i)
|
|
|
{
|
|
{
|
|
|
// Print("found bearish at index ",iTime(Symbol(),PERIOD_CURRENT,m));
|
|
// Print("found bearish at index ",iTime(Symbol(),PERIOD_CURRENT,m));
|
|
|
candle_bearish = true;
|
|
candle_bearish = true;
|
|
|
|
|
+ save_bearish_index = m;
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- find_low = iLow(Symbol(),PERIOD_CURRENT,choch_index);
|
|
|
|
|
- for(int j=choch_index; j>=i; j--)
|
|
|
|
|
- {
|
|
|
|
|
- double find_low1 = iLow(Symbol(),PERIOD_CURRENT,j);
|
|
|
|
|
|
|
+ find_low = iLow(Symbol(),PERIOD_CURRENT,save_bearish_index);
|
|
|
|
|
|
|
|
|
|
+ for(int m=save_bearish_index; m>i; m--)
|
|
|
|
|
+ {
|
|
|
|
|
+ double find_low1 = iLow(Symbol(),PERIOD_CURRENT,m);
|
|
|
|
|
+ find_low_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
|
if(find_low > find_low1)
|
|
if(find_low > find_low1)
|
|
|
{
|
|
{
|
|
|
find_low = find_low1;
|
|
find_low = find_low1;
|
|
|
- find_low_time = iTime(Symbol(),PERIOD_CURRENT,j);
|
|
|
|
|
|
|
+ find_low_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ for(int j=choch_index; j>=i; j--)
|
|
|
|
|
+ {
|
|
|
if(iClose(Symbol(),PERIOD_CURRENT,j) > iClose(Symbol(),PERIOD_CURRENT,i) || iHigh(Symbol(),PERIOD_CURRENT,j) > iHigh(Symbol(),PERIOD_CURRENT,i))
|
|
if(iClose(Symbol(),PERIOD_CURRENT,j) > iClose(Symbol(),PERIOD_CURRENT,i) || iHigh(Symbol(),PERIOD_CURRENT,j) > iHigh(Symbol(),PERIOD_CURRENT,i))
|
|
|
{
|
|
{
|
|
|
cnd = false;
|
|
cnd = false;
|
|
@@ -940,7 +846,7 @@ void bos2(int i)
|
|
|
ObjectSetString(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
ObjectSetString(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
|
|
|
|
|
|
store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
- // Print(store_last_bos_index_time);
|
|
|
|
|
|
|
+ // Print(store_last_bos_index_time);
|
|
|
|
|
|
|
|
Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
|
|
|
|
|
@@ -1010,8 +916,8 @@ void third_Condition(int i)
|
|
|
if(high2 > high)
|
|
if(high2 > high)
|
|
|
{
|
|
{
|
|
|
//third_condition_met = true;
|
|
//third_condition_met = true;
|
|
|
- // ObjectCreate(0,"line51"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iHigh(Symbol(),PERIOD_CURRENT,i));
|
|
|
|
|
- // ObjectSetString(0,"line51"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
|
|
|
|
+ // ObjectCreate(0,"line51"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iHigh(Symbol(),PERIOD_CURRENT,i));
|
|
|
|
|
+ // ObjectSetString(0,"line51"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
high = high2;
|
|
high = high2;
|
|
|
|
|
|
|
|
high_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
high_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
@@ -1044,7 +950,7 @@ void third_Condition(int i)
|
|
|
{
|
|
{
|
|
|
//third_condition_met = true;
|
|
//third_condition_met = true;
|
|
|
// ObjectCreate(0,"line6"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iHigh(Symbol(),PERIOD_CURRENT,i));
|
|
// ObjectCreate(0,"line6"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iHigh(Symbol(),PERIOD_CURRENT,i));
|
|
|
- // ObjectSetString(0,"line6"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
|
|
|
|
+ // ObjectSetString(0,"line6"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
|
|
|
|
|
high = high2;
|
|
high = high2;
|
|
|
|
|
|
|
@@ -1067,7 +973,7 @@ void third_Condition(int i)
|
|
|
{
|
|
{
|
|
|
third_condition_met = true;
|
|
third_condition_met = true;
|
|
|
// ObjectCreate(0,"line61"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iLow(Symbol(),PERIOD_CURRENT,i));
|
|
// ObjectCreate(0,"line61"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iLow(Symbol(),PERIOD_CURRENT,i));
|
|
|
- // ObjectSetString(0,"line61"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
|
|
|
|
+ // ObjectSetString(0,"line61"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
|
|
|
|
|
low = low2;
|
|
low = low2;
|
|
|
|
|
|
|
@@ -1195,7 +1101,7 @@ void foo(int value)
|
|
|
od_1[m].choch_index = -1;
|
|
od_1[m].choch_index = -1;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
|
|
|
|
+ // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1210,7 +1116,7 @@ void foo(int value)
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
//Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
//Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
- // Print(TimeCurrent());
|
|
|
|
|
|
|
+ // Print(TimeCurrent());
|
|
|
//
|
|
//
|
|
|
// Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
// Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
od_1[m].choch_index = -1;
|
|
od_1[m].choch_index = -1;
|
|
@@ -1472,26 +1378,28 @@ int OnInit()
|
|
|
|
|
|
|
|
|
|
|
|
|
int idx = 0;
|
|
int idx = 0;
|
|
|
-int user_input_index = iBarShift(Symbol(), PERIOD_CURRENT,inpTime, false);
|
|
|
|
|
-if(ObjectCreate(0,"line",OBJ_VLINE,0,inpTime,iLow(Symbol(),PERIOD_CURRENT,user_input_index)))
|
|
|
|
|
- {
|
|
|
|
|
- Print("vertical line created on chart : ");
|
|
|
|
|
- }
|
|
|
|
|
-else
|
|
|
|
|
- {
|
|
|
|
|
- Print("error in creating line : ");
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
+ int user_input_index = iBarShift(Symbol(), PERIOD_CURRENT,inpTime, false);
|
|
|
|
|
+ if(ObjectCreate(0,"line",OBJ_VLINE,0,inpTime,iLow(Symbol(),PERIOD_CURRENT,user_input_index)))
|
|
|
|
|
+ {
|
|
|
|
|
+ Print("vertical line created on chart : ");
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ Print("error in creating line : ");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+//int user_input_index = iBarShift(Symbol(), PERIOD_CURRENT, D'2022.09.01 15:30:27', false);
|
|
|
|
|
+//if(ObjectCreate(0,"line",OBJ_VLINE,0,D'2022.09.01 15:30:27',iLow(Symbol(),PERIOD_CURRENT,user_input_index)))
|
|
|
|
|
+// {
|
|
|
|
|
+// Print("object created on chart : ");
|
|
|
|
|
+// }
|
|
|
|
|
+//else
|
|
|
|
|
+// {
|
|
|
|
|
+// Print("object not created : ");
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
- //int user_input_index = iBarShift(Symbol(), PERIOD_CURRENT, D'2022.09.01 15:30:27', false);
|
|
|
|
|
- //if(ObjectCreate(0,"line",OBJ_VLINE,0,D'2022.09.01 15:30:27',iLow(Symbol(),PERIOD_CURRENT,user_input_index)))
|
|
|
|
|
- // {
|
|
|
|
|
- // Print("object created on chart : ");
|
|
|
|
|
- // }
|
|
|
|
|
- //else
|
|
|
|
|
- // {
|
|
|
|
|
- // Print("object not created : ");
|
|
|
|
|
- // }
|
|
|
|
|
object_find(object_name);
|
|
object_find(object_name);
|
|
|
if(object_find(object_name) == true)
|
|
if(object_find(object_name) == true)
|
|
|
{
|
|
{
|