TRUE Forex

Просмотр кода форекс индикатора !!! 27-23 Rule.mq4

//+------------------------------------------------------------------+
//|                                               !!! 27-23 Rule.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, Unknown Software Corp."
#property link      "https://www.mql5.com"
#property strict
#property indicator_chart_window

//+----------------------------------

input     double           InitialStop        =  30;             // Initial Stop:
input     double           RefHour            =  8;              // Ref Hour:
input     double           TopPriceBuf        =  27;             // Top Price buf:
input     double           BottomPriceBuf     =  23;             // Bottom Price buf:

input     color            clrRefPrice        =  clrMediumBlue;  // Colors Ref price lines:
input     int              wthRefPrice        =  2;              // Width Ref price lines:
input     ENUM_LINE_STYLE  stlRefPrice        =  STYLE_SOLID;    // Styles Ref price lines:

input     color            clrBuyPrice        =  clrLimeGreen;   // Colors Buy price lines:
input     int              wthBuyPrice        =  3;              // Width Buy price lines:
input     ENUM_LINE_STYLE  stlBuyPrice        =  STYLE_SOLID;    // Styles Buy price lines:

input     color            clrSellPrice       =  clrFireBrick;   // Colors Sell price lines:
input     int              wthSellPrice       =  3;              // Width Sell price lines:
input     ENUM_LINE_STYLE  stlSellPrice       =  STYLE_SOLID;    // Styles Sell price lines:

input     color            clrLongStopPrice   =  clrLime;        // Colors Long Stop price lines:
input     int              wthLongStopPrice   =  1;              // Width Long Stop price lines:
input     ENUM_LINE_STYLE  stlLongStopPrice   =  STYLE_SOLID;    // Styles Long Stop price lines:

input     color            clrShortStopPrice  =  clrRed;         // Colors Short Stop price lines:
input     int              wthShortStopPrice  =  1;              // Width Short Stop price lines:
input     ENUM_LINE_STYLE  stlShortStopPrice  =  STYLE_SOLID;    // Styles Short Stop price lines:

string    IndID                               =  "©";
double    Points;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---- TODO: Add your code here.
   Points = MarketInfo (Symbol(), MODE_POINT); 
//----
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   obj_delete(IndID);
   Comment("");
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//---- TODO: Add your code here.
   RefreshRates();
   int BarsInADay=24*60/Period();
   int n = (int)MathFloor(BarsInADay*0.7);
   double RefPrice, BuyPrice, SellPrice, LongStopPrice, ShortStopPrice, TodaysRefPrice, TodaysBuyPrice, TodaysSellPrice;

   for(int i=0;i<=200;i++)
   {
      if(TimeHour(Time[i])!=RefHour || TimeMinute(Time[i]) !=0) continue;
      
      RefPrice=Open[i];
      BuyPrice=RefPrice+(TopPriceBuf*Points);
      SellPrice=RefPrice-(BottomPriceBuf*Points);
      LongStopPrice=BuyPrice-(InitialStop*Points);
      ShortStopPrice=SellPrice+(InitialStop*Points);
            
      if(TimeDayOfYear(Time[i])==TimeDayOfYear(CurTime()))
      {
         TodaysRefPrice=RefPrice;
         TodaysBuyPrice=BuyPrice;
         TodaysSellPrice=SellPrice;
      }
         
      int x=MathMax(i-n,0);
      string DateString =(string)TimeDay(Time[i])+"/"+(string)TimeMonth(Time[i]);
      datetime TrendLineBeginTime = Time[i];
      datetime TrendLineEndTime = Time[x];

      LinFln(StringConcatenate(DateString," RefPrice"),TrendLineBeginTime,RefPrice,TrendLineEndTime,RefPrice, stlRefPrice,wthRefPrice,clrRefPrice);
      LinFln(StringConcatenate(DateString," BuyPrice"),TrendLineBeginTime,BuyPrice,TrendLineEndTime,BuyPrice, stlBuyPrice,wthBuyPrice,clrBuyPrice);
      LinFln(StringConcatenate(DateString," SellPrice"),TrendLineBeginTime,SellPrice,TrendLineEndTime,SellPrice, stlSellPrice,wthSellPrice,clrSellPrice);
      LinFln(StringConcatenate(DateString," LongStopPrice"),TrendLineBeginTime,LongStopPrice,TrendLineEndTime,LongStopPrice, stlLongStopPrice,wthLongStopPrice,clrLongStopPrice);
      LinFln(StringConcatenate(DateString," ShortStopPrice"),TrendLineBeginTime,ShortStopPrice,TrendLineEndTime,ShortStopPrice, stlShortStopPrice,wthShortStopPrice,clrShortStopPrice);
   }

   Comment( "\n","Today\'s Info:\n\n",
         "RefPrice: ",TodaysRefPrice,"\n",
         "BuyPrice: ",TodaysBuyPrice,"\n",
         "SellPrice: ",TodaysSellPrice,"\n");
//----

   return(0);
  }

//———————————————————————————————————————————————————————————————————————————————————————————————————————————————————|

void LinFln( string main, datetime time, double price, datetime tami, double prace, int style, int width, color colir)
{
             string name = StringConcatenate(IndID, " ® ", main);
   if( ObjectFind ( name ) != -1 )           ObjectDelete( name);
   {
      ObjectCreate( name, OBJ_TREND,0, time, price, tami, prace);
      ObjectSet   ( name, OBJPROP_RAY,                        0);
      ObjectSet   ( name, OBJPROP_BACK,                   false);
      ObjectSet   ( name, OBJPROP_STYLE,                  style);
      ObjectSet   ( name, OBJPROP_WIDTH,                  width);
      ObjectSet   ( name, OBJPROP_COLOR,                  colir);
   }
}

//——————————————————————————————————————————————————————————————|

void obj_delete(string prefix)
{
       int     obj_total = ObjectsTotal(); string name;
   for(int i = obj_total - 1; i >= 0; i--)
   {                name = ObjectName(i) ;
      if(StringFind(name , prefix) == 0) ObjectDelete(name);
   }
}

//————————————————| end of the algorithm |—————————————————|

Комментарии к исходному коду форекс индикатора !!! 27-23 Rule.mq4
В целях безопасности и борьбы со спамом в тексте комментариев запрещено размещать html-теги и ссылки. Благодарим за понимание.

  • X
  • 0% загружено
« индикатор !! [i] Darma_Bollatr.mq4
индикатор !!! Fractal.Arrow.mq4 »