• 概述
  • 评论
  • 评论 (2)

StatisticalTrends

This indicator shows the strength of bulls and bears. It is based on statistical calculations that indicate the trend at a moment of time.

It can be used for short trends (ideal for scalpers) and long trends (for trend followers), depending on the parameters you set.

It has two parameters:

  • MAPeriod - Period for calculating the moving average (recommended values are 5 to 20, but you can optimize);
  • AnalisedBars - Number of bars for calculating the trend (recommended values are 50 to 200, but you can optimize).

Basic EA sample that uses this indicator:

//+------------------------------------------------------------------+
//|                                    StatisticalTrendsEASample.mq5 |
//|                       Copyright 2013, E-Tech Tecnologia SC Ltda. |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, E-Tech Tecnologia SC Ltda."
#property version   "1.00"

extern int MAPeriod = 10;
extern int AnalisedBars = 100;

extern int Limit = 70;

int ST_handle;
double SellForceBuffer[];
double BuyForceBuffer[];

void OnInit()
{
   ST_handle = iCustom(NULL,0,"StatisticalTrends",
                     MAPeriod,
                     AnalisedBars,
                     PRICE_CLOSE 
                     );
}

void OnTick()
{
   int sellCopied = CopyBuffer(ST_handle,0,0,1,SellForceBuffer);
   if(sellCopied > 0 && SellForceBuffer[0] >= Limit)
      Print("Opening a buy order...");
   int buyCopied = CopyBuffer(ST_handle,1,0,1,BuyForceBuffer);
   if(buyCopied > 0 && BuyForceBuffer[0] >= Limit)
      Print("Opening a sell order...");
}
无评论