|
@@ -603,7 +603,7 @@ void choch(int i)
|
|
|
// -----------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
int chock_index = iBarShift(Symbol(), PERIOD_CURRENT, choch_index_time, false);
|
|
int chock_index = iBarShift(Symbol(), PERIOD_CURRENT, choch_index_time, false);
|
|
|
chock_index++;
|
|
chock_index++;
|
|
|
- datetime ti = iTime(Symbol(),PERIOD_CURRENT,chock_index);
|
|
|
|
|
|
|
+ datetime lastChochTimeUp = iTime(Symbol(),PERIOD_CURRENT,chock_index);
|
|
|
|
|
|
|
|
HIGH = iHigh(Symbol(),PERIOD_CURRENT,chock_index); // save high and low of the chock prev index to compare
|
|
HIGH = iHigh(Symbol(),PERIOD_CURRENT,chock_index); // save high and low of the chock prev index to compare
|
|
|
LOW = iLow(Symbol(),PERIOD_CURRENT,chock_index);
|
|
LOW = iLow(Symbol(),PERIOD_CURRENT,chock_index);
|
|
@@ -646,7 +646,7 @@ void choch(int i)
|
|
|
Print("from where you end ",chock_index1);
|
|
Print("from where you end ",chock_index1);
|
|
|
|
|
|
|
|
bool condition_not_match = false;
|
|
bool condition_not_match = false;
|
|
|
- for(int p=chock_index - 2 ; p >=chock_index1; p--)
|
|
|
|
|
|
|
+ for(int p=chock_index - 2 ; p > chock_index1; p--)
|
|
|
{
|
|
{
|
|
|
if(iLow(Symbol(),PERIOD_CURRENT,p) < HIGH)
|
|
if(iLow(Symbol(),PERIOD_CURRENT,p) < HIGH)
|
|
|
{
|
|
{
|
|
@@ -675,7 +675,7 @@ void choch(int i)
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- tp_date_time_sell = ti;
|
|
|
|
|
|
|
+ tp_date_time_sell = lastChochTimeUp;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
@@ -1035,6 +1035,9 @@ void choch(int i)
|
|
|
Print("from where you end ",chock_index1);
|
|
Print("from where you end ",chock_index1);
|
|
|
|
|
|
|
|
bool condition_not_match = false;
|
|
bool condition_not_match = false;
|
|
|
|
|
+ Print("time of chock_index - 2 is", iTime(Symbol(),PERIOD_CURRENT,chock_index-2));
|
|
|
|
|
+ Print("time of current candle is ",iTime(Symbol(),PERIOD_CURRENT,1));
|
|
|
|
|
+
|
|
|
for(int p=chock_index - 2 ; p > chock_index1; p--)
|
|
for(int p=chock_index - 2 ; p > chock_index1; p--)
|
|
|
{
|
|
{
|
|
|
// Print("index is ",p," time is ", iTime(Symbol(),PERIOD_CURRENT,p));
|
|
// Print("index is ",p," time is ", iTime(Symbol(),PERIOD_CURRENT,p));
|
|
@@ -2029,7 +2032,14 @@ int OnInit()
|
|
|
ObjectCreate(0,"low",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,user_input_index),low,iTime(Symbol(),PERIOD_CURRENT,0),low);
|
|
ObjectCreate(0,"low",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,user_input_index),low,iTime(Symbol(),PERIOD_CURRENT,0),low);
|
|
|
ObjectSetInteger(0,"low",OBJPROP_RAY_RIGHT,true);
|
|
ObjectSetInteger(0,"low",OBJPROP_RAY_RIGHT,true);
|
|
|
ObjectSetInteger(0,"low",OBJPROP_COLOR,clrRed);
|
|
ObjectSetInteger(0,"low",OBJPROP_COLOR,clrRed);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ choch_index_time = iTime(Symbol(),PERIOD_CURRENT,user_input_index);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
Entry_strategy(user_input_index);
|
|
Entry_strategy(user_input_index);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -2089,9 +2099,74 @@ void OnDeinit(const int reason)
|
|
|
//+------------------------------------------------------------------+
|
|
//+------------------------------------------------------------------+
|
|
|
void OnTick()
|
|
void OnTick()
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
if(NewBar() == true)
|
|
if(NewBar() == true)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
|
|
+ int dx = iBarShift(Symbol(), PERIOD_CURRENT,choch_index_time, false);
|
|
|
|
|
+//
|
|
|
|
|
+// double HI = iHigh(Symbol(),PERIOD_CURRENT,dx+1); // save high and low of the chock prev index to compare
|
|
|
|
|
+// double LO = iLow(Symbol(),PERIOD_CURRENT,dx+1);
|
|
|
|
|
+// if(trend == "downtrend")
|
|
|
|
|
+// {
|
|
|
|
|
+// for(int p=dx-1; p >= 1; p--)
|
|
|
|
|
+// {
|
|
|
|
|
+// if(iHigh(Symbol(),PERIOD_CURRENT,p) > LO)
|
|
|
|
|
+// {
|
|
|
|
|
+// tp_date_time_sell = 0.0;
|
|
|
|
|
+// Print("high is ",iHigh(Symbol(),PERIOD_CURRENT,p), "and index of high is ",p);
|
|
|
|
|
+// Print("TArget line deleted in on tick "," at index p", " and time period is ",iTime(Symbol(),PERIOD_CURRENT,p));
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// if(object_find("target line") > 0)
|
|
|
|
|
+// {
|
|
|
|
|
+// ObjectDelete(0,"target line");
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// if(object_find("target line1") > 0)
|
|
|
|
|
+// {
|
|
|
|
|
+// ObjectDelete(0,"target line1");
|
|
|
|
|
+// }
|
|
|
|
|
+// break;
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// if(trend == "uptrend")
|
|
|
|
|
+// {
|
|
|
|
|
+// for(int p=dx-1; p >= 1; p--)
|
|
|
|
|
+// {
|
|
|
|
|
+// if(iLow(Symbol(),PERIOD_CURRENT,p) < HI)
|
|
|
|
|
+// {
|
|
|
|
|
+// Print("low is ",LO, "and index of low is ",p);
|
|
|
|
|
+// Print("Target line deleted in on tick "," at index p", " and time period is ",iTime(Symbol(),PERIOD_CURRENT,p));
|
|
|
|
|
+//
|
|
|
|
|
+// tp_date_time_buy = 0.0;
|
|
|
|
|
+//
|
|
|
|
|
+// if(object_find("target line") > 0)
|
|
|
|
|
+// {
|
|
|
|
|
+// ObjectDelete(0,"target line");
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// if(object_find("target line1") > 0)
|
|
|
|
|
+// {
|
|
|
|
|
+// ObjectDelete(0,"target line1");
|
|
|
|
|
+// }
|
|
|
|
|
+// break;
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
Entry_strategy(1);
|
|
Entry_strategy(1);
|
|
|
|
|
|
|
|
// for entry condition candel 1
|
|
// for entry condition candel 1
|
|
@@ -2165,6 +2240,35 @@ void OnTick()
|
|
|
|
|
|
|
|
if(od_1[m].EntryCon == 2 && TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "buy" && od_1[m].Time_of_candle_For_trade != 0 /*&& HIGH != 0 && LOW != 0*/)
|
|
if(od_1[m].EntryCon == 2 && TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "buy" && od_1[m].Time_of_candle_For_trade != 0 /*&& HIGH != 0 && LOW != 0*/)
|
|
|
{
|
|
{
|
|
|
|
|
+ if(trend == "uptrend")
|
|
|
|
|
+ {
|
|
|
|
|
+ for(int p=dx-1; p >= 1; p--)
|
|
|
|
|
+ {
|
|
|
|
|
+ double ib =iBarShift(Symbol(), PERIOD_CURRENT,tp_date_time_buy,false);
|
|
|
|
|
+ Print("low of the last choch index is",iLow(Symbol(),PERIOD_CURRENT,ib));
|
|
|
|
|
+ if(iHigh(Symbol(),PERIOD_CURRENT,p) > iLow(Symbol(),PERIOD_CURRENT,ib))
|
|
|
|
|
+ {
|
|
|
|
|
+ tp_date_time_buy = 0.0;
|
|
|
|
|
+ Print("high is ",iHigh(Symbol(),PERIOD_CURRENT,p)," last choch+1: ",iLow(Symbol(),PERIOD_CURRENT,ib));
|
|
|
|
|
+ Print("TArget line deleted in on entry 2 "," at index p", " and time period is ",iTime(Symbol(),PERIOD_CURRENT,p));
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if(object_find("target line") > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ ObjectDelete(0,"target line");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(object_find("target line1") > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ ObjectDelete(0,"target line1");
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// Print("time is greater and signal is buy ",TimeCurrent());
|
|
// Print("time is greater and signal is buy ",TimeCurrent());
|
|
|
// Print("i am in enrtry condition 1 : ");
|
|
// Print("i am in enrtry condition 1 : ");
|
|
|
|
|
|
|
@@ -2198,6 +2302,36 @@ void OnTick()
|
|
|
if(od_1[m].EntryCon == 2 && TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "sell" && od_1[m].Time_of_candle_For_trade != 0 /*&& HIGH != 0 && LOW != 0*/)
|
|
if(od_1[m].EntryCon == 2 && TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "sell" && od_1[m].Time_of_candle_For_trade != 0 /*&& HIGH != 0 && LOW != 0*/)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
|
|
+ if(trend == "downtrend")
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ for(int p=dx-1; p >= 1; p--)
|
|
|
|
|
+ {
|
|
|
|
|
+ double ib =iBarShift(Symbol(), PERIOD_CURRENT,tp_date_time_buy,false);
|
|
|
|
|
+ Print("high of the last choch index is",iHigh(Symbol(),PERIOD_CURRENT,ib));
|
|
|
|
|
+ if(iLow(Symbol(),PERIOD_CURRENT,p) < iHigh(Symbol(),PERIOD_CURRENT,ib))
|
|
|
|
|
+ {
|
|
|
|
|
+ // Print("low is ",LO, "and index of low is ",p);
|
|
|
|
|
+ Print("Target line deleted in on entry 2 "," at index p", " and time period is ",iTime(Symbol(),PERIOD_CURRENT,p));
|
|
|
|
|
+
|
|
|
|
|
+ tp_date_time_sell = 0.0;
|
|
|
|
|
+
|
|
|
|
|
+ if(object_find("target line") > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ ObjectDelete(0,"target line");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(object_find("target line1") > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ ObjectDelete(0,"target line1");
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
int reversal_indexx = iBarShift(Symbol(), PERIOD_CURRENT,od_1[m].reversal_index_date_time,false);
|
|
int reversal_indexx = iBarShift(Symbol(), PERIOD_CURRENT,od_1[m].reversal_index_date_time,false);
|
|
|
int close_index = iBarShift(Symbol(), PERIOD_CURRENT,od_1[m].choch_index_date_time,false);
|
|
int close_index = iBarShift(Symbol(), PERIOD_CURRENT,od_1[m].choch_index_date_time,false);
|
|
|
|
|
|