Forráskód Böngészése

Ticket 1463, 1476

Ticket 1463 Completed
Ticket 1476 in progress
AhtashamShahzad3 2 éve
szülő
commit
fe697881c3
2 módosított fájl, 82 hozzáadás és 14 törlés
  1. BIN
      MK_BOS_CHOCH.ex5
  2. 82 14
      MK_BOS_CHOCH.mq5

BIN
MK_BOS_CHOCH.ex5


+ 82 - 14
MK_BOS_CHOCH.mq5

@@ -14,7 +14,14 @@ string trend;
 bool bearish_found = false;
 bool bullish_found = false;
 
+int index_of_last_high = 0;
+int index_of_last_low = 0;
+
+double hi;
+double lo;
+
 int index_of_low = 0;
+int index_of_high = 0;
 int high_index=0;
 double high,low,low1,high1;
 //+------------------------------------------------------------------+
@@ -42,22 +49,20 @@ void foo(int index)
          if(trend == "uptrend")
            {
 
-
-
-
             high1 = iHigh(Symbol(),PERIOD_CURRENT,i);
 
             //double low1  = iLow(Symbol(),PERIOD_CURRENT,i);
 
             if(high1 > high)
               {
+
                high = high1;
 
                //  Print("high break at index value",i);
                // Print("index is ",index);
 
                int count = (index-1) - i;
-               Print("count is ", count);
+               Print("index  is  : : ", i);
 
                // Print("index updated ",index);
 
@@ -96,8 +101,9 @@ void foo(int index)
                  }
 
                Print(" high price is ", high);
+
                Print("low price is ", low);
-               Print("index of low is ", index_of_low);
+               Print("index of last updated low is ", index_of_low);
 
                for(int l=index_of_low; l > 0; l--)
                  {
@@ -108,17 +114,24 @@ void foo(int index)
                     {
                      double price_low = iLow(Symbol(),PERIOD_CURRENT,l+1);
                      double time = iTime(Symbol(),PERIOD_CURRENT,l+1);
-                     double time1 = iTime(Symbol(),PERIOD_CURRENT,l+1);
+                     double time1 = iTime(Symbol(),PERIOD_CURRENT,l-1);
                      ObjectCreate(0,"tline1",OBJ_TREND,0,time,price_low,time1,price_low);
                      trend = "downtrend";
                      Print("choch");
-
+                     index_of_last_high = i;
                      Print("close", close);
                      break;
 
                     }
 
                  }
+               Print("index of last updated high is : ",index_of_last_high);
+               hi = iHigh(Symbol(),PERIOD_CURRENT,index_of_last_high+1);
+               lo = iLow(Symbol(),PERIOD_CURRENT,index_of_last_high+1);
+
+               Print("hy",hi, "index is : ",index_of_last_high+1);
+               Print("ho",lo);
+
                index = i;
 
               }
@@ -188,7 +201,7 @@ void foo(int index)
                        {
                         //Print("here");
                         high = high1;
-                        index_of_low = index - k;
+                        index_of_high = index - k;
                         Print("high is updated at index : ",index - k);
 
                        }
@@ -199,9 +212,9 @@ void foo(int index)
 
                Print(" high price is ", high);
                Print("low price is ", low);
-               Print("index of low is ", index_of_low);
+               Print("index of last updated high is ", index_of_high);
 
-               for(int l=index_of_low; l > 0; l--)
+               for(int l=index_of_high; l > 0; l--)
                  {
                   // print("hi");
                   double close = iClose(Symbol(),PERIOD_CURRENT,l);
@@ -210,19 +223,23 @@ void foo(int index)
 
                      double price_high = iLow(Symbol(),PERIOD_CURRENT,l+1);
                      double time = iTime(Symbol(),PERIOD_CURRENT,l+1);
-                     double time1 = iTime(Symbol(),PERIOD_CURRENT,l+1);
-                     ObjectCreate(0,"tline2",OBJ_TREND,0,time,price_high,time1,price_high);
+                     double time1 = iTime(Symbol(),PERIOD_CURRENT,l-1);
+                     bool a = ObjectCreate(0,"tline2",OBJ_TREND,0,time,price_high,time1,price_high);
+                     Print("object created : ", a);
 
                      trend = "uptrend";
                      Print("choch");
                      Print(l);
-
+                     index_of_last_low = i;
                      Print("close", close);
                      break;
 
                     }
 
                  }
+               hi = iHigh(Symbol(),PERIOD_CURRENT,index_of_last_low+1);
+               lo = iLow(Symbol(),PERIOD_CURRENT,index_of_last_low+1);
+
                index = i;
 
               }
@@ -240,7 +257,7 @@ void foo(int index)
 int OnInit()
   {
 
-   ObjectCreate(0,"line",OBJ_VLINE,0,D'2023.07.01 10:00:27',0);
+//ObjectCreate(0,"line",OBJ_VLINE,0,D'2023.07.01 10:00:27',0);
    object_find(object_name);
 //Print(ObjectFind(0,"line"));  // to find the object drawn on the chart
 
@@ -252,6 +269,7 @@ int OnInit()
       Print("line time: ",time_of_candle);
       int index = iBarShift(Symbol(), PERIOD_CURRENT, time_of_candle, false);
       Print(index);
+      Print(index);
 
       //      datetime time_of_candle = (datetime)ObjectGetInteger(0,"line",OBJPROP_TIME,0);
       //      Print("time is " , time_of_candle);
@@ -347,3 +365,53 @@ string checkCandle(int i)  // to check the candle is bullish or bearish
 //+------------------------------------------------------------------+
 
 //+------------------------------------------------------------------+
+
+
+
+
+
+
+/////////////////////////////////////
+//void third condition()
+//  {
+//   if(checkCandle(index) == "Bearish")
+//     {
+//
+//      trend = "downtrend";
+//
+//      // double high,low = 0.0;
+//
+//      // to store high and low of the value after the object
+//      low = iLow(Symbol(),PERIOD_CURRENT,index);
+//
+//      //low =  iLow(Symbol(),PERIOD_CURRENT,index-1);
+//
+//      if(trend == "downtrend")
+//        {
+//
+//         low1 = iLow(Symbol(),PERIOD_CURRENT,i);
+//
+//
+//         if(low1 < low)
+//           {
+//            low = low1;
+//            for(int l=i; l > 0; l--)
+//              {
+//               // print("hi");
+//               double high2 = iHigh(Symbol(),PERIOD_CURRENT,l);
+//               if(high2 > high)
+//                 {
+//
+//                  high = high2;
+//
+//                 }
+//
+//              }
+//           }
+//
+//        }
+//      //
+//     }
+//
+//  }
+//+------------------------------------------------------------------+