Sabato, Dicembre 16, 2017
   
Text Size

Forex EA.

Forex Expert.

Forex Expert.

Forex Expert

Opzioni Forex.

Esempio di aspetto di una sezione blog (sezione FAQ)

Indicatore Metatrader - Slope Direction Line

//+------------------------------------------------------------------+ 
//| HMA.mq4 
//| Copyright © 2006 WizardSerg <
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 >, ?? ??????? ForexMagazine #104 
//| 
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
  
//| Revised by IgorAD,
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
  |   
//| Personalized by iGoR AKA FXiGoR for the Trend Slope Trading method (T_S_T) 
//| Link: 
//| contact: 
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
                                                                          
//+------------------------------------------------------------------+
#property copyright "MT4 release WizardSerg <
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 >, ?? ??????? ForexMagazine #104" 
#property link      "
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 " 

#property indicator_chart_window 
#property indicator_buffers 2 
#property indicator_color1 LightBlue 
#property indicator_color2 Tomato 
//---- input parameters 
extern int       period=80; 
extern int       method=3;                         // MODE_SMA 
extern int       price=0;                          // PRICE_CLOSE 
//---- buffers 
double Uptrend[];
double Dntrend[];
double ExtMapBuffer[]; 


//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int init() 
{ 
    IndicatorBuffers(3);  
    SetIndexBuffer(0, Uptrend); 
    //ArraySetAsSeries(Uptrend, true); 
    SetIndexBuffer(1, Dntrend); 
    //ArraySetAsSeries(Dntrend, true); 
    SetIndexBuffer(2, ExtMapBuffer); 
    ArraySetAsSeries(ExtMapBuffer, true); 
    
    SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
    SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
    
    IndicatorShortName("Slope Direction Line("+period+")"); 
    return(0); 
} 

//+------------------------------------------------------------------+ 
//| Custor indicator deinitialization function                       | 
//+------------------------------------------------------------------+ 
int deinit() 
{ 
    // ???? ????? ?????? ?????? 
    return(0); 
} 

//+------------------------------------------------------------------+ 
//| ?????????? ???????                                               | 
//+------------------------------------------------------------------+ 
double WMA(int x, int p) 
{ 
    return(iMA(NULL, 0, p, 0, method, price, x));    
} 

//+------------------------------------------------------------------+ 
//| Custom indicator iteration function                              | 
//+------------------------------------------------------------------+ 
int start() 
{ 
    int counted_bars = IndicatorCounted(); 
    
    if(counted_bars < 0) 
        return(-1); 
                  
    int x = 0; 
    int p = MathSqrt(period);              
    int e = Bars - counted_bars + period + 1; 
    
    double vect[], trend[]; 
    
    if(e > Bars) 
        e = Bars;    

    ArrayResize(vect, e); 
    ArraySetAsSeries(vect, true);
    ArrayResize(trend, e); 
    ArraySetAsSeries(trend, true); 
    
    for(x = 0; x < e; x++) 
    { 
        vect[x] = 2*WMA(x, period/2) - WMA(x, period);        
 //       Print("Bar date/time: ", TimeToStr(Time[x]), " close: ", Close[x], " vect[", x, "] = ", vect[x], " 2*WMA(p/2) = ", 2*WMA(x, period/2), " WMA(p) = ",  WMA(x, period)); 
    } 

    for(x = 0; x < e-period; x++)
     
        ExtMapBuffer[x] = iMAOnArray(vect, 0, p, 0, method, x);        
    
    for(x = e-period; x >= 0; x--)
    {     
        trend[x] = trend[x+1];
        if (ExtMapBuffer[x]> ExtMapBuffer[x+1]) trend[x] =1;
        if (ExtMapBuffer[x]< ExtMapBuffer[x+1]) trend[x] =-1;
    
    if (trend[x]>0)
    { Uptrend[x] = ExtMapBuffer[x]; 
      if (trend[x+1]<0) Uptrend[x+1]=ExtMapBuffer[x+1];
      Dntrend[x] = EMPTY_VALUE;
    }
    else              
    if (trend[x]<0)
    { 
      Dntrend[x] = ExtMapBuffer[x]; 
      if (trend[x+1]>0) Dntrend[x+1]=ExtMapBuffer[x+1];
      Uptrend[x] = EMPTY_VALUE;
    }              
    
    //Print( " trend=",trend[x]);
    }
    
    return(0); 
} 
//+------------------------------------------------------------------+ 
 

