Incorrect logic?

 

My indicator is supposed to send alerts/notifications based on 2 timeframes - a lower one, and a higher one, and the alerts are supposed to be made no matter what the 'current' timeframe is.

It was working on previous versions, but now I get no alerts whatsoever...pls help, relevant code below:


bool          upsFlags=false;
bool          dnsFlags=false;
bool          upSignal=false;
bool          dnSignal=false;
bool          upAlerts=false;
bool          dnAlerts=false;

double        ArrowBULL[];
double        ArrowBEAR[];

for(int i=0; i<OfPeriods; i++) TradePerf[i]= StrToTF(TradePeriod[i]);


{
      double ten_sen_uTF1=0;
      double kij_sen_uTF1=0;
      double ten_sen_nTF1=0;
      double kij_sen_nTF1=0;
      double ten_sen_uTF2=0;
      double kij_sen_uTF2=0;

      for(int i = CountBars; i >= 0; i--)
      {
         ArrowBULL[i]= 0;
         ArrowBEAR[i]= 0;

         int y = iBarShift(NULL,TradePerf[1],time[i]);

         ten_sen_uTF2 = iIchimoku(symbolis,TradePerf[1],tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,y);
         kij_sen_uTF2 = iIchimoku(symbolis,TradePerf[1],tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,y);

         ten_sen_uTF1 = iIchimoku(symbolis,TradePerf[0],tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i);
         kij_sen_uTF1 = iIchimoku(symbolis,TradePerf[0],tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i);
         ten_sen_nTF1 = iIchimoku(symbolis,TradePerf[0],tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i+1);
         kij_sen_nTF1 = iIchimoku(symbolis,TradePerf[0],tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i+1);

         if(ten_sen_uTF2 >  kij_sen_uTF2 && upsFlags==false){upsFlags=true;}
         if(ten_sen_uTF2 <= kij_sen_uTF2 && upsFlags==true){upsFlags=false;}

         if(ten_sen_uTF2 <  kij_sen_uTF2 && dnsFlags==false){dnsFlags=true;}
         if(ten_sen_uTF2 >= kij_sen_uTF2 && dnsFlags==true){dnsFlags=false;}

         if(i >= 1)
         {
            if(upsFlags && ten_sen_uTF1 > kij_sen_uTF1 && ten_sen_nTF1 <= kij_sen_nTF1 && upSignal==false)
              {upSignal=true; if(TradePerf[0]==_Period){ArrowBULL[i]= low[i]-(distn /(heigh /(10+ShiftArrow)));}}
            if(!upsFlags && upSignal==true){upSignal=false; ArrowBULL[i]= 0;}

            if(dnsFlags && ten_sen_uTF1 < kij_sen_uTF1 && ten_sen_nTF1 >= kij_sen_nTF1 && dnSignal==false)
              {dnSignal=true; if(TradePerf[0]==_Period){ArrowBEAR[i]= high[i]+(distn /(heigh /(10+ShiftArrow)));}}
            if(!dnsFlags && dnSignal==true){dnSignal=false; ArrowBEAR[i]= 0;}
         }
      }


if(tames != time[0]&&(SendMailInfo||ShowAlert||ShowSound||SendPush))
      {
         if(ArrowBULL[1]!= 0 && upAlerts)
         {
            upAlerts=false;

            if(SendPush)     SendNotification(StringConcatenate(IndAl,"  -  ",symbolis," « BUY: (",TradePeriod[0],"/",TradePeriod[1],") = ",DoubleToStr(close[0],_Digits)," »"));
            if(SendMailInfo) SendMail(StringConcatenate(IndAl,"  -  ",AccountCompany()," ",AccountNumber()," ",symbolis),
                             StringConcatenate(" « BUY: (",TradePeriod[0],"/",TradePeriod[1],") = ",DoubleToStr(close[0],_Digits)," »  ",TimeToStr(TimeCurrent(),TIME_DATE|TIME_MINUTES)));
            if(ShowAlert)    Alert(StringConcatenate(IndAl,"  -  ",symbolis," « BUY: (",TradePeriod[0],"/",TradePeriod[1],") = ",DoubleToStr(close[0],_Digits)," »"));
            if(ShowSound)    PlaySound(SoundNameBull);
                                       tames =(Repeating?0:time[0]);
         }
         if(!upAlerts && ArrowBULL[1]== 0) upAlerts=true;

//——————————————————————————————————————————————————————————————|

         if(ArrowBEAR[1]!= 0 && dnAlerts)
         {
            dnAlerts=false;

            if(SendPush)     SendNotification(StringConcatenate(IndAl,"  -  ",symbolis," « SELL: (",TradePeriod[0],"/",TradePeriod[1],") = ",DoubleToStr(close[0],_Digits)," »"));
            if(SendMailInfo) SendMail(StringConcatenate(IndAl, "  -  ", AccountCompany(), " ", AccountNumber(), " ", Symbol()),
                             StringConcatenate(" « SELL: (",TradePeriod[0],"/",TradePeriod[1],") = ",DoubleToStr(close[0],_Digits)," »  ",TimeToStr(TimeCurrent(),TIME_DATE|TIME_MINUTES)));
            if(ShowAlert)    Alert(StringConcatenate(IndAl,"  -  ",symbolis," « SELL: (",TradePeriod[0],"/",TradePeriod[1],") = ",DoubleToStr(close[0],_Digits)," »"));
            if(ShowSound)    PlaySound(SoundNameBear);
                                    tames =(Repeating?0:time[0]);
         }
         if(!dnAlerts && ArrowBEAR[1]== 0) dnAlerts=true;
      }
   }
   else
   {
      datetime times;
      double tenkan_senValue1=0;
      double kijun_sen_Value1=0;
      double tenkan_senValue2=0;
      double kijun_sen_Value2=0;
 
WTM:

My indicator is supposed to send alerts/notifications based on 2 timeframes - a lower one, and a higher one, and the alerts are supposed to be made no matter what the 'current' timeframe is.

It was working on previous versions, but now I get no alerts whatsoever...pls help, relevant code below:


https://www.mql5.com/en/job

Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • www.mql5.com
Hi  I need to Create a EA based on a indicator , That indicator gives the alert whether buy or sell then the EA need to place according to the signal.  Below options are required  Need to set profit lock with 10 pips  Add MM SL and TP manually customisable .. Bid who can finish it fast , Thanks We discussed a couple of EAS in our last EA...
 
Artem Markevych:

https://www.mql5.com/en/job

No thanks, that doesn't help me learn anything does it...

 

Haha.

You can talk to the developers and they will explain the code to you.

 
Marco vd Heijden:

Haha.

You can talk to the developers and they will explain the code to you.

Isn't that what the forum is for?

 

If you are good at something, never do it for free.

But you can always try of course.

 
Marco vd Heijden:

If you are good at something, never do it for free.

But you can always try of course.

Rrrrrright, I guess you don't understand the concept of a forum then?

Why is there a forum when everyone should just pay for information?

 

Because it's possible.

If it wasn't possible it would not be here.

 
Marco vd Heijden:

Because it's possible.

If it wasn't possible it would not be here.

Clearly you don't understand the function of one though...

Which is worrying as you're the moderator of one :/

 

I have a good memory.

And there are many things that we do not understand.

We know how to use them but nobody knows what really makes them tick.

And i don't think it's important to know.

It would be nice to know, but not really necessary. 
 
Marco vd Heijden:

I have a good memory.

And there are many things that we do not understand.

We know how to use them but nobody knows what really makes them tick.

And i don't think it's important to know.

Maybe you don't, but others like to learn things for themselves, or discuss with others to learn, hence the existence of forums...

Reason: