Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.09 KB | None | 0 0
  1. //+------------------------------------------------------------------+
  2. //|                                                        Waist.mq4 |
  3. //|                                                            Forex |
  4. //|                                                            Forex |
  5. //+------------------------------------------------------------------+
  6. #property copyright "Forex"
  7. #property link      "Forex"
  8. #property version   "1.00"
  9. #property strict
  10. #property indicator_chart_window
  11.  
  12. double Price_Open = 1;
  13. double Price_Close = 2;
  14. //+------------------------------------------------------------------+
  15. //| Custom indicator initialization function                         |
  16. //+------------------------------------------------------------------+
  17. int OnInit()
  18.   {
  19. //--- indicator buffers mapping
  20.  
  21. //---
  22.    return(INIT_SUCCEEDED);
  23.   }
  24. //+------------------------------------------------------------------+
  25. //| Custom indicator iteration function                              |
  26. //+------------------------------------------------------------------+
  27. int OnCalculate(const int rates_total,
  28.                 const int prev_calculated,
  29.                 const datetime &time[],
  30.                 const double &open[],
  31.                 const double &high[],
  32.                 const double &low[],
  33.                 const double &close[],
  34.                 const long &tick_volume[],
  35.                 const long &volume[],
  36.                 const int &spread[])
  37.   {
  38. //---
  39.    Price_Close = iClose(Symbol(),PERIOD_D1,1);
  40.    Price_Open = iOpen(Symbol(),PERIOD_D1,1);
  41.    double Bar_Pips = (Price_Open + Price_Close)/2;
  42.    string Bar_Pips_S = DoubleToString(Bar_Pips, Digits);
  43.  //  Print (Bar_Pips_S);
  44.    ObjectCreate ("bar_price_object", Bar_Pips_S, 0,0,0);
  45.    ObjectSet("bar_price_object",  OBJPROP_XDISTANCE,1);
  46.    ObjectSet("bar_price_object", OBJPROP_YDISTANCE, 1);  
  47.    ObjectSetText ("bar_price_object", Bar_Pips_S, 8 , "Arial", clrRed);
  48.    
  49. //--- return value of prev_calculated for next call
  50.    
  51.    return(rates_total);
  52.   }
  53. //+------------------------------------------------------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement