#property copyright "Don Isbell"
#property link      "disbellj@gmail.com"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow

//---- inputs
extern double Lots = 0.1;
extern int StopLoss = 100;
extern int TakeProfit = 50;

extern string NFP = "NFP Parameters" ;
extern bool ShowComments = true;
extern bool NFPStart_ShiftOneWeek = true;

extern color DuringNFP_NoTradeZone_Color = Red;
extern color AfterNFP_NoTradeZone_Color = Orange;

extern color StartTrading_Color = Green;

extern color PrevWeek_Color = Navy;
extern color PrevWeek_Color_W1chart = DeepSkyBlue;

extern color CurrWeek_Color = MediumVioletRed;
extern color CurrWeek_Color_W1chart = DeepPink;

extern string Main_Chart_Moving_Average = "Main Chart Moving Average";
extern int MA_Period=336;
extern int MA_Shift=0;
extern int MA_Method=0;

extern string indicator = "Sentinel_indi_Don2";

extern double	EUR = 1.0,	// weights
					JPY = 1.0,
					GBP = 1.0,
					CHF = 1.0,
					CAD = 1.0,
					AUD = 1.0;
extern bool AverageGains = False;
extern bool PipsAsWholeNumbers = True;
extern bool Reverse_Sentinal_On_NonUSDBased = True;
//Sentinel moving average
extern int Sentinel_MA_Value = 336;//<-- Moving average value set to 336 by default
extern int Sentinel_MA_Shift = 0;//<-- Shift for the MA. Set to 0 by default.
extern int Sentinel_MA_Method = 0;//<-- MA Method (0 is SMA, 1 is EMA, 2 is SMMA, 3 is LWMA). Anything above/below these values is set to SMA (0) automatically.

extern bool Alerts_On = False;

extern int TradeCount = 0;//Starts out at 0 at NFP_Start, then after NFP_End, after first trade is taken on pair, TradeCount goes to 1, and no matter how that trade turns out, additional will have true before a new trade can be taken.

//---- Don's Money Management input parameters
extern string DonsMM = "Dons Money Management for Number of Lots";
extern bool  UseDonsMM = True;
extern int RISK_PERCENT  = 4  ;

//---- buffers
double MainChart_MA[];

int init()
{
IndicatorBuffers(1);

SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,MainChart_MA);
SetIndexEmptyValue(0,0.0);
   
   //----------------------- ADJUST LOTS IF USING MONEY MANAGEMENT
   if (UseDonsMM == False) {
   Lots = Lots ;
   } else if (UseDonsMM == True) {
   Lots = NormalizeDouble(((AccountBalance()*(RISK_PERCENT*0.01))/(StopLoss*(MarketInfo(Symbol(),MODE_TICKVALUE)))),2) ;
   }

return(0);
}

int deinit()
{

// all objects are removed from the chart.
ObjectsDeleteAll();             

//EMPTY COMMENTS
Comment("");
   
return(0);
}

//datetime StartTime;

