|
|
@@ -155,7 +155,7 @@ void Bos(int i)
|
|
|
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);
|
|
|
+ //Print(store_last_bos_index_time);
|
|
|
|
|
|
Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
|
|
|
|
@@ -309,7 +309,7 @@ void Bos(int i)
|
|
|
Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
|
|
|
|
|
|
|
- Print("last bos index is ",Store_bos_last_index);
|
|
|
+ // Print("last bos index is ",Store_bos_last_index);
|
|
|
|
|
|
//------
|
|
|
low_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
|
|
|
@@ -412,10 +412,10 @@ void Entry_Action_1_down(int Store_bos_last_index, int i,int diff)
|
|
|
|
|
|
}
|
|
|
|
|
|
- Print("condition satisfied : ",check_values_less_than_choch_high(diff,i));
|
|
|
+ Print("condition satisfied in downtrend buy trade : ",check_values_less_than_choch_high(diff,i));
|
|
|
|
|
|
- Print("choch candle open is ",iOpen(Symbol(),PERIOD_CURRENT,i));
|
|
|
- Print("reversal candle open is ",iOpen(Symbol(),PERIOD_CURRENT,ind));
|
|
|
+// Print("choch candle open is ",iOpen(Symbol(),PERIOD_CURRENT,i));
|
|
|
+// Print("reversal candle open is ",iOpen(Symbol(),PERIOD_CURRENT,ind));
|
|
|
|
|
|
if(check_values_less_than_choch_high(diff,i) == true)
|
|
|
{
|
|
|
@@ -472,10 +472,10 @@ void Entry_Action_1_up(int Store_bos_last_index, int i,int diff)
|
|
|
}
|
|
|
//Print("diff is ", diff);
|
|
|
|
|
|
- Print("condition satisfied : ",check_values_less_than_choch_low(diff,i));
|
|
|
+ Print("condition satisfied in uptrend sell trade : ",check_values_less_than_choch_low(diff,i));
|
|
|
|
|
|
- Print("choch candle open is ",iOpen(Symbol(),PERIOD_CURRENT,i));
|
|
|
- Print("reversal candle open is ",iOpen(Symbol(),PERIOD_CURRENT,ind));
|
|
|
+// Print("choch candle open is ",iOpen(Symbol(),PERIOD_CURRENT,i));
|
|
|
+// Print("reversal candle open is ",iOpen(Symbol(),PERIOD_CURRENT,ind));
|
|
|
|
|
|
if(check_values_less_than_choch_low(diff,i) == true)
|
|
|
{
|
|
|
@@ -593,7 +593,7 @@ void choch(int i)
|
|
|
|
|
|
int diff1 = Store_bos_last_index - (i);
|
|
|
|
|
|
- Print("diff between bos and last choch is ",diff1);
|
|
|
+ // Print("diff between bos and last choch is ",diff1);
|
|
|
|
|
|
Entry_Action_1_up(Store_bos_last_index,i,diff1);
|
|
|
|
|
|
@@ -770,8 +770,8 @@ void bos2(int i)
|
|
|
if(cnd == true && candle_bullish == true)
|
|
|
{
|
|
|
|
|
|
- Print("high is --------------",find_high);
|
|
|
- Print("high time is --------------",find_high_time);
|
|
|
+ // Print("high is --------------",find_high);
|
|
|
+ // Print("high time is --------------",find_high_time);
|
|
|
|
|
|
if(object_find("high") > 0)
|
|
|
{
|
|
|
@@ -798,7 +798,7 @@ void bos2(int i)
|
|
|
|
|
|
|
|
|
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,"bos2");
|
|
|
+ ObjectSetString(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
|
|
|
|
|
|
|
store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
@@ -904,8 +904,8 @@ void bos2(int i)
|
|
|
if(cnd == true && candle_bearish == true)
|
|
|
{
|
|
|
|
|
|
- Print("low is --------------",find_low);
|
|
|
- Print("low time is --------------",find_low_time);
|
|
|
+ // Print("low is --------------",find_low);
|
|
|
+ // Print("low time is --------------",find_low_time);
|
|
|
|
|
|
if(object_find("low") > 0)
|
|
|
{
|
|
|
@@ -937,10 +937,10 @@ void bos2(int i)
|
|
|
ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
|
|
|
|
|
|
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,"bos2");
|
|
|
+ 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);
|
|
|
+ // Print(store_last_bos_index_time);
|
|
|
|
|
|
Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
|
|
|
|
@@ -985,8 +985,8 @@ void third_Condition(int i)
|
|
|
if(low2 < low)
|
|
|
{
|
|
|
third_condition_met = true;
|
|
|
- ObjectCreate(0,"line5"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iLow(Symbol(),PERIOD_CURRENT,i));
|
|
|
- ObjectSetString(0,"line5"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
+ // ObjectCreate(0,"line5"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iLow(Symbol(),PERIOD_CURRENT,i));
|
|
|
+ // ObjectSetString(0,"line5"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
low = low2;
|
|
|
|
|
|
low_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
@@ -1010,8 +1010,8 @@ void third_Condition(int i)
|
|
|
if(high2 > high)
|
|
|
{
|
|
|
//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_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
@@ -1043,8 +1043,8 @@ void third_Condition(int i)
|
|
|
if(high2 > high)
|
|
|
{
|
|
|
//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));
|
|
|
- ObjectSetString(0,"line6"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
+ // 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");
|
|
|
|
|
|
high = high2;
|
|
|
|
|
|
@@ -1066,8 +1066,8 @@ void third_Condition(int i)
|
|
|
if(low2 < low)
|
|
|
{
|
|
|
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));
|
|
|
- ObjectSetString(0,"line61"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
+ // 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");
|
|
|
|
|
|
low = low2;
|
|
|
|
|
|
@@ -1136,130 +1136,172 @@ void foo(int value)
|
|
|
|
|
|
|
|
|
|
|
|
- // if(signal == "buy" || signal == "sell")
|
|
|
- // {
|
|
|
- // MqlDateTime edate;
|
|
|
- // time_to_place_trade = 0.0;
|
|
|
- //
|
|
|
- // //print("time of the candle ", time_of_candle);
|
|
|
- //
|
|
|
- // int current_time_frame = Period();
|
|
|
- //
|
|
|
- // string current_time_frame_string;
|
|
|
- //
|
|
|
- // switch(current_time_frame)
|
|
|
- // {
|
|
|
- //
|
|
|
- // case PERIOD_M1:
|
|
|
- // current_time_frame_string = "1 minute";
|
|
|
- // break;
|
|
|
- // case PERIOD_M5:
|
|
|
- // current_time_frame_string = "5 minutes";
|
|
|
- // break;
|
|
|
- // case PERIOD_M15:
|
|
|
- // current_time_frame_string = "15 minutes";
|
|
|
- // break;
|
|
|
- // case PERIOD_M30:
|
|
|
- // current_time_frame_string = "30 minutes";
|
|
|
- // break;
|
|
|
- // case PERIOD_H1:
|
|
|
- // current_time_frame_string = "1 hour";
|
|
|
- //
|
|
|
- //
|
|
|
- // if(TimeToStruct(time_of_candle,edate))
|
|
|
- // {
|
|
|
- // edate.hour = edate.hour + 2;
|
|
|
- // edate.min = 0;
|
|
|
- // edate.sec = 0;
|
|
|
- // }
|
|
|
- //
|
|
|
- //
|
|
|
- // // print("hour of the candle is ",structtotime(edate));
|
|
|
- // time_to_place_trade = StructToTime(edate);
|
|
|
- //
|
|
|
- //
|
|
|
- //
|
|
|
- // // for(int m=0; m < orderNum; m++)
|
|
|
- // // {
|
|
|
- // // if(od_1[m].choch_index != -1)
|
|
|
- // // {
|
|
|
- // // Print(" time to match the condition : ",TimeCurrent());
|
|
|
- // //
|
|
|
- // // if(TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "buy")
|
|
|
- // // {
|
|
|
- // // Print("time to match the condition : ",TimeCurrent());
|
|
|
- // //
|
|
|
- // // //if(ihigh(symbol(),period_current,od_1[m].reversal_index) > ilow(symbol(),period_current,0) && iclose(symbol(),period_current,od_1[m].choch_index) < iclose(symbol(),period_current,0))
|
|
|
- // // {
|
|
|
- // // ObjectCreate(0,"buy trade"+time_to_place_trade,OBJ_ARROW_BUY,0,time_to_place_trade,iHigh(Symbol(),PERIOD_CURRENT,0));
|
|
|
- // // Print("trade placed buy at index ",0);
|
|
|
- // // od_1[m].choch_index = -1;
|
|
|
- // //
|
|
|
- // // }
|
|
|
- // // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
- // //
|
|
|
- // //
|
|
|
- // // }
|
|
|
- // //
|
|
|
- // // if(TimeCurrent() >= od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "sell")
|
|
|
- // // {
|
|
|
- // // Print(TimeCurrent());
|
|
|
- // // //
|
|
|
- // // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
- // // od_1[m].choch_index = -1;
|
|
|
- // //
|
|
|
- // // }
|
|
|
- // // }
|
|
|
- // // }
|
|
|
- //
|
|
|
- //
|
|
|
- //
|
|
|
- // // if(timecurrent() >= time_to_place_trade)
|
|
|
- // // {
|
|
|
- // // print("hi");
|
|
|
- // // if(signal == "buy")
|
|
|
- // // {
|
|
|
- // // int index = ibarshift(symbol(), period_current, time_of_candle, false);
|
|
|
- // // print("index of the 2 hour plus index is ",index);
|
|
|
- // //
|
|
|
- // // print("choch index ", i);
|
|
|
- // // print("reversal index ",ind);
|
|
|
- // // print("value to be check index ",i-3);
|
|
|
- // //
|
|
|
- // // //if(ihigh(symbol(),period_current,ind) > ilow(symbol(),period_current,i-2) && iclose(symbol(),period_current,i) < iclose(symbol(),period_current,i-2))
|
|
|
- // // // {
|
|
|
- // // // objectcreate(0,"buy trade"+time_to_place_trade,obj_arrow_buy,0,time_to_place_trade,ihigh(symbol(),period_current,i-3));
|
|
|
- // // // print("trade placed buy at index ",i-3);
|
|
|
- // // // }
|
|
|
- // // print(time_to_place_trade);
|
|
|
- // //
|
|
|
- // // }
|
|
|
- // // if(signal == "sell")
|
|
|
- // // {
|
|
|
- // // print("trade placed ");
|
|
|
- // // objectcreate(0,"sell trade"+time_to_place_trade,obj_arrow_sell,0,time_to_place_trade,ilow(symbol(),period_current,i-3));
|
|
|
- // //
|
|
|
- // // print(ind);
|
|
|
- // // print(time_to_place_trade);
|
|
|
- // // }
|
|
|
- // // }
|
|
|
- // //else
|
|
|
- // // {
|
|
|
- // // time_of_candle = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
- // // }
|
|
|
- //
|
|
|
- // break;
|
|
|
- //
|
|
|
- // default:
|
|
|
- // current_time_frame_string = "unknown";
|
|
|
- // break;
|
|
|
- // }
|
|
|
- //
|
|
|
- // //print("current timeframe: ", current_time_frame_string);
|
|
|
- //
|
|
|
- //
|
|
|
- // signal = "";
|
|
|
- // }
|
|
|
+ if(signal == "buy" || signal == "sell")
|
|
|
+ {
|
|
|
+ MqlDateTime edate;
|
|
|
+ time_to_place_trade = 0.0;
|
|
|
+
|
|
|
+ //print("time of the candle ", time_of_candle);
|
|
|
+
|
|
|
+ int current_time_frame = Period();
|
|
|
+
|
|
|
+ string current_time_frame_string;
|
|
|
+
|
|
|
+ switch(current_time_frame)
|
|
|
+ {
|
|
|
+
|
|
|
+ case PERIOD_M1:
|
|
|
+ current_time_frame_string = "1 minute";
|
|
|
+ break;
|
|
|
+ case PERIOD_M5:
|
|
|
+ current_time_frame_string = "5 minutes";
|
|
|
+ break;
|
|
|
+ case PERIOD_M15:
|
|
|
+ current_time_frame_string = "15 minutes";
|
|
|
+ break;
|
|
|
+ case PERIOD_M30:
|
|
|
+ current_time_frame_string = "30 minutes";
|
|
|
+ break;
|
|
|
+ case PERIOD_H1:
|
|
|
+ current_time_frame_string = "1 hour";
|
|
|
+
|
|
|
+
|
|
|
+ if(TimeToStruct(time_of_candle,edate))
|
|
|
+ {
|
|
|
+ edate.hour = edate.hour + 2;
|
|
|
+ edate.min = 0;
|
|
|
+ edate.sec = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // print("hour of the candle is ",structtotime(edate));
|
|
|
+ time_to_place_trade = StructToTime(edate);
|
|
|
+ store_value_in_structure(i,ind,signal,time_of_candle,time_to_place_trade);
|
|
|
+
|
|
|
+ for(int m=0; m < orderNum; m++)
|
|
|
+ {
|
|
|
+ if(od_1[m].choch_index != -1)
|
|
|
+ {
|
|
|
+ //Print(" time to match the condition : ",TimeCurrent());
|
|
|
+
|
|
|
+ if(TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "buy")
|
|
|
+ {
|
|
|
+ //Print("time to match the condition : ",TimeCurrent());
|
|
|
+
|
|
|
+ if(iHigh(Symbol(),PERIOD_CURRENT,od_1[m].reversal_index) > iLow(Symbol(),PERIOD_CURRENT,0) && iClose(Symbol(),PERIOD_CURRENT,od_1[m].choch_index) < iClose(Symbol(),PERIOD_CURRENT,0))
|
|
|
+ {
|
|
|
+ ObjectCreate(0,"buy trade"+TimeCurrent(),OBJ_ARROW_BUY,0,TimeCurrent(),iHigh(Symbol(),PERIOD_CURRENT,0));
|
|
|
+ //Print("trade placed buy at index ",0);
|
|
|
+ od_1[m].choch_index = -1;
|
|
|
+
|
|
|
+ }
|
|
|
+ // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if(TimeCurrent() >= od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "sell")
|
|
|
+ {
|
|
|
+ if(iHigh(Symbol(),PERIOD_CURRENT,od_1[m].reversal_index) < iLow(Symbol(),PERIOD_CURRENT,0) && iClose(Symbol(),PERIOD_CURRENT,od_1[m].choch_index) > iClose(Symbol(),PERIOD_CURRENT,0))
|
|
|
+ {
|
|
|
+ ObjectCreate(0,"sell trade"+TimeCurrent(),OBJ_ARROW_BUY,0,TimeCurrent(),iLow(Symbol(),PERIOD_CURRENT,0));
|
|
|
+ //Print("trade placed sell at index ",0);
|
|
|
+ od_1[m].choch_index = -1;
|
|
|
+
|
|
|
+ }
|
|
|
+ //Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
+ // Print(TimeCurrent());
|
|
|
+ //
|
|
|
+ // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
+ od_1[m].choch_index = -1;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // for(int m=0; m < orderNum; m++)
|
|
|
+ // {
|
|
|
+ // if(od_1[m].choch_index != -1)
|
|
|
+ // {
|
|
|
+ // Print(" time to match the condition : ",TimeCurrent());
|
|
|
+ //
|
|
|
+ // if(TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "buy")
|
|
|
+ // {
|
|
|
+ // Print("time to match the condition : ",TimeCurrent());
|
|
|
+ //
|
|
|
+ // //if(ihigh(symbol(),period_current,od_1[m].reversal_index) > ilow(symbol(),period_current,0) && iclose(symbol(),period_current,od_1[m].choch_index) < iclose(symbol(),period_current,0))
|
|
|
+ // {
|
|
|
+ // ObjectCreate(0,"buy trade"+time_to_place_trade,OBJ_ARROW_BUY,0,time_to_place_trade,iHigh(Symbol(),PERIOD_CURRENT,0));
|
|
|
+ // Print("trade placed buy at index ",0);
|
|
|
+ // od_1[m].choch_index = -1;
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // if(TimeCurrent() >= od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "sell")
|
|
|
+ // {
|
|
|
+ // Print(TimeCurrent());
|
|
|
+ // //
|
|
|
+ // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
+ // od_1[m].choch_index = -1;
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // if(timecurrent() >= time_to_place_trade)
|
|
|
+ // {
|
|
|
+ // print("hi");
|
|
|
+ // if(signal == "buy")
|
|
|
+ // {
|
|
|
+ // int index = ibarshift(symbol(), period_current, time_of_candle, false);
|
|
|
+ // print("index of the 2 hour plus index is ",index);
|
|
|
+ //
|
|
|
+ // print("choch index ", i);
|
|
|
+ // print("reversal index ",ind);
|
|
|
+ // print("value to be check index ",i-3);
|
|
|
+ //
|
|
|
+ // //if(ihigh(symbol(),period_current,ind) > ilow(symbol(),period_current,i-2) && iclose(symbol(),period_current,i) < iclose(symbol(),period_current,i-2))
|
|
|
+ // // {
|
|
|
+ // // objectcreate(0,"buy trade"+time_to_place_trade,obj_arrow_buy,0,time_to_place_trade,ihigh(symbol(),period_current,i-3));
|
|
|
+ // // print("trade placed buy at index ",i-3);
|
|
|
+ // // }
|
|
|
+ // print(time_to_place_trade);
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // if(signal == "sell")
|
|
|
+ // {
|
|
|
+ // print("trade placed ");
|
|
|
+ // objectcreate(0,"sell trade"+time_to_place_trade,obj_arrow_sell,0,time_to_place_trade,ilow(symbol(),period_current,i-3));
|
|
|
+ //
|
|
|
+ // print(ind);
|
|
|
+ // print(time_to_place_trade);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //else
|
|
|
+ // {
|
|
|
+ // time_of_candle = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
+ // }
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ current_time_frame_string = "unknown";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ //print("current timeframe: ", current_time_frame_string);
|
|
|
+
|
|
|
+
|
|
|
+ signal = "";
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1430,26 +1472,26 @@ int OnInit()
|
|
|
|
|
|
|
|
|
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, 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,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 : ");
|
|
|
+ // }
|
|
|
object_find(object_name);
|
|
|
if(object_find(object_name) == true)
|
|
|
{
|
|
|
@@ -1561,38 +1603,38 @@ void OnTick()
|
|
|
|
|
|
|
|
|
|
|
|
- for(int m=0; m < orderNum; m++)
|
|
|
- {
|
|
|
- if(od_1[m].choch_index != -1)
|
|
|
- {
|
|
|
- //Print(" time to match the condition : ",TimeCurrent());
|
|
|
-
|
|
|
- if(TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "buy")
|
|
|
- {
|
|
|
- //Print("time to match the condition : ",TimeCurrent());
|
|
|
-
|
|
|
- if(iHigh(Symbol(),PERIOD_CURRENT,od_1[m].reversal_index) > iLow(Symbol(),PERIOD_CURRENT,0) && iClose(Symbol(),PERIOD_CURRENT,od_1[m].choch_index) < iClose(Symbol(),PERIOD_CURRENT,0))
|
|
|
- {
|
|
|
- ObjectCreate(0,"buy trade"+TimeCurrent(),OBJ_ARROW_BUY,0,TimeCurrent(),iHigh(Symbol(),PERIOD_CURRENT,0));
|
|
|
- Print("trade placed buy at index ",0);
|
|
|
- od_1[m].choch_index = -1;
|
|
|
-
|
|
|
- }
|
|
|
- Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if(TimeCurrent() >= od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "sell")
|
|
|
- {
|
|
|
- Print(TimeCurrent());
|
|
|
- //
|
|
|
- // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
- od_1[m].choch_index = -1;
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// for(int m=0; m < orderNum; m++)
|
|
|
+// {
|
|
|
+// if(od_1[m].choch_index != -1)
|
|
|
+// {
|
|
|
+// //Print(" time to match the condition : ",TimeCurrent());
|
|
|
+//
|
|
|
+// if(TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "buy")
|
|
|
+// {
|
|
|
+// //Print("time to match the condition : ",TimeCurrent());
|
|
|
+//
|
|
|
+// if(iHigh(Symbol(),PERIOD_CURRENT,od_1[m].reversal_index) > iLow(Symbol(),PERIOD_CURRENT,0) && iClose(Symbol(),PERIOD_CURRENT,od_1[m].choch_index) < iClose(Symbol(),PERIOD_CURRENT,0))
|
|
|
+// {
|
|
|
+// ObjectCreate(0,"buy trade"+TimeCurrent(),OBJ_ARROW_BUY,0,TimeCurrent(),iHigh(Symbol(),PERIOD_CURRENT,0));
|
|
|
+// Print("trade placed buy at index ",0);
|
|
|
+// od_1[m].choch_index = -1;
|
|
|
+//
|
|
|
+// }
|
|
|
+// Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(TimeCurrent() >= od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "sell")
|
|
|
+// {
|
|
|
+// Print(TimeCurrent());
|
|
|
+// //
|
|
|
+// // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
+// od_1[m].choch_index = -1;
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
}
|
|
|
|