Exemplo n.º 1
0
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
    IndicatorBuffers(7);
//---- drawing settings
    SetIndexStyle(0,DRAW_SECTION);
//---- indicator buffers mapping
    SetIndexBuffer(0,MasterIndicator);
    SetIndexBuffer(1,SNN_Indicator);
    SetIndexBuffer(2,ZigzagBuffer);
    SetIndexBuffer(3,HighMapBuffer);
    SetIndexBuffer(4,LowMapBuffer);
    SetIndexBuffer(5,CompraE_S1);
    SetIndexBuffer(6,VentaE_S1);

    SetIndexEmptyValue(0,0.0);
    SetIndexEmptyValue(1,0.0);
    SetIndexEmptyValue(2,0.0);
    SetIndexEmptyValue(5,0.0);
    SetIndexEmptyValue(6,0.0);
//---- indicator short name
    IndicatorShortName("H5PHET - Master Trainer 2 ("+pipsTPSL+","+maxDias+","+numDias+")");
//---- initialization done
   PrimeraVez=0; // Para que se ejecute solo una vez después de la inicialización.


// agregado por H
    // new label object
    ObjectDelete("label_object2");
    if(!ObjectCreate("label_object2", OBJ_LABEL, 0, 0, 0))
    {
        Print("error: cant create label_object! code #",GetLastError());
        return(0);
    }
    ObjectSet("label_object2", OBJPROP_XDISTANCE, 250);
    ObjectSet("label_object2", OBJPROP_YDISTANCE, 0);
    ObjectSetText("label_object2", "H5PHET - Master Trainer 2", 10, "Times New Roman", Green);
    caso1=0;
    caso2=0;
    caso3_1=0;
    caso3_2=0;
    maxMinutos=maxDias*1440;
    return(0);
}
Exemplo n.º 2
0
//-----------------------------------------------------------------------------------------------
int init()
{
   // E Farrell 2013

   IndicatorDigits(10);
   IndicatorShortName("LEVY PHASE (F. Farrell)");

   // Show or Hide a particular line?
   //
   // Use "DRAW_NONE" to hide a line
   // Use "DRAW_LINE" to display a line

   // Line 0:
   // Stochastic Volatility Line
   SetIndexBuffer     (0, vols);
   SetIndexLabel      (0, "Volatility");
   SetIndexDrawBegin  (0, Lookback);
   SetIndexStyle      (0, DRAW_NONE);
   //SetIndexStyle      (0, DRAW_LINE);


   // Line 1:
   // Levy Index of closing price (signal)
   SetIndexBuffer     (1, levy_signal);
   SetIndexLabel      (1, "levy_signal");
   SetIndexDrawBegin  (1, Lookback*2);
   SetIndexStyle      (1, DRAW_NONE);
   //SetIndexStyle      (1, DRAW_LINE);


   // Line 2:
   // Levy Index of Volatility
   SetIndexBuffer     (2, levy_vol);
   SetIndexLabel      (2, "levy_vol");
   SetIndexDrawBegin  (2, Lookback*2);
   SetIndexStyle      (2, DRAW_NONE);
   //SetIndexStyle      (2, DRAW_LINE);


   // Line 3:
   // Wrapped Phase Line
   SetIndexBuffer     (3, phase_wrapped);
   SetIndexLabel      (3, "Phase (wrapped)");
   SetIndexDrawBegin  (3, Lookback*2);
   //SetIndexStyle      (3, DRAW_NONE);
   SetIndexStyle      (3, DRAW_LINE);

   // Line 4:
   // Unwrapped Phase Line
   SetIndexBuffer     (4, phase_unwrapped);
   SetIndexLabel      (4, "Phase (Unwrapped)");
   SetIndexDrawBegin  (4, Lookback*2);
   //SetIndexStyle      (4, DRAW_NONE);
   SetIndexStyle      (4, DRAW_LINE);

  // Line 5:
  // Linear approximation of unwrapped phase
  SetIndexBuffer      (5, least_squares_line);
  SetIndexLabel       (5, "Regression Line");
  SetIndexDrawBegin   (5, Lookback*2);
  //SetIndexStyle       (5, DRAW_NONE);
  SetIndexStyle       (5, DRAW_LINE);

  // Line 6:
  // Final Adjusted Phase Line
  SetIndexBuffer      (6, phase_adjusted);
  SetIndexLabel       (6, "Phase (Adjusted)");
  SetIndexDrawBegin   (6, Lookback*2);
  SetIndexStyle       (6, DRAW_LINE);



   if (DEBUG == 1)
   {
      // Create Debug File to show array values.
      // It is CSV style, with ";" as field seperators.
      //
      // Name:       'Debug File HH-MM.txt'
      // Location:   'c:\<<alpari directory>>\experts\files\'
      //
      file_name  = "DebugFile ";
      file_name  = StringConcatenate (file_name, DoubleToStr(Hour()-2,0), "-");
      file_name  = StringConcatenate (file_name, DoubleToStr(Minute(),0), ".txt");

      file_handle = FileOpen (file_name, FILE_CSV|FILE_WRITE, ";");
      Print (file_name, " was opened.");

      if(file_handle == -1) {
         // File Error occurred
         Alert ("An error while opening the file. Last Error: ", GetLastError());
      }
   }

   return(0);
}