MFI

Christmas Present to be able to utilize Money Flow dip displacements for an entry.

////MFI by Macdulio
#property copyright   "MFI by Macdulio, (c) 2021"
#property link        "http://www.forexfore.blog"
#property description "MFI by Macdulio"
#property strict

#property indicator_separate_window
//separate_window
#property indicator_minimum    -50
#property indicator_maximum    50
#property indicator_buffers    2
#property indicator_level1 0
#property indicator_levelcolor clrYellow
#property indicator_levelstyle STYLE_DOT
#property indicator_levelwidth 1
extern int indicator_window = 1;
extern int lookback = 600;

string symbol = Symbol();
double RSI2[];

//---- buffers
double MFI[],MFINEG[];

int init()
  {
   SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,5,Green);
   SetIndexBuffer(0,MFI);
   
    SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,5,Crimson);
   SetIndexBuffer(1,MFINEG);

   return(0);  
}
  

int start()
{ 
ArrayResize(RSI2, Bars);   
ArrayInitialize(RSI2, 0); 
ArrayResize(MFI, Bars);   
ArrayInitialize(MFI, 0); 
ArrayResize(MFINEG, Bars);   
ArrayInitialize(MFINEG, 0); 
   
int    i;
 
for(i=Bars-60; i>=0; i--){
  RSI2[i]=iRSI(symbol,0,2,PRICE_MEDIAN,i);
  MFI[i]=iMFI(symbol,0,14,i)-50;
  if (MFI[i]<0) MFINEG[i]=MFI[i];
}



deletetxt1("Cinnamon");
for (i = lookback ; i >0; i--) {
   if (MFI[i]<MFI[i+1] && MFI[i+1]<MFI[i+2] && MFI[i]>0 && MFI[i-1]>0 && MFI[i-1]>MFI[i] && i>0){
   
      if (i<46) ObjectCreate("Cinnamon"+IntegerToString(i), OBJ_RECTANGLE, 0,  Time[i+1], High[i+1]+100*Point, Time[0], High[i+1]+150*Point);
      else  ObjectCreate("Cinnamon"+IntegerToString(i), OBJ_RECTANGLE, 0,  Time[i+1], High[i+1]+100*Point, Time[i-1], High[i+1]+150*Point);
          ObjectSetInteger(0,"Cinnamon"+IntegerToString(i),OBJPROP_COLOR,clrPink);
          ObjectSet("Cinnamon"+IntegerToString(i),OBJPROP_BACK,0);
          ObjectSet("Cinnamon"+IntegerToString(i),OBJPROP_WIDTH,1);
   }
    if (MFI[i]>MFI[i+1] && MFI[i+1]>MFI[i+2] && MFI[i]<0 && MFI[i-1]<0 && MFI[i-1]<MFI[i] && i>0){
   
      if (i<56) ObjectCreate("Cinnamon"+IntegerToString(i), OBJ_RECTANGLE, 0,  Time[i+1], Low[i+1]-100*Point, Time[0], Low[i+1]-150*Point);
      else  ObjectCreate("Cinnamon"+IntegerToString(i), OBJ_RECTANGLE, 0,  Time[i+1], Low[i+1]-100*Point, Time[i-1], Low[i+1]-150*Point);
          ObjectSetInteger(0,"Cinnamon"+IntegerToString(i),OBJPROP_COLOR,clrChartreuse);
          ObjectSet("Cinnamon"+IntegerToString(i),OBJPROP_BACK,0);
          ObjectSet("Cinnamon"+IntegerToString(i),OBJPROP_WIDTH,1);
   } 
   

}



deletetxt1("Harley");

////Captain America
for(i=lookback; i>0; i--){


   if (Period()==60 && High[i]>High[i+1] && High[i]>High[i-1] && i>0 && High[i]-380*Point<iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,2,i+4)) && High[i]>iMA(symbol,60,207,0,MODE_EMA, PRICE_LOW,i) && High[i]-250*Point>iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,2,i+4))
  //&& RSI2[i]<84
   && (RSI2[i+4]<15 || RSI2[i+4]>16)
   )
   {
     ObjectCreate("Harley"+DoubleToStr(i), OBJ_TEXT, 0, Time[i], High[i]+100*Point); 
     ObjectSetText("Harley"+DoubleToStr(i), CharToStr(181), 68, "Wingdings", clrCrimson);
   }

 if (Period()==60 && Low[i]<Low[i+1] && Low[i]<Low[i-1] && i>0 && Low[i]+380*Point>iLow(symbol,0,iLowest(symbol,0,MODE_LOW,2,i+4)) 
     //&& High[i]>iMA(symbol,60,207,0,MODE_EMA, PRICE_LOW,i) 
     && Low[i]+250*Point<iLow(symbol,0,iLowest(symbol,0,MODE_LOW,2,i+4)))
   {
     ObjectCreate("Harleys"+DoubleToStr(i), OBJ_TEXT, 0, Time[i], Low[i]+100*Point); 
     ObjectSetText("Harleys"+DoubleToStr(i), CharToStr(181), 68, "Wingdings", clrYellow);
   }   


   if (Period()==60 && Low[i]<Low[i+1] && Low[i]<Low[i-1] && i>0 && Low[i]+380*Point>iLow(symbol,0,iLowest(symbol,0,MODE_LOW,2,i+4)) && Low[i]<iMA(symbol,60,207,0,MODE_EMA, PRICE_HIGH,i) && Low[i]+250*Point<iLow(symbol,0,iLowest(symbol,0,MODE_LOW,2,i+4)))
   {
     ObjectCreate("Harley"+DoubleToStr(i), OBJ_TEXT, 0, Time[i], Low[i]+100*Point); 
     ObjectSetText("Harley"+DoubleToStr(i), CharToStr(181), 68, "Wingdings", clrDarkGreen);
   }


}



// WindowRedraw();
   return(0);
  }
//+------------------------------------------------------------------+
   void deletetxt1(string text){
   for(int iObj=ObjectsTotal()-1; iObj >= 0; iObj--){
      string   on = ObjectName(iObj);
      if(StringFind(on, text) == 0)  ObjectDelete(on);
}  }

The pro version knows all the reversal divergences (vertical line markers for control) and gives you the break out levels to be ready for hedging 1/2 risk. $29.90 with Axel S pro bundled in.