Indicatore Metatrader - Signal Line

//+------------------------------------------------------------------+ 
//| HMA.mq4 
//| Copyright © 2006 WizardSerg <
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 >, ?? ??????? ForexMagazine #104 
//| 
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
  
//| Revised by IgorAD,
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
  |   
//| Personalized by iGoR AKA FXiGoR for the Trend Slope Trading method (T_S_T)
//| Link: 
//| contact: 
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
                                                                       
//+------------------------------------------------------------------+
#property copyright "MT4 release WizardSerg <
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 >, ?? ??????? ForexMagazine #104" 
#property link      "
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 " 

#property indicator_chart_window 
#property indicator_buffers 2 
#property indicator_color1 Lime 
#property indicator_color2 Red 
//---- input parameters 
extern int       period=15; 
extern int       method=3;                         // MODE_SMA 
extern int       price=0;                          // PRICE_CLOSE 
//---- buffers 
double Uptrend[];
double Dntrend[];
double ExtMapBuffer[]; 


//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int init() 
{ 
    IndicatorBuffers(3);  
    SetIndexBuffer(0, Uptrend); 
    //ArraySetAsSeries(Uptrend, true); 
    SetIndexBuffer(1, Dntrend); 
    //ArraySetAsSeries(Dntrend, true); 
    SetIndexBuffer(2, ExtMapBuffer); 
    ArraySetAsSeries(ExtMapBuffer, true); 
    
    SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
    SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
    
    IndicatorShortName("Signal Line("+period+")"); 
    return(0); 
} 

//+------------------------------------------------------------------+ 
//| Custor indicator deinitialization function                       | 
//+------------------------------------------------------------------+ 
int deinit() 
{ 
    // ???? ????? ?????? ?????? 
    return(0); 
} 

//+------------------------------------------------------------------+ 
//| ?????????? ???????                                               | 
//+------------------------------------------------------------------+ 
double WMA(int x, int p) 
{ 
    return(iMA(NULL, 0, p, 0, method, price, x));    
} 

//+------------------------------------------------------------------+ 
//| Custom indicator iteration function                              | 
//+------------------------------------------------------------------+ 
int start() 
{ 
    int counted_bars = IndicatorCounted(); 
    
    if(counted_bars < 0) 
        return(-1); 
                  
    int x = 0; 
    int p = MathSqrt(period);              
    int e = Bars - counted_bars + period + 1; 
    
    double vect[], trend[]; 
    
    if(e > Bars) 
        e = Bars;    

    ArrayResize(vect, e); 
    ArraySetAsSeries(vect, true);
    ArrayResize(trend, e); 
    ArraySetAsSeries(trend, true); 
    
    for(x = 0; x < e; x++) 
    { 
        vect[x] = 2*WMA(x, period/2) - WMA(x, period);        
 //       Print("Bar date/time: ", TimeToStr(Time[x]), " close: ", Close[x], " vect[", x, "] = ", vect[x], " 2*WMA(p/2) = ", 2*WMA(x, period/2), " WMA(p) = ",  WMA(x, period)); 
    } 

    for(x = 0; x < e-period; x++)
     
        ExtMapBuffer[x] = iMAOnArray(vect, 0, p, 0, method, x);        
    
    for(x = e-period; x >= 0; x--)
    {     
        trend[x] = trend[x+1];
        if (ExtMapBuffer[x]> ExtMapBuffer[x+1]) trend[x] =1;
        if (ExtMapBuffer[x]< ExtMapBuffer[x+1]) trend[x] =-1;
    
    if (trend[x]>0)
    { Uptrend[x] = ExtMapBuffer[x]; 
      if (trend[x+1]<0) Uptrend[x+1]=ExtMapBuffer[x+1];
      Dntrend[x] = EMPTY_VALUE;
    }
    else              
    if (trend[x]<0)
    { 
      Dntrend[x] = ExtMapBuffer[x]; 
      if (trend[x+1]>0) Dntrend[x+1]=ExtMapBuffer[x+1];
      Uptrend[x] = EMPTY_VALUE;
    }              
    
    //Print( " trend=",trend[x]);
    }
    
    return(0); 
} 
//+------------------------------------------------------------------+ 
 