int start()
{
   
//-----------------------------------------------------------------------------------------------------------------------------
   
   //WE FIRST HAVE TO DO SOME DEFINITIONS BEFORE WE CAN DRAW ANY OBJECTS ON CHART FOR THIS MONTH
   int OneSecond = 1;
   int OneMinute = 60*OneSecond;
   int OneHour = 60*OneMinute;
   int OneDay = 24*OneHour;
   int OneWeek = 7*OneDay;
   
   int limit;
   int bar;
   int counted_bars = IndicatorCounted();
   //---- check for possible errors
   if (counted_bars<0) return(-1);
   //---- last counted bar will be recounted 
   if (counted_bars>0) counted_bars--;
   limit = Bars - counted_bars;
   
   for(int i=limit; i>=0; i--) {
      
      datetime CurrBarOpenTime = iTime(NULL,0,i);
      int CurrBar = iBarShift( NULL, 0, CurrBarOpenTime, true);
      double CurrBarClose = iClose(NULL,0,i);
      
      /*
      //NFP cooling-off period Open Time
      if (Day() <= 7 && DayOfWeek() == 5) {
      //if day of month is less than or equal to 7 and also equal to 5 (Friday)...
      datetime NFP_StartTime=StrToTime(TimeYear(TimeCurrent())+"."+TimeMonth(TimeCurrent())+"."+StartDate+" "+15+":"+30+":"+00);//this is the Day for the NFP start (when NFP is released)
      }
      */
      
      //NFP cooling-off period Open Time
   //Define the year to use in NFP_StartTime
   int year=TimeYear(TimeCurrent());
   
   //Define the month to use in NFP_StartTime
   int month=TimeMonth(TimeCurrent());
   
   //Define the Start Date to use in NFP_StartTime. Which Date, 1-7, is the first Friday of the month?
   datetime DayOfMonthIs1;
   datetime DayOfMonthIs2;
   datetime DayOfMonthIs3;
   datetime DayOfMonthIs4;
   datetime DayOfMonthIs5;
   datetime DayOfMonthIs6;
   datetime DayOfMonthIs7;
   
   DayOfMonthIs1 = StrToTime(year+"."+month+"."+1);
   DayOfMonthIs2 = StrToTime(year+"."+month+"."+2);
   DayOfMonthIs3 = StrToTime(year+"."+month+"."+3);
   DayOfMonthIs4 = StrToTime(year+"."+month+"."+4);
   DayOfMonthIs5 = StrToTime(year+"."+month+"."+5);
   DayOfMonthIs6 = StrToTime(year+"."+month+"."+6);
   DayOfMonthIs7 = StrToTime(year+"."+month+"."+7);

   int StartDate;
   if (TimeDay(DayOfMonthIs1) == 1 && TimeDayOfWeek(DayOfMonthIs1) == 5) StartDate = 1;
   if (TimeDay(DayOfMonthIs2) == 2 && TimeDayOfWeek(DayOfMonthIs2) == 5) StartDate = 2;
   if (TimeDay(DayOfMonthIs3) == 3 && TimeDayOfWeek(DayOfMonthIs3) == 5) StartDate = 3;
   if (TimeDay(DayOfMonthIs4) == 4 && TimeDayOfWeek(DayOfMonthIs4) == 5) StartDate = 4;
   if (TimeDay(DayOfMonthIs5) == 5 && TimeDayOfWeek(DayOfMonthIs5) == 5) StartDate = 5;
   if (TimeDay(DayOfMonthIs6) == 6 && TimeDayOfWeek(DayOfMonthIs6) == 5) StartDate = 6;
   if (TimeDay(DayOfMonthIs7) == 7 && TimeDayOfWeek(DayOfMonthIs7) == 5) StartDate = 7;
   
   //Define the NFP_StartTime, using the year, month, StartDate above, with predefined hours NFP is released
   datetime NFP_StartTime;
   NFP_StartTime=StrToTime(year+"."+month+"."+StartDate+" "+15+":"+30+":"+00);
      
      //Shift start to the right (forward) one week (to the second Friday) if external boolean Shift_ThisNFPStart_OneWeek == true
      if (NFPStart_ShiftOneWeek == true) {
      NFP_StartTime=NFP_StartTime+OneWeek;
      }
   
      //NFP cooling-off period Open Bar
      int NFPStartBar = iBarShift( NULL, 0, NFP_StartTime, true);//Get the bar, on the current chart, that MT4 gives, with the time given
      //NFP cooling-off period Open Bar Open Time
      datetime NFPStartBar_OpenTime = iTime(NULL,0,NFPStartBar);//Go back and get the open time of that bar, on the current chart
      
      //If Time now is passed the NFP_StartTime (defined by either automatic or user inputs), create a vertical line marking it on the chart
      if (TimeCurrent() >= NFPStartBar_OpenTime) {
      ObjectCreate("NFPStart_OpenBar", OBJ_VLINE, 0, NFPStartBar_OpenTime,0);
      ObjectSet("NFPStart_OpenBar", OBJPROP_COLOR, DuringNFP_NoTradeZone_Color );
      }

      //NFP cooling-off period Close Time
      //From when NFP released at 7:30 (my time = Central time), define the NFP_EndTime by counting forward the rest of Friday 8 hours and 30 minutes (to 4PM Central Time), 2 days for the weekend, plus 7 hours from when the market open at 4PM Central time to 11PM Sunday night Central Time.
      int NFP_EndTime = NFP_StartTime + ( ((8*OneHour)+(30*OneMinute)) + (2*OneDay) + (7*OneHour) );
      
      //NFP cooling-off period Close Bar
      int NFPCloseBar = iBarShift( NULL, 0, NFP_EndTime, true)+1;//Get the bar, on the current chart, that MT4 gives, with the time given, and add one to move back one bar
      //NFP cooling-off period Close Bar Open Time
      datetime NFPCloseBar_OpenTime = iTime(NULL,0,NFPCloseBar);//Go back and get the open time of that bar, on the current chart, to make sure there is no discrepancy between the bar we need to get and the one we did get
      
      //NFP cooling-off period Close Bar
      //If Time now is passed the NFP_EndTime (end of NFP cooling off period, defined by either automatic or user inputs), create a vertical line marking it on the chart
      if (TimeCurrent() >= NFPCloseBar_OpenTime) {
      ObjectCreate("RealNFPEnd_CloseBar", OBJ_VLINE, 0, NFPCloseBar_OpenTime,0);
      ObjectSet("RealNFPEnd_CloseBar", OBJPROP_COLOR, DuringNFP_NoTradeZone_Color );
      }
      
      //Highest High and Lowest Low of NFP cooling-off period
      //From the NFP Start Bar to NFP End Bar calcualated above, get the highest high price and lowest low price from that period of time
      double NFP_HighestHigh = High[iHighest(NULL,0,MODE_HIGH,(NFPStartBar-NFPCloseBar),NFPCloseBar)];
      double NFP_LowestLow = Low[iLowest(NULL,0,MODE_LOW,(NFPStartBar-NFPCloseBar),NFPCloseBar)];
      
      //NFP cooling-off period Highest High and Lowest Low
      //If Time now is passed the NFP_EndTime (end of NFP cooling off period, defined by either automatic or user inputs), create a horizontal line marking the NFP cooling-off period's highest high, a horizontal line marking the NFP cooling-off period's lowest low, a rectangle for the no-trade zone during NFP cooling-off period, and a rectangle marking the same no-trade zone after the NFP cooling-off period
      if (TimeCurrent() >= NFPStartBar_OpenTime) {
      ObjectCreate("NFP_HighestHigh", OBJ_HLINE, 0, 0, NFP_HighestHigh );
      ObjectSet("NFP_HighestHigh", OBJPROP_COLOR, DuringNFP_NoTradeZone_Color );
      ObjectCreate("NFP_LowestLow", OBJ_HLINE, 0, 0, NFP_LowestLow );
      ObjectSet("NFP_LowestLow", OBJPROP_COLOR, DuringNFP_NoTradeZone_Color );
      }
   
      if (TimeCurrent() >= NFPStartBar_OpenTime && TimeCurrent() <= NFPCloseBar_OpenTime) {
      ObjectCreate("DuringNFP_NoTradeZone", OBJ_RECTANGLE, 0, NFPStartBar_OpenTime, NFP_HighestHigh, TimeCurrent(), NFP_LowestLow );
      ObjectSet("DuringNFP_NoTradeZone", OBJPROP_COLOR, DuringNFP_NoTradeZone_Color );
      } else if (TimeCurrent() > NFPStartBar_OpenTime && TimeCurrent() > NFPCloseBar_OpenTime) {
      ObjectCreate("DuringNFP_NoTradeZone", OBJ_RECTANGLE, 0, NFPStartBar_OpenTime, NFP_HighestHigh, NFPCloseBar_OpenTime, NFP_LowestLow );
      ObjectSet("DuringNFP_NoTradeZone", OBJPROP_COLOR, DuringNFP_NoTradeZone_Color );
      }
      
      //Start Trading Bar
      int StartTradingBar = iBarShift( NULL, 0, NFP_EndTime, true);//What MT4 designated as our NFPCloseBar is actually the bar we want to start trading on.
      //Start Trading Bar Open Time
      datetime StartTradingBar_OpenTime = iTime(NULL,0,StartTradingBar);//Go back and get the open time of that bar, on the current chart
      
      if (TimeCurrent() >= StartTradingBar_OpenTime) {
      ObjectCreate("StartTrading_OpenBar", OBJ_VLINE, 0, StartTradingBar_OpenTime,0);
      ObjectSet("StartTrading_OpenBar", OBJPROP_COLOR, StartTrading_Color);
      ObjectCreate("AfterNFP_NoTradeZone", OBJ_RECTANGLE, 0, StartTradingBar_OpenTime, NFP_HighestHigh, TimeCurrent(), NFP_LowestLow );
      ObjectSet("AfterNFP_NoTradeZone", OBJPROP_COLOR, AfterNFP_NoTradeZone_Color );
      }
      
      //Previous Week Open Time
      datetime PrevWeekOpenTime = iTime(NULL,PERIOD_W1,1);
      //Previous Week Open Bar
      int PrevWeekOpenBar = iBarShift( NULL, 0, PrevWeekOpenTime, false)-1;//Get the bar, on the current chart, that MT4 gives, with the time given, and subtract 1 bar, because this is the bar we actually want to start possibility of trading
      //Previous Week Open Bar Open Time
      datetime PrevWeekOpenBar_OpenTime = iTime(NULL,0,PrevWeekOpenBar);//Go back and get the open time of that bar, on the current chart, to make sure there is no discrepancy between the bar we need to get and the one we did get
      
      ObjectCreate("PrevWeek_RealOpenBar", OBJ_VLINE, 0, PrevWeekOpenBar_OpenTime,0);
      ObjectSet("PrevWeek_RealOpenBar", OBJPROP_COLOR, PrevWeek_Color );
      ObjectSet("PrevWeek_RealOpenBar", OBJPROP_STYLE, OBJPROP_STYLE );
      
      //Previous Week Close Time
      datetime PrevWeekCloseTime = iTime(NULL,PERIOD_W1,0);
      //Previous Week Close Bar
      int PrevWeekCloseBar = iBarShift( NULL, 0, PrevWeekCloseTime, false);//What MT4 designated as our Previous Week Close Bar is actually the bar we want to start trading on.
      //Previous Week Close Bar Open Time
      datetime PrevWeekCloseBar_OpenTime = iTime(NULL,0,PrevWeekCloseBar);//Go back and get the open time of that bar, on the current chart, to make sure there is no discrepancy between the bar we need to get and the one we did get
      
      ObjectCreate("PrevWeekCloseBar", OBJ_VLINE, 0, PrevWeekCloseBar_OpenTime,0);
      ObjectSet("PrevWeekCloseBar", OBJPROP_COLOR, PrevWeek_Color );
      ObjectSet("PrevWeekCloseBar", OBJPROP_STYLE, OBJPROP_STYLE );
   
      //Previous Week Highest High and Lowest Low
      double PrevWeek_HighestHigh = High[iHighest(NULL,0,MODE_HIGH,(PrevWeekOpenBar-PrevWeekCloseBar),PrevWeekCloseBar)];
      double PrevWeek_LowestLow = Low[iLowest(NULL,0,MODE_LOW,(PrevWeekOpenBar-PrevWeekCloseBar),PrevWeekCloseBar)];
      
      ObjectCreate("PrevWeek_HighPrice", OBJ_HLINE, 0, 0, PrevWeek_HighestHigh );
      ObjectSet("PrevWeek_HighPrice", OBJPROP_COLOR, PrevWeek_Color );
      ObjectSet("PrevWeek_HighPrice", OBJPROP_STYLE, OBJPROP_STYLE );  
   
      ObjectCreate("PrevWeek_LowPrice", OBJ_HLINE, 0, 0, PrevWeek_LowestLow );
      ObjectSet("PrevWeek_LowPrice", OBJPROP_COLOR, PrevWeek_Color );
      ObjectSet("PrevWeek_LowPrice", OBJPROP_STYLE, OBJPROP_STYLE );
   
      ObjectCreate("PrevWeek_LowToHigh", OBJ_RECTANGLE, 0, PrevWeekOpenBar_OpenTime, PrevWeek_HighestHigh, PrevWeekCloseBar_OpenTime, PrevWeek_LowestLow );
      ObjectSet("PrevWeek_LowToHigh", OBJPROP_COLOR, PrevWeek_Color );
      
      //CurrentWeek Open Time
      datetime CurrWeekOpenTime = iTime(NULL,PERIOD_W1,0);
      //CurrentWeek Open Bar
      int CurrWeekOpenBar = iBarShift( NULL, 0, CurrWeekOpenTime, false)-1;//Get the bar, on the current chart, that MT4 gives, with the time given, and subtract 1 bar, because this is the bar we actually want to start possibility of trading
      //CurrentWeek Open Bar Open Time
      datetime CurrWeekOpenBar_OpenTime = iTime(NULL,0,CurrWeekOpenBar);//Go back and get the open time of that bar, on the current chart, to make sure there is no discrepancy between the bar we need to get and the one we did get
      
      ObjectCreate("CurrWeek_RealOpenBar", OBJ_VLINE, 0, CurrWeekOpenBar_OpenTime,0);
      ObjectSet("CurrWeek_RealOpenBar", OBJPROP_COLOR, CurrWeek_Color );
      ObjectSet("CurrWeek_RealOpenBar", OBJPROP_STYLE, OBJPROP_STYLE );
   
      //CurrentWeek Close Time
      datetime CurrWeekCloseTime = iTime(NULL,0,1);
      //CurrentWeek Close Bar
      int CurrWeekCloseBar = iBarShift( NULL, 0, CurrWeekCloseTime, false);//What MT4 designated as our CurrentWeek Close Bar is actually the bar we want to start trading on.
      //CurrentWeek Open Bar Open Time
      datetime CurrWeekCloseBar_OpenTime = iTime(NULL,0,CurrWeekCloseBar);//Go back and get the open time of that bar, on the current chart, to make sure there is no discrepancy between the bar we need to get and the one we did get
      
      ObjectCreate("CurrWeek_RealCloseBar", OBJ_VLINE, 0, CurrWeekCloseBar_OpenTime,0);
      ObjectSet("CurrWeek_RealCloseBar", OBJPROP_COLOR, CurrWeek_Color );
      ObjectSet("CurrWeek_RealCloseBar", OBJPROP_STYLE, OBJPROP_STYLE );
      
      //CurrentWeek Highest High and Lowest Low
      double CurrWeek_HighestHigh = High[iHighest(NULL,0,MODE_HIGH,(CurrWeekOpenBar-CurrWeekCloseBar),CurrWeekCloseBar)];
      double CurrWeek_LowestLow = Low[iLowest(NULL,0,MODE_LOW,(CurrWeekOpenBar-CurrWeekCloseBar),CurrWeekCloseBar)];
      
      ObjectCreate("CurrWeek_HighPrice", OBJ_HLINE, 0, 0, CurrWeek_HighestHigh );
      ObjectSet("CurrWeek_HighPrice", OBJPROP_COLOR, CurrWeek_Color );
      ObjectSet("CurrWeek_HighPrice", 7, OBJPROP_STYLE );

      ObjectCreate("CurrWeek_LowPrice", OBJ_HLINE, 0, 0, CurrWeek_LowestLow );
      ObjectSet("CurrWeek_LowPrice", OBJPROP_COLOR, CurrWeek_Color );
      ObjectSet("CurrWeek_LowPrice", OBJPROP_STYLE, OBJPROP_STYLE );

      ObjectCreate("CurrWeek_LowToHigh", OBJ_RECTANGLE, 0, CurrWeekOpenBar_OpenTime, CurrWeek_HighestHigh, iTime(NULL,0,1), CurrWeek_LowestLow );
      ObjectSet("CurrWeek_LowToHigh", OBJPROP_COLOR, CurrWeek_Color );
      
      //Main chart moving average
      MainChart_MA[i] = iMA(NULL,0,MA_Period,0,MA_Method,PRICE_CLOSE,i+MA_Shift);
      
      //Zero out TradeCount at new NFP Start
      if (TimeCurrent() == NFPStartBar_OpenTime) {
      TradeCount = 0;
      }
      
      /*
      
      //Sentinel, in separate indicator window, with moving average
      double Sentinel = iCustom(NULL, 0, "Sentinel_indi_Don4",EUR,JPY,GBP,CHF,CAD,AUD,AverageGains,PipsAsWholeNumbers,Reverse_Sentinal_On_NonUSDBased,Sentinel_MA_Value,Sentinel_MA_Shift,Sentinel_MA_Method,0,  0);
      double Sentinel_MA = iCustom(NULL, 0, "Sentinel_indi_Don4",EUR,JPY,GBP,CHF,CAD,AUD,AverageGains,PipsAsWholeNumbers,Reverse_Sentinal_On_NonUSDBased,Sentinel_MA_Value,Sentinel_MA_Shift,Sentinel_MA_Method,1,  0);
      
      //Alerts
      if (Alerts_On == True) {
      if(TradeCount == 0) {
      if ( TimeCurrent() > NFP_EndTime && CurrBarClose > NFP_HighestHigh && Sentinel > Sentinel_MA && CurrBarClose > MainChart_MA[i] ) Alert("Buy ", Symbol(),CurrBarClose,"!!!");
      } else if (TradeCount > 0) {
      if ( TimeCurrent() > NFP_EndTime && CurrBarClose > NFP_HighestHigh && Sentinel > Sentinel_MA && CurrBarClose > MainChart_MA[i] && CurrBarClose > CurrWeek_HighestHigh && CurrBarClose > PrevWeek_HighestHigh )  Alert("Buy Again ", Symbol(),CurrBarClose,"!!!");
      }
      }
   
      if (Alerts_On == True) {
      if(TradeCount == 0) {
      if ( TimeCurrent() > NFP_EndTime && CurrBarClose < NFP_LowestLow && Sentinel < Sentinel_MA && CurrBarClose < MainChart_MA[i] ) Alert("Sell ", Symbol(),CurrBarClose,"!!!");
      } else if (TradeCount > 0) {
      if ( TimeCurrent() > NFP_EndTime && CurrBarClose < NFP_LowestLow && Sentinel < Sentinel_MA && CurrBarClose < MainChart_MA[i] && CurrBarClose < CurrWeek_LowestLow && CurrBarClose < PrevWeek_LowestLow ) Alert("Sell Again ", Symbol(),CurrBarClose,"!!!");
      }
      }
      
      */
      
      // strings below used for comments, concerning NFP Start Bar, NFP End Bar, Start Trading Bar, Previous Week Open Bar,
      // Previous Week Close Bar, Current Week Open Bar, Current Week Close Bar, and Current Bar characteritics
      string value1 = NFPStartBar;  
      string value2 = TimeToStr(NFPStartBar_OpenTime,TIME_DATE|TIME_MINUTES);
      string value3 = NFPCloseBar;
      string value4 = TimeToStr(NFPCloseBar_OpenTime,TIME_DATE|TIME_MINUTES);
      string value5 = StartTradingBar;
      string value6 = TimeToStr(StartTradingBar_OpenTime,TIME_DATE|TIME_MINUTES);
      string value7 = PrevWeekOpenBar;
      string value8 = TimeToStr(PrevWeekOpenBar_OpenTime,TIME_DATE|TIME_MINUTES);
      string value9 = PrevWeekCloseBar;
      string value10 = TimeToStr(PrevWeekCloseBar_OpenTime,TIME_DATE|TIME_MINUTES);
      string value11 = CurrWeekOpenBar;
      string value12 = TimeToStr(CurrWeekOpenBar_OpenTime,TIME_DATE|TIME_MINUTES);
      string value13 = CurrWeekCloseBar;
      string value14 = TimeToStr(CurrWeekCloseBar_OpenTime,TIME_DATE|TIME_MINUTES);
      string value15 = CurrBar;
      string value16 = TimeToStr(CurrBarOpenTime,TIME_DATE|TIME_MINUTES);
      string value17 = TimeToStr(TimeLocal() );
      string value18 = TimeToStr(TimeCurrent() );
   
      if (Symbol() == "USDJPY") {
      string value19 = DoubleToStr(PrevWeek_HighestHigh,2);
      string value20 = DoubleToStr(PrevWeek_LowestLow,2);
      string value21 = DoubleToStr(CurrWeek_HighestHigh,2);
      string value22 = DoubleToStr(CurrWeek_LowestLow,2);
      string value29 = DoubleToStr(Ask - StopLoss * Point,2);
      string value30 = DoubleToStr(Ask + TakeProfit * Point,2);
      string value31 = DoubleToStr(Bid + StopLoss * Point,2);
      string value32 = DoubleToStr(Bid - TakeProfit * Point,2);
      } else {
      value19 = DoubleToStr(PrevWeek_HighestHigh,4);
      value20 = DoubleToStr(PrevWeek_LowestLow,4);
      value21 = DoubleToStr(CurrWeek_HighestHigh,4);
      value22 = DoubleToStr(CurrWeek_LowestLow,4);
      value29 = DoubleToStr(Ask - StopLoss * Point,4);
      value30 = DoubleToStr(Ask + TakeProfit * Point,4);
      value31 = DoubleToStr(Bid + StopLoss * Point,4);
      value32 = DoubleToStr(Bid - TakeProfit * Point,4);
      }
   
      string value23=DoubleToStr(Lots, 2);
      
      string value24;
   
      if(Lots >= 1) {
      value24= "Standard lots";
      } else if(Lots < 1) {
      value24= "Mini lots";
      } else if(Lots < 0.1) {
      value24= "Micro lots";
      }
   
      int value25;
   
      if (Lots >= 1) {
      value25 = Lots*1;
      }else if (Lots < 1) {
      value25 = Lots*10;
      } else if (Lots < 0.1) {
      value25 = Lots*100;
      }
   
      string value26 = DoubleToStr(AccountBalance(),2);   
      string value27 = DoubleToStr(MarketInfo(Symbol(),MODE_TICKVALUE),2);   
      string value28 = DoubleToStr((MarketInfo(Symbol(),MODE_TICKVALUE)*Lots),2);
      
      if (ShowComments == true) {
      Comment (
      // Comments below concerning Last NFP Start Bar, Last NFP End Bar, Last Start Trading Bar, NFP Start Bar, NFP End Bar, Start Trading Bar, Previous Week Open Bar,
      // Previous Week Close Bar, Current Week Open Bar, Current Week Close Bar, and Current Bar characteritics
      "NFP_OpenBar = " + value1 + ", (open) Time = " + value2 + "\n" +
      "NFP_CloseBar = " + value3 + ", (open) Time = " + value4 + "\n" +
      "StartTradingBar = " + value5 + ", (open) Time = " + value6 + "\n" +
      "PrevWeek_OpenBar = " + value7 + ", (open) Time = " + value8 + "\n" +
      "PrevWeek_CloseBar = " + value9 + ", (open) Time = " + value10 + "\n" +
      "PrevWeek_ThisChart_HighestHigh = " + value19 + ", PrevWeek_ThisChart_LowestLow = " + value20 + "\n" +
      "CurrWeek_OpenBar = " + value11 + ", (open) Time = " + value12 + "\n" +
      "CurrWeek_CloseBar = " + value13 + ", (open) Time = " + value14 + "\n" +
      "CurrWeek_ThisChart_HighestHigh = " + value21 + ", CurrWeek_ThisChart_LowestLow = " + value22 + "\n" +
      "CurrBar = " + value15 + ", (open) Time = " + value16 + "\n" +
      "Don Money Management: (Account Balance x (Risk Percent Per Trade x 0.01)) / (Stop Loss x Tick Value)" + "\n" +
      "Account Balance = " + value26 + "\n" +
      "Risk Percent Per Trade = " + RISK_PERCENT + " %" + "\n" +
      "Stop Loss = " + StopLoss + "\n" +
      "Buy Stop Loss Level = " + value29 + "\n" +
      "Buy Take Profit Level = " + value30 + "\n" +
      "Sell Stop Loss Level = " + value31 + "\n" +
      "Sell Take Profit Level = " + value32 + "\n" +
      "Tick Value = " + value27 + "\n" +
      "Number of Lots to Trade Per Pair = " + value23 + " ( " + value25 + " " + value24 + " )" + " Remember: Remove half position at 50 pips Take Profit" + "\n" +
      "Pip Value = " + value28 + "\n" +
      //"TradeCount = " + TradeCount + "\n" + + " ( " + value81 + " " + value80 + " )" + " Remember: Remove 
      "Server Time = " + value18 + "\n" +
      "Current Time = " + value17
      );
      }
      
   }
   
return(0);
}
//+------------------------------------------------------------------+
//Custom Function
//void thisNFP(datetime NFP_StartTime , datetime NFP_Endtime , double NFP_Hi , double NFP_Lo , datetime StartTradingtime , double MainChart_MA, double Sentinel, double Sentinel_MA, datetime PrevWk_Starttime , datetime PrevWk_Endtime , double PrevWk_Hi , double PrevWk_Lo , datetime CurrWk_Starttime , datetime CurrWk_Endtime , double CurrWk_Hi , double CurrWk_Lo)
//{
//return;
//}