Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.99 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. double Bar_Pips_Loc;
  15. //+------------------------------------------------------------------+
  16. //| Custom indicator initialization function                         |
  17. //+------------------------------------------------------------------+
  18. int OnInit()
  19.   {
  20. //--- indicator buffers mapping
  21.  
  22. //---
  23.    return(INIT_SUCCEEDED);
  24.   }
  25. //+------------------------------------------------------------------+
  26. //| Custom indicator iteration function                              |
  27. //+------------------------------------------------------------------+
  28. int OnCalculate(const int rates_total,
  29.                 const int prev_calculated,
  30.                 const datetime &time[],
  31.                 const double &open[],
  32.                 const double &high[],
  33.                 const double &low[],
  34.                 const double &close[],
  35.                 const long &tick_volume[],
  36.                 const long &volume[],
  37.                 const int &spread[])
  38.   {
  39. //---
  40.    Price_Close = iClose(Symbol(),PERIOD_CURRENT,1);
  41.    Price_Open = iOpen(Symbol(),PERIOD_CURRENT,1);
  42.    double Bar_Pips = (Price_Open + Price_Close)/2;
  43.    string Bar_Pips_S = DoubleToString(Bar_Pips, Digits);
  44.     //= Determine location of the dot which you want to draw ...
  45.    if (Price_Open > Price_Close)
  46.       {
  47.       Bar_Pips_Loc = Price_Close + (Price_Open - Bar_Pips);
  48.       }
  49.       else Bar_Pips_Loc = Price_Open + (Price_Close - Bar_Pips);
  50.   //  string Bar_Pips_Loc_S = DoubleToString (Bar_Pips_Loc, Digits);
  51.    string Bar_Pips_LS = DoubleToString(Bar_Pips_Loc, Digits);
  52.   // Comment(Bar_Pips_Loc);
  53. //  Print (Bar_Pips_S);
  54.  
  55. // LOOK AT THIS CODE BELOW.--------------------------
  56. //ObjectsDeleteAll(); //Delete any old stuff (yes I know we didn't cover this one.)
  57. //string foobar = "This string data is what you are passing in the variable foobar";
  58. //ObjectCreate   ("bar_price_object",  OBJ_LABEL, 0, 0, 0);
  59. //ObjectSet      ("bar_price_object",  OBJPROP_XDISTANCE, Time[1]);
  60. //ObjectSet      ("bar_price_object",  OBJPROP_YDISTANCE, Bar_Pips_Loc);
  61. //ObjectSetText  ("bar_price_object", Bar_Pips_LS, 8, "Arial", clrRed);
  62. //ObjectSetText  ("bar_price_object", CharToStr(159), 8, "Arial", clrRed);
  63. //  SetIndexStyle(3,DRAW_LINE,EMPTY,2,clrRed);
  64.  
  65. string objName = "bar_price_label" + Time[1];
  66. ObjectCreate(objName, OBJ_TEXT, 0, Time[1], Bar_Pips_Loc);
  67. ObjectSetText(objName, CharToStr(159), 14, "Wingdings", Blue);
  68.  
  69. //--- return value of prev_calculated for next call
  70.    
  71.    return(rates_total);
  72.   }
  73. //+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement