Exemplo n.º 1
0
        //+------------------------------------------------------------------+");
        //| Custom indicator initialization function                         |");
        //| Called by Alveo to initialize the HEMA Indicator at startup.      |");
        //+------------------------------------------------------------------+");
        protected override int Init()
        {
            try
            {
                // ENTER YOUR CODE HERE
                IndicatorBuffers(indicator_buffers);        // Allocates memory for buffers used for custom indicator calculations.
                SetIndexBuffer(0, UpTrend);                 // binds a specified indicator buffer with one-dimensional dynamic array of the type double.
                SetIndexArrow(0, 159);                      // Sets an arrow symbol for indicators line of the DRAW_ARROW type. 159=dot.
                SetIndexBuffer(1, DownTrend);               // repeat for each buffer
                SetIndexArrow(1, 159);
                SetIndexBuffer(2, Consolidation);
                SetIndexArrow(2, 159);

                SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);         // Sets the shape, style, width and color for the indicator line.
                SetIndexLabel(0, "HEMA(" + IndPeriod + ").Bull"); // Sets description for showing in the DataWindow and in the tooltip on Chart.
                SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);         // repeat for all 3 buffers
                SetIndexLabel(1, "HEMA(" + IndPeriod + ").Bear");
                SetIndexStyle(2, DRAW_LINE, STYLE_SOLID);
                SetIndexLabel(2, "HEMA(" + IndPeriod + ").Mixed");

                // Sets the "short" name of a custom indicator to be shown in the DataWindow and in the chart subwindow.
                IndicatorShortName("HEMA Indicator v2.0 (" + IndPeriod + "," + SlopeThreshold + ")");

                hema     = new HEMAobj(IndPeriod, SlopeThreshold);
                thePrice = double.MinValue;

                Print("HEMA: Started. [" + Chart.Symbol + "] period=" + Period());      // Print this message to Alveo Log file on startup
            }
            catch (Exception ex)
            {
                Print("HEMA: Init: Exception: " + ex.Message);
                Print("HEMA: " + ex.StackTrace);
            }
            return(0);   // done
        }
Exemplo n.º 2
0
 internal HSTO(eSTO3 eaIn, int k_period, int d_period, int threshold) : this()
 {
     ea        = eaIn;
     K_period  = k_period;
     D_period  = d_period;
     Threshold = (double)threshold * 1e-7;
     emaLow    = new HEMAobj(k_period);
     emaHigh   = new HEMAobj(k_period);
     emaClose  = new HEMAobj(k_period);
 }
Exemplo n.º 3
0
 internal HSTO()
 {
     emaLow        = null;
     emaHigh       = null;
     emaClose      = null;
     LowestLowQ    = new Queue <double>();
     HighestHighQ  = new Queue <double>();
     K_period      = 0;
     D_period      = 0;
     Threshold     = 0;
     STOdone       = false;
     pctKfalling   = false;
     pctKrising    = false;
     pctDfalling   = false;
     pctDrising    = false;
     smoothedK     = -1;
     smoothedD     = -1;
     prevSmoothedK = 0;
     prevSmoothedD = 0;
 }