www.pudn.com > RedbinaryoptionsDL.zip > ForexTrigger Indicator_BO.mq4, change:2010-04-09,size:9764b


//+------------------------------------------------------------------+ 
//|                                                 ForexTrigger.com | 
//|                                                                  | 
//|                                                                  | 
//+------------------------------------------------------------------+ 
#property copyright "ForexTrigger.com" 
#property link      "ForexTrigger.com" 
       int     Bars.Back                        =     100; 
       int     Support.Resistance.Bars          =     80; 
       double  Minimum.ATR.Swing                =     2; 
extern color   LabelsColor                      =     Blue; 
extern int     Font.Size                        =     10; 
extern bool    Sound.Alerts                     =     true; 
extern bool    Email.Alerts                     =     false; 
#property indicator_chart_window 
int init() 
{ 
   deleteAllObjects(); 
} 
int deinit() 
{ 
   deleteAllObjects(); 
} 
int start() 
{ 
   deleteAllObjects(); 
   string plot = ""; 
   double ATR = iATR(Symbol(), 0, 50, 1); 
   double sup=0, res=0; 
   if(ObjectType("lbl") != OBJ_LABEL) ObjectDelete("lbl"); 
   if(ObjectFind("lbl") == -1) ObjectCreate("lbl", OBJ_LABEL, 0, Time[5], Close[5]); 
   ObjectSetText("lbl", "ForexTrigger.com Indicator"); 
   ObjectSet("lbl", OBJPROP_FONTSIZE, 11); 
   ObjectSet("lbl", OBJPROP_CORNER, 1); 
   ObjectSet("lbl", OBJPROP_COLOR, Blue); 
   ObjectSet("lbl", OBJPROP_XDISTANCE, 20); 
   ObjectSet("lbl", OBJPROP_YDISTANCE, 10); 
   int currentLabel = 1; 
   int i = 3; 
   //Identify trend 
   int trend = 0; 
   double MASlope = iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, 1)-iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, 2); 
   MASlope += iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, 2)-iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, 3); 
   MASlope /= 2; 
   if(MASlope > 0) trend = 1; else trend = -1; 
   for(i=0; i < 20; i++) 
   { 
      MASlope = iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, i)-iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, i+1); 
      MASlope += iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, i+1)-iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, i+2); 
      MASlope /= 2; 
      if(MASlope < 0 && trend == 1) trend = 0; 
      if(MASlope > 0 && trend == -1) trend = 0; 
   } 
   currentLabel++; 
   if(ObjectType("lbl" + currentLabel) != OBJ_LABEL) ObjectDelete("lbl" + currentLabel); 
   if(ObjectFind("lbl" + currentLabel) == -1) ObjectCreate("lbl" + currentLabel, OBJ_LABEL, 0, Time[5], Close[5]); 
   ObjectSet("lbl" + currentLabel, OBJPROP_FONTSIZE, Font.Size); 
   ObjectSet("lbl" + currentLabel, OBJPROP_CORNER, 1); 
   ObjectSet("lbl" + currentLabel, OBJPROP_COLOR, LabelsColor); 
   ObjectSet("lbl" + currentLabel, OBJPROP_XDISTANCE, 20); 
   ObjectSet("lbl" + currentLabel, OBJPROP_YDISTANCE, 15+15*currentLabel);       
   if(trend == 1)  ObjectSetText("lbl" + currentLabel, "Price is trending Up - Only TrendTrigger Trades"); 
   if(trend == -1) ObjectSetText("lbl" + currentLabel, "Price is trending Down - Only TrendTrigger Trades"); 
   if(trend == 0)  ObjectSetText("lbl" + currentLabel, "Price is in Range - Only BounceTrigger Trades"); 
   double StopLoss, TakeProfit, RiskReward; 
   bool BounceTrigger = false, TrendTrigger = false; 
   if(trend == 0) 
   { 
      if(Close[0] >= iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, 0)) 
      { 
         StopLoss = High[iHighest(Symbol(), 0, MODE_HIGH, 4, 0)]+5*Point; 
         TakeProfit = iBands(Symbol(), 0, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, 0); 
         RiskReward = (StopLoss-Close[0]) / (TakeProfit - Close[0]); 
         if(High[0] + 0.3*ATR > iBands(Symbol(), 0, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, 0)) BounceTrigger = true; 
         if(High[1] + 0.3*ATR > iBands(Symbol(), 0, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, 1)) BounceTrigger = true; 
      } 
      if(Close[0] < iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, 0)) 
      { 
         StopLoss = Low[iLowest(Symbol(), 0, MODE_LOW, 4, 0)]+5*Point; 
         TakeProfit = iBands(Symbol(), 0, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, 0); 
         RiskReward = (Close[0]-StopLoss) / (TakeProfit - Close[0]); 
         if(Low[0] - 0.3*ATR < iBands(Symbol(), 0, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, 0)) BounceTrigger = true; 
         if(Low[1] - 0.3*ATR < iBands(Symbol(), 0, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, 1)) BounceTrigger = true; 
      } 
   } 
   if(trend != 0) 
   { 
      if(trend == -1) 
      { 
         StopLoss = High[iHighest(Symbol(), 0, MODE_HIGH, 4, 0)]+5*Point; 
         if(High[0] + 0.3*ATR > iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, 0)) TrendTrigger = true; 
         if(High[1] + 0.3*ATR > iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, 1)) TrendTrigger = true; 
      } 
      if(trend == 1) 
      { 
         StopLoss = Low[iLowest(Symbol(), 0, MODE_LOW, 4, 0)]+5*Point; 
         if(Low[0] - 0.3*ATR < iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, 0)) TrendTrigger = true; 
         if(Low[1] - 0.3*ATR < iMA(Symbol(), 0, 20, 0, MODE_SMA, PRICE_CLOSE, 1)) TrendTrigger = true; 
      } 
   } 
   if(StopLoss != 0) 
   { 
      currentLabel++; 
      if(ObjectType("lbl" + currentLabel) != OBJ_LABEL) ObjectDelete("lbl" + currentLabel); 
      if(ObjectFind("lbl" + currentLabel) == -1) ObjectCreate("lbl" + currentLabel, OBJ_LABEL, 0, Time[5], Close[5]); 
      ObjectSet("lbl" + currentLabel, OBJPROP_FONTSIZE, Font.Size); 
      ObjectSet("lbl" + currentLabel, OBJPROP_CORNER, 1); 
      ObjectSet("lbl" + currentLabel, OBJPROP_COLOR, LabelsColor); 
      ObjectSet("lbl" + currentLabel, OBJPROP_XDISTANCE, 20); 
      ObjectSet("lbl" + currentLabel, OBJPROP_YDISTANCE, 15+15*currentLabel);       
      ObjectSetText("lbl" + currentLabel, "Stop Loss: " + StopLoss); 
   } 
   if(TakeProfit != 0) 
   { 
      currentLabel++; 
      if(ObjectType("lbl" + currentLabel) != OBJ_LABEL) ObjectDelete("lbl" + currentLabel); 
      if(ObjectFind("lbl" + currentLabel) == -1) ObjectCreate("lbl" + currentLabel, OBJ_LABEL, 0, Time[5], Close[5]); 
      ObjectSet("lbl" + currentLabel, OBJPROP_FONTSIZE, Font.Size); 
      ObjectSet("lbl" + currentLabel, OBJPROP_CORNER, 1); 
      ObjectSet("lbl" + currentLabel, OBJPROP_COLOR, LabelsColor); 
      ObjectSet("lbl" + currentLabel, OBJPROP_XDISTANCE, 20); 
      ObjectSet("lbl" + currentLabel, OBJPROP_YDISTANCE, 15+15*currentLabel);       
      ObjectSetText("lbl" + currentLabel, "Take Profit: " + TakeProfit); 
   } 
   if(RiskReward != 0) 
   { 
      currentLabel++; 
      if(ObjectType("lbl" + currentLabel) != OBJ_LABEL) ObjectDelete("lbl" + currentLabel); 
      if(ObjectFind("lbl" + currentLabel) == -1) ObjectCreate("lbl" + currentLabel, OBJ_LABEL, 0, Time[5], Close[5]); 
      ObjectSet("lbl" + currentLabel, OBJPROP_FONTSIZE, Font.Size); 
      ObjectSet("lbl" + currentLabel, OBJPROP_CORNER, 1); 
      ObjectSet("lbl" + currentLabel, OBJPROP_COLOR, LabelsColor); 
      ObjectSet("lbl" + currentLabel, OBJPROP_XDISTANCE, 20); 
      ObjectSet("lbl" + currentLabel, OBJPROP_YDISTANCE, 15+15*currentLabel);       
      ObjectSetText("lbl" + currentLabel, "Risk:Reward Ratio: " + RiskReward); 
   } 
   if(BounceTrigger) 
   { 
      currentLabel++; 
      if(ObjectType("lbl" + currentLabel) != OBJ_LABEL) ObjectDelete("lbl" + currentLabel); 
      if(ObjectFind("lbl" + currentLabel) == -1) ObjectCreate("lbl" + currentLabel, OBJ_LABEL, 0, Time[5], Close[5]); 
      ObjectSet("lbl" + currentLabel, OBJPROP_FONTSIZE, Font.Size); 
      ObjectSet("lbl" + currentLabel, OBJPROP_CORNER, 1); 
      ObjectSet("lbl" + currentLabel, OBJPROP_COLOR, LabelsColor); 
      ObjectSet("lbl" + currentLabel, OBJPROP_XDISTANCE, 20); 
      ObjectSet("lbl" + currentLabel, OBJPROP_YDISTANCE, 15+15*currentLabel); 
      ObjectSetText("lbl" + currentLabel, "Possible BounceTrigger is Occuring!"); 
      if(Sound.Alerts && Open[0] == Close[0] && Open[0] == Low[0] && Open[0] == High[0]) 
         Alert("ForexTrigger.com : Possible BounceTrigger at " + Symbol()); 
      if(Email.Alerts && Open[0] == Close[0] && Open[0] == Low[0] && Open[0] == High[0]) 
         SendMail("ForexTrigger.com : Possible BounceTrigger at " + Symbol(), "ForexTrigger.com : Possible BounceTrigger at " + Symbol()); 
   } 
   if(TrendTrigger) 
   { 
      currentLabel++; 
      if(ObjectType("lbl" + currentLabel) != OBJ_LABEL) ObjectDelete("lbl" + currentLabel); 
      if(ObjectFind("lbl" + currentLabel) == -1) ObjectCreate("lbl" + currentLabel, OBJ_LABEL, 0, Time[5], Close[5]); 
      ObjectSet("lbl" + currentLabel, OBJPROP_FONTSIZE, Font.Size); 
      ObjectSet("lbl" + currentLabel, OBJPROP_CORNER, 1); 
      ObjectSet("lbl" + currentLabel, OBJPROP_COLOR, LabelsColor); 
      ObjectSet("lbl" + currentLabel, OBJPROP_XDISTANCE, 20); 
      ObjectSet("lbl" + currentLabel, OBJPROP_YDISTANCE, 15+15*currentLabel); 
      ObjectSetText("lbl" + currentLabel, "Possible TrendTrigger is Occuring!"); 
      if(Sound.Alerts && Open[0] == Close[0] && Open[0] == Low[0] && Open[0] == High[0]) 
         Alert("ForexTrigger.com : Possible TrendTrigger at " + Symbol()); 
      if(Email.Alerts && Open[0] == Close[0] && Open[0] == Low[0] && Open[0] == High[0]) 
         SendMail("ForexTrigger.com : Possible TrendTrigger at " + Symbol(), "ForexTrigger.com : Possible TrendTrigger at " + Symbol()); 
   } 
} 
 
 
 
 
void deleteAllObjects() 
{ 
   for(int i=0 ; i < ObjectsTotal() ; i++) 
   { 
      if(StringFind(ObjectName(i), "TAP") != -1 || 
         StringFind(ObjectName(i), "lbl") != -1) 
      { 
         ObjectDelete(ObjectName(i)); 
         i--; 
      } 
   } 
}

2018无需申请注册送58体验金