Indicatore Metatrader - Execute Line

//+------------------------------------------------------------------+ 
//| HMA.mq4 
//| Copyright © 2006 WizardSerg <
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 >, ?? ??????? ForexMagazine #104 
//| 
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
  
//| Revised by IgorAD,
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
  |   
//| 
//| Personalized by iGoR AKA FXiGoR for the Trend Slope Trading method (T_S_T) 
//| Link: 
//| contact: 
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
                            
//+------------------------------------------------------------------+
#property copyright "MT4 release WizardSerg <
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 >, ?? ??????? ForexMagazine #104" 
#property link      "
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 " 

#property indicator_chart_window 
#property indicator_buffers 2 
#property indicator_color1 Yellow 
#property indicator_color2 Magenta 
//---- input parameters 
extern int       period=5; 
extern int       method=3;                         // MODE_SMA 
extern int       price=0;                          // PRICE_CLOSE 
//---- buffers 
double Uptrend[];
double Dntrend[];
double ExtMapBuffer[]; 


//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int init() 
{ 
    IndicatorBuffers(3);  
    SetIndexBuffer(0, Uptrend); 
    //ArraySetAsSeries(Uptrend, true); 
    SetIndexBuffer(1, Dntrend); 
    //ArraySetAsSeries(Dntrend, true); 
    SetIndexBuffer(2, ExtMapBuffer); 
    ArraySetAsSeries(ExtMapBuffer, true); 
    
    SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
    SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
    
    IndicatorShortName("Execute Line("+period+")"); 
    return(0); 
} 

//+------------------------------------------------------------------+ 
//| Custor indicator deinitialization function                       | 
//+------------------------------------------------------------------+ 
int deinit() 
{ 
    // ???? ????? ?????? ?????? 
    return(0); 
} 

//+------------------------------------------------------------------+ 
//| ?????????? ???????                                               | 
//+------------------------------------------------------------------+ 
double WMA(int x, int p) 
{ 
    return(iMA(NULL, 0, p, 0, method, price, x));    
} 

//+------------------------------------------------------------------+ 
//| Custom indicator iteration function                              | 
//+------------------------------------------------------------------+ 
int start() 
{ 
    int counted_bars = IndicatorCounted(); 
    
    if(counted_bars < 0) 
        return(-1); 
                  
    int x = 0; 
    int p = MathSqrt(period);              
    int e = Bars - counted_bars + period + 1; 
    
    double vect[], trend[]; 
    
    if(e > Bars) 
        e = Bars;    

    ArrayResize(vect, e); 
    ArraySetAsSeries(vect, true);
    ArrayResize(trend, e); 
    ArraySetAsSeries(trend, true); 
    
    for(x = 0; x < e; x++) 
    { 
        vect[x] = 2*WMA(x, period/2) - WMA(x, period);        
 //       Print("Bar date/time: ", TimeToStr(Time[x]), " close: ", Close[x], " vect[", x, "] = ", vect[x], " 2*WMA(p/2) = ", 2*WMA(x, period/2), " WMA(p) = ",  WMA(x, period)); 
    } 

    for(x = 0; x < e-period; x++)
     
        ExtMapBuffer[x] = iMAOnArray(vect, 0, p, 0, method, x);        
    
    for(x = e-period; x >= 0; x--)
    {     
        trend[x] = trend[x+1];
        if (ExtMapBuffer[x]> ExtMapBuffer[x+1]) trend[x] =1;
        if (ExtMapBuffer[x]< ExtMapBuffer[x+1]) trend[x] =-1;
    
    if (trend[x]>0)
    { Uptrend[x] = ExtMapBuffer[x]; 
      if (trend[x+1]<0) Uptrend[x+1]=ExtMapBuffer[x+1];
      Dntrend[x] = EMPTY_VALUE;
    }
    else              
    if (trend[x]<0)
    { 
      Dntrend[x] = ExtMapBuffer[x]; 
      if (trend[x+1]>0) Dntrend[x+1]=ExtMapBuffer[x+1];
      Uptrend[x] = EMPTY_VALUE;
    }              
    
    //Print( " trend=",trend[x]);
    }
    
    return(0); 
} 
//+------------------------------------------------------------------+ 
   

