Exemplo n.º 1
0
 internal F_TR(FTR eaIn, int FTR_Period, int ALMA_Period) : this()
 {
     ea        = eaIn;
     Threshold = (double)10 * 1e-7;
     FTR_ALMA  = new ALMAobj(ALMA_Period, Threshold);
     FTR       = new FTRobj(FTR_Period);
     //FTRDecycle = new Decycler_obj(FTR_Period, 10, ALMA_Period);
     FTRDecycle = new Decycler_obj(2, 10, ALMA_Period);
 }
Exemplo n.º 2
0
        //+------------------------------------------------------------------+");
        //| Custom indicator initialization function                         |");
        //| Called by Alveo to initialize the ALMA 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);
                SetIndexBuffer(3, Upper);
                SetIndexBuffer(4, Lower);

                SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);                       // Sets the shape, style, width and color for the indicator line.
                SetIndexLabel(0, "T_Channel(" + CutoffPeriod + ").Bull");

                SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);                       // repeat for all 3 buffers
                SetIndexLabel(1, "T_Channel(" + CutoffPeriod + ").Bear");

                SetIndexStyle(2, DRAW_LINE, STYLE_SOLID);
                SetIndexLabel(2, "T_Channel(" + CutoffPeriod + ").Mixed");

                SetIndexStyle(3, DRAW_LINE, STYLE_SOLID);                       // Sets the shape, style, width and color for the indicator line.
                SetIndexLabel(3, "T_Channel(" + CutoffPeriod + ").Upper");

                SetIndexStyle(4, DRAW_LINE, STYLE_SOLID);                       // Sets the shape, style, width and color for the indicator line.
                SetIndexLabel(4, "T_Channel(" + CutoffPeriod + ").Lower");

                // Sets the "short" name of a custom indicator to be shown in the DataWindow and in the chart subwindow.
                IndicatorShortName("T_Channel(" + CutoffPeriod + "," + SlopeThreshold + ")");

                priceDecycle       = new Decycler_obj(IndPeriod, SlopeThreshold, CutoffPeriod);
                priceDecycleSmooth = new SUPERSMOOTHER_3Pole_obj(IndPeriod, SlopeThreshold);
                priceSmooth        = new SUPERSMOOTHER_3Pole_obj(IndPeriod, SlopeThreshold);
                //deviationMean = new SMAobj(CutoffPeriod);
                deviationMean = new ALMAobj((CutoffPeriod * 5), SlopeThreshold);


                Print("T_Channel: Started. [" + Chart.Symbol + "] tf=" + Period());                      // Print this message to Alveo Log file on startup
            }
            catch (Exception ex)
            {
                Print("T_Channel: Init: Exception: " + ex.Message);
                Print("T_Channel: " + ex.StackTrace);
            }
            return(0);              // done
        }