Indicatore Metatrader - Daily Range Calculator

//+------------------------------------------------------------------+
//|                          (T_S_R)-Daily Range Calculator v1.3.mq4 |
//|                                         Copyright © 2006, Ogeima |
//|                                             
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
  
//|Made for the TSR (Trend Slope Retracement) system by FXiGoR       |
//|http://strategybuilderfx.com/showthread.php?t=17252               |
//+------------------------------------------------------------------+
// For basic explanations, see the notes at the end this script.
// For information regarding the T_S_R method, read the "FXiGoR-(T_S_R) very effective Trend Slope Retracement system" thread opened by iGoR at StrategyBuilderfx, Forex-tsd, MoneyTec, ForexFactory or Trade2Win.
#property copyright "Copyright © 2006, Ogeima"
#property link      "
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 "

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red

//---- input parameters
extern double  Risk_to_Reward_ratio =  3.0;

double aSL_Long[];
double aSL_Short[];
int nDigits;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,3);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,3);
   
   SetIndexBuffer(0,aSL_Long);
   SetIndexBuffer(1,aSL_Short);
   
   SetIndexEmptyValue(0,EMPTY_VALUE);
   SetIndexEmptyValue(1,EMPTY_VALUE);

   if(Symbol()=="GBPJPY" || Symbol()=="EURJPY" || Symbol()=="USDJPY" || Symbol()=="CHFJPY" || Symbol()=="GOLD" || Symbol()=="_SP500")  nDigits = 2;
   else nDigits = 4;
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
   Comment("");
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int      R1=0,R5=0,R10=0,R20=0,RAvg=0;
   int      RoomUp=0,RoomDown=0,StopLoss_Long=0,StopLoss_Short=0;
   double   SL_Long=0,SL_Short=0;
   double   low0=0,high0=0;
   string   Text="";
   int      i=0;

   R1 =  (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/Point;
   for(i=1;i<=5;i++)    R5    =  R5  +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;
   for(i=1;i<=10;i++)   R10   =  R10 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;
   for(i=1;i<=20;i++)   R20   =  R20 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;

   R5    = R5/5;
   R10   = R10/10;
   R20   = R20/20;
   RAvg  =  (R5+R10+R20)/3;    

   low0  =  iLow(NULL,PERIOD_D1,0);
   high0 =  iHigh(NULL,PERIOD_D1,0);

   RoomUp         =  RAvg - (Bid - low0)/Point;
   RoomDown       =  RAvg - (high0 - Bid)/Point;
   StopLoss_Long  =  RoomUp/Risk_to_Reward_ratio;
   SL_Long        =  Bid - StopLoss_Long*Point;
   StopLoss_Short =  RoomDown/Risk_to_Reward_ratio;
   SL_Short       =  Bid + StopLoss_Short*Point;

   Text =   "Average Day  Range: " +  RAvg + "\n"  + 
            "Prev 01  Day  Range: " +  R1   + "\n" + 
            "Prev 05  Days Range: " +  R5   + "\n" + 
            "Prev 10  Days Range: " +  R10  + "\n" +
            "Prev 20  Days Range: " +  R20  + "\n";
   Text =   Text +
            "Room Up:     " + RoomUp              + "\n" +
            "Room Down: " + RoomDown            + "\n" +
            "Max. StopLosses should be :"  + "\n" +
            "Long:  " + StopLoss_Long  + " Pips at " + DoubleToStr(SL_Long,nDigits)  + "\n" +
            "Short: " + StopLoss_Short + " Pips at " + DoubleToStr(SL_Short,nDigits) + "\n";

   Comment(Text);

   //-- SL Lines
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) counted_bars=0;
   if(counted_bars>0) counted_bars--;
   limit =  counted_bars;

   for(i = 0 ;i <= limit ;i++)
   {
      if(i==0 || i==1 || i==2)
      {
         aSL_Long[i] =  SL_Long;
         aSL_Short[i]=  SL_Short;
      }
      else
      {
         aSL_Long[i] = EMPTY_VALUE;
         aSL_Short[i]= EMPTY_VALUE;
      }
   }
   return(0);
}
//+------------------------------------------------------------------+
/*
Here's a little "indicator" that does some basic calculations for us.

Let's look at what it does:
It computes yesterday's range, the previous 5, 10 and 20 days ranges. And it calculates the "Average Day Range" of these four ranges (yesterday's+ Prev 5 Day Range + Prev 10 Day Range + Prev 20 Day Range)/4.
So, if yesterday's Day Range was 80, the Previous 5 Day Range was 110, the Previous 10 Day Range was 90 and the Previous 20 Day Range was 120, then the Average Day Range would be 100.

Then there's "Room Up" and "Room Down".
Let's imagine today's low is (so far) 1000 and today's high is (so far) 1050. At this moment the price is 1020.
So we're 1020-1000= 20 pips above the low, there is therefore 100-20=80 pips "left" up. For a risk-to-reward ratio of (say) 3, if a long trade was to be entered now, the stop loss should be no more than 80/3=26pips away, that is at 1020-26=994. So, if all conditions are met, we ll look for a "bottom" no lower than 994.
Same thing for a short trade: we are 1050-1020= 30 pips below the high, there is therefore 100-30=70 pips "left" down. For a risk-to-reward ratio of 3, if a short trade was to be entered now, the stop loss should be no more than 70/3=23pips away, that is at 1020+23=1043. So, if all conditions are met, we ll look for a "top" no higher than 1043.

As you can see, this indicator doesn't tell us whether or not we have a set up to trade. What it does is, considering some past day ranges, and for a given Risk to Reward ratio, it tells us how far away we can put a stop loss.

Hope this helps,

Ogeima.

P.S.: I used H-L (High-Low) to compute the Ranges. They are thus a bit different from mataf.net data, which computes what is known as the "True" Ranges (= Max(High for the period less the Low for the period,High for the period less the Close for the previous period,Close for the previous period and the Low for the current period)).

--------
PS1: occasionnally, as someone apparently pointed out in the chatroom, RoomUp/RoomDown (and the indicative stop losses) will have negative values. For example, let's imagine that the Average Day Range is 100, today's High is 1150, today's low is 1000 and the current price is 1040.
Price has traveled 1150-1040 = 110 pips down from the High, that's 10 pips more than the 100 pips of the Average Day Range, so the RoomDown will be -10 pips (and the stoploss will be -10/Risk_to_Reward_ratio).

(And price has traveled 1040-1000= 40 pips from the Low so the RoomUp will be positive (=100-40=60), nothing special here.)
--------

v1.3: added 2 horizontal lines at the level of the StopLosses: Green line for Long SL, Red line for Short SL.
*/
//+------------------------------------------------------------------+
//|                          (T_S_R)-Daily Range Calculator v1.3.mq4 |
//|                                         Copyright © 2006, Ogeima |
//|                                             
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
  
//|Made for the TSR (Trend Slope Retracement) system by FXiGoR       |
//|http://strategybuilderfx.com/showthread.php?t=17252               |
//+------------------------------------------------------------------+
// For basic explanations, see the notes at the end this script.
// For information regarding the T_S_R method, read the "FXiGoR-(T_S_R) very effective Trend Slope Retracement system" thread opened by iGoR at StrategyBuilderfx, Forex-tsd, MoneyTec, ForexFactory or Trade2Win.
#property copyright "Copyright © 2006, Ogeima"
#property link      "
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 "

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red

//---- input parameters
extern double  Risk_to_Reward_ratio =  3.0;

double aSL_Long[];
double aSL_Short[];
int nDigits;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,3);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,3);
   
   SetIndexBuffer(0,aSL_Long);
   SetIndexBuffer(1,aSL_Short);
   
   SetIndexEmptyValue(0,EMPTY_VALUE);
   SetIndexEmptyValue(1,EMPTY_VALUE);

   if(Symbol()=="GBPJPY" || Symbol()=="EURJPY" || Symbol()=="USDJPY" || Symbol()=="CHFJPY" || Symbol()=="GOLD" || Symbol()=="_SP500")  nDigits = 2;
   else nDigits = 4;
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
   Comment("");
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int      R1=0,R5=0,R10=0,R20=0,RAvg=0;
   int      RoomUp=0,RoomDown=0,StopLoss_Long=0,StopLoss_Short=0;
   double   SL_Long=0,SL_Short=0;
   double   low0=0,high0=0;
   string   Text="";
   int      i=0;

   R1 =  (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/Point;
   for(i=1;i<=5;i++)    R5    =  R5  +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;
   for(i=1;i<=10;i++)   R10   =  R10 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;
   for(i=1;i<=20;i++)   R20   =  R20 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;

   R5    = R5/5;
   R10   = R10/10;
   R20   = R20/20;
   RAvg  =  (R5+R10+R20)/3;    

   low0  =  iLow(NULL,PERIOD_D1,0);
   high0 =  iHigh(NULL,PERIOD_D1,0);

   RoomUp         =  RAvg - (Bid - low0)/Point;
   RoomDown       =  RAvg - (high0 - Bid)/Point;
   StopLoss_Long  =  RoomUp/Risk_to_Reward_ratio;
   SL_Long        =  Bid - StopLoss_Long*Point;
   StopLoss_Short =  RoomDown/Risk_to_Reward_ratio;
   SL_Short       =  Bid + StopLoss_Short*Point;

   Text =   "Average Day  Range: " +  RAvg + "\n"  + 
            "Prev 01  Day  Range: " +  R1   + "\n" + 
            "Prev 05  Days Range: " +  R5   + "\n" + 
            "Prev 10  Days Range: " +  R10  + "\n" +
            "Prev 20  Days Range: " +  R20  + "\n";
   Text =   Text +
            "Room Up:     " + RoomUp              + "\n" +
            "Room Down: " + RoomDown            + "\n" +
            "Max. StopLosses should be :"  + "\n" +
            "Long:  " + StopLoss_Long  + " Pips at " + DoubleToStr(SL_Long,nDigits)  + "\n" +
            "Short: " + StopLoss_Short + " Pips at " + DoubleToStr(SL_Short,nDigits) + "\n";

   Comment(Text);

   //-- SL Lines
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) counted_bars=0;
   if(counted_bars>0) counted_bars--;
   limit =  counted_bars;

   for(i = 0 ;i <= limit ;i++)
   {
      if(i==0 || i==1 || i==2)
      {
         aSL_Long[i] =  SL_Long;
         aSL_Short[i]=  SL_Short;
      }
      else
      {
         aSL_Long[i] = EMPTY_VALUE;
         aSL_Short[i]= EMPTY_VALUE;
      }
   }
   return(0);
}
//+------------------------------------------------------------------+
/*
Here's a little "indicator" that does some basic calculations for us.

Let's look at what it does:
It computes yesterday's range, the previous 5, 10 and 20 days ranges. And it calculates the "Average Day Range" of these four ranges (yesterday's+ Prev 5 Day Range + Prev 10 Day Range + Prev 20 Day Range)/4.
So, if yesterday's Day Range was 80, the Previous 5 Day Range was 110, the Previous 10 Day Range was 90 and the Previous 20 Day Range was 120, then the Average Day Range would be 100.

Then there's "Room Up" and "Room Down".
Let's imagine today's low is (so far) 1000 and today's high is (so far) 1050. At this moment the price is 1020.
So we're 1020-1000= 20 pips above the low, there is therefore 100-20=80 pips "left" up. For a risk-to-reward ratio of (say) 3, if a long trade was to be entered now, the stop loss should be no more than 80/3=26pips away, that is at 1020-26=994. So, if all conditions are met, we ll look for a "bottom" no lower than 994.
Same thing for a short trade: we are 1050-1020= 30 pips below the high, there is therefore 100-30=70 pips "left" down. For a risk-to-reward ratio of 3, if a short trade was to be entered now, the stop loss should be no more than 70/3=23pips away, that is at 1020+23=1043. So, if all conditions are met, we ll look for a "top" no higher than 1043.

As you can see, this indicator doesn't tell us whether or not we have a set up to trade. What it does is, considering some past day ranges, and for a given Risk to Reward ratio, it tells us how far away we can put a stop loss.

Hope this helps,

Ogeima.

P.S.: I used H-L (High-Low) to compute the Ranges. They are thus a bit different from mataf.net data, which computes what is known as the "True" Ranges (= Max(High for the period less the Low for the period,High for the period less the Close for the previous period,Close for the previous period and the Low for the current period)).

--------
PS1: occasionnally, as someone apparently pointed out in the chatroom, RoomUp/RoomDown (and the indicative stop losses) will have negative values. For example, let's imagine that the Average Day Range is 100, today's High is 1150, today's low is 1000 and the current price is 1040.
Price has traveled 1150-1040 = 110 pips down from the High, that's 10 pips more than the 100 pips of the Average Day Range, so the RoomDown will be -10 pips (and the stoploss will be -10/Risk_to_Reward_ratio).

(And price has traveled 1040-1000= 40 pips from the Low so the RoomUp will be positive (=100-40=60), nothing special here.)
--------

v1.3: added 2 horizontal lines at the level of the StopLosses: Green line for Long SL, Red line for Short SL.
*/
 

Indicatore Metatrader - Big Trend

//+------------------------------------------------------------------+ 
//| HMA.mq4 
//| Copyright © 2006 WizardSerg <
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 >, ?? ??????? ForexMagazine #104 
//| 
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
  
//| Revised by IgorAD,
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
  |   
//| Personalized by iGoR AKA FXiGoR for the Trend Slope Trading method (T_S_T) 
//| Link: 
//| contact: 
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
                                                                          
//+------------------------------------------------------------------+
#property copyright "MT4 release WizardSerg <
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 >, ?? ??????? ForexMagazine #104" 
#property link      "
 Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
 " 

#property indicator_chart_window 
#property indicator_buffers 2 
#property indicator_color1 LightBlue 
#property indicator_color2 Tomato 
//---- input parameters 
extern int       period=80; 
extern int       method=3;                         // MODE_SMA 
extern int       price=0;                          // PRICE_CLOSE 
//---- buffers 
double Uptrend[];
double Dntrend[];
double ExtMapBuffer[]; 


//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int init() 
{ 
    IndicatorBuffers(3);  
    SetIndexBuffer(0, Uptrend); 
    //ArraySetAsSeries(Uptrend, true); 
    SetIndexBuffer(1, Dntrend); 
    //ArraySetAsSeries(Dntrend, true); 
    SetIndexBuffer(2, ExtMapBuffer); 
    ArraySetAsSeries(ExtMapBuffer, true); 
    
    SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
    SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
    
    IndicatorShortName("Slope Direction Line("+period+")"); 
    return(0); 
} 

//+------------------------------------------------------------------+ 
//| Custor indicator deinitialization function                       | 
//+------------------------------------------------------------------+ 
int deinit() 
{ 
    // ???? ????? ?????? ?????? 
    return(0); 
} 

//+------------------------------------------------------------------+ 
//| ?????????? ???????                                               | 
//+------------------------------------------------------------------+ 
double WMA(int x, int p) 
{ 
    return(iMA(NULL, 0, p, 0, method, price, x));    
} 

//+------------------------------------------------------------------+ 
//| Custom indicator iteration function                              | 
//+------------------------------------------------------------------+ 
int start() 
{ 
    int counted_bars = IndicatorCounted(); 
    
    if(counted_bars < 0) 
        return(-1); 
                  
    int x = 0; 
    int p = MathSqrt(period);              
    int e = Bars - counted_bars + period + 1; 
    
    double vect[], trend[]; 
    
    if(e > Bars) 
        e = Bars;    

    ArrayResize(vect, e); 
    ArraySetAsSeries(vect, true);
    ArrayResize(trend, e); 
    ArraySetAsSeries(trend, true); 
    
    for(x = 0; x < e; x++) 
    { 
        vect[x] = 2*WMA(x, period/2) - WMA(x, period);        
 //       Print("Bar date/time: ", TimeToStr(Time[x]), " close: ", Close[x], " vect[", x, "] = ", vect[x], " 2*WMA(p/2) = ", 2*WMA(x, period/2), " WMA(p) = ",  WMA(x, period)); 
    } 

    for(x = 0; x < e-period; x++)
     
        ExtMapBuffer[x] = iMAOnArray(vect, 0, p, 0, method, x);        
    
    for(x = e-period; x >= 0; x--)
    {     
        trend[x] = trend[x+1];
        if (ExtMapBuffer[x]> ExtMapBuffer[x+1]) trend[x] =1;
        if (ExtMapBuffer[x]< ExtMapBuffer[x+1]) trend[x] =-1;
    
    if (trend[x]>0)
    { Uptrend[x] = ExtMapBuffer[x]; 
      if (trend[x+1]<0) Uptrend[x+1]=ExtMapBuffer[x+1];
      Dntrend[x] = EMPTY_VALUE;
    }
    else              
    if (trend[x]<0)
    { 
      Dntrend[x] = ExtMapBuffer[x]; 
      if (trend[x+1]>0) Dntrend[x+1]=ExtMapBuffer[x+1];
      Uptrend[x] = EMPTY_VALUE;
    }              
    
    //Print( " trend=",trend[x]);
    }
    
    return(0); 
} 
//+------------------------------------------------------------------+ 
   

Pagina 2 di 6


Warning: Illegal string offset 'active' in /home/mhd-01/www.expert-advisor.it/htdocs/templates/rt_solarsentinel_j15/html/pagination.php on line 94

Warning: Illegal string offset 'active' in /home/mhd-01/www.expert-advisor.it/htdocs/templates/rt_solarsentinel_j15/html/pagination.php on line 100

Warning: Illegal string offset 'active' in /home/mhd-01/www.expert-advisor.it/htdocs/templates/rt_solarsentinel_j15/html/pagination.php on line 94

Warning: Illegal string offset 'active' in /home/mhd-01/www.expert-advisor.it/htdocs/templates/rt_solarsentinel_j15/html/pagination.php on line 100

Warning: Illegal string offset 'active' in /home/mhd-01/www.expert-advisor.it/htdocs/templates/rt_solarsentinel_j15/html/pagination.php on line 94

Warning: Illegal string offset 'active' in /home/mhd-01/www.expert-advisor.it/htdocs/templates/rt_solarsentinel_j15/html/pagination.php on line 100

Warning: Illegal string offset 'active' in /home/mhd-01/www.expert-advisor.it/htdocs/templates/rt_solarsentinel_j15/html/pagination.php on line 94

Warning: Illegal string offset 'active' in /home/mhd-01/www.expert-advisor.it/htdocs/templates/rt_solarsentinel_j15/html/pagination.php on line 100

Warning: Illegal string offset 'active' in /home/mhd-01/www.expert-advisor.it/htdocs/templates/rt_solarsentinel_j15/html/pagination.php on line 94

Warning: Illegal string offset 'active' in /home/mhd-01/www.expert-advisor.it/htdocs/templates/rt_solarsentinel_j15/html/pagination.php on line 100

Opzioni Forex.

Piattaforma trading.

Download Fap Turbo

Scarica FapTurbo Adesso.

Expert Advisor MT4

Forex Expert Advisor - Forex Trading automatizzati con un trading system costruito con linguaggio Metaquotes MQL4. Strategy tester per testare le strategie forex. Si possono trovare alcuni interessanti expert advisor costruiti da Trader Usa. Clicca il banner per andare al sito.

Guida Server VPS e MT4

Come Configurare un Server VPS per Piattaforma MT4 in cui far girare degli EA su conti live?

Ecco una utile Guida da Scaricare Gratis!

Disclaimer -Avviso. Gli Expert Advisor ed i mercati finanziari sono rischiosi. Prima di leggere le pagine del sito Ti invitiamo a consultare il " Disclaimer " e "Privacy "

Forex opzioni.

Forex Expert.

Forex Expert.

Forex Expert.

Forex Expert.