Help with logic in my code?

 

I have nearly finished my EA (with a huge thanks to some really helpful people on here!). None the less, I am sure there will be plenty of more stuff along the way - just evolution, which is expected.

Anyway, this is my hurdle:

I use this code:

  ... Similar "if" statements above, relative to iMA's on daily and 4 hour time frames for confluence.

 // Check for Moving Averages Fanned up on H1, creating an UP bias.
   if(D1_Bias=="Daily is Up" && H4_Bias=="4 Hour is Up" && H1_Bias=="None")
      if(CurrentSmallFish1>CurrentSmallFish2)
         if(CurrentSmallFish2>CurrentSmallFish3)
            if(CurrentSmallFish3>CurrentSmallFish4)
               if(CurrentSmallFish4>CurrentSmallFish5)
                  if(CurrentSmallFish5>CurrentSmallFish6)
                     if(CurrentSmallFish6>CurrentBigFish1)
                        if(CurrentBigFish1>CurrentBigFish2)
                           if(CurrentBigFish2>CurrentBigFish3)
                              if(CurrentBigFish3>CurrentBigFish4)
                                 if(CurrentBigFish4>CurrentBigFish5)
                                    if(CurrentBigFish5>CurrentBigFish6)
                                       {
                                       triggerBarTime=Time[1];
                                       H1_Bias="H1 is Up";
                                       Comment("Bias is: "+H1_Bias+" since: "+TimeToStr(triggerBarTime,TIME_DATE|TIME_MINUTES));
                                       H4_Bias="4 Hour is Up";
                                       Comment("Bias is: "+H4_Bias+" since: "+TimeToStr(H4_Bar,TIME_DATE|TIME_MINUTES));
                                       D1_Bias="Daily is Up";
                                       Comment("Bias is: "+D1_Bias+" since: "+TimeToStr(D1_Bar,TIME_DATE|TIME_MINUTES));
                                       }
   
   
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////   

   H1_low  = iLow(NULL, PERIOD_H1, 1);
   H1_close = iClose(NULL, PERIOD_H1, 1);
   if(H1_Bias=="H1 is Up" && H4_Bias=="4 Hour is Up" && D1_Bias=="Daily is Up" && H1_low <= ema21 && H1_close > CurrentBigFish6) <<<<<<<<<<<< -- LONG IF STATEMENT ;)
      {
      H1_Buy_Touch = "H1 Buy Touch";
         {
         OrderEntry(0); // Pending order Buy Stop function is called.
         }
      }

Which gives me "OrderEntry(0)" = Buy signal. HOWEVER, you will see that "H1_low <= ema21" is within that long "if" statement. THAT individual bar that meets the criteria "H1_low <= ema21" can also be the exact same bar of "triggerBarTime=Time[1]".

What I am wanting is for the code to IGNORE the very first bar "triggerBarTime=Time[1]" where the MA's first fann up, and instead, WAIT after that for a bar to be: "H1_low <= ema21" for the "OrderEntry(0)" to be called :)

 
Any ideas :)
 
bump.
 
DomGilberto:


What I am wanting is for the code to IGNORE the very first bar "triggerBarTime=Time[1]" where the MA's first fann up, and instead, WAIT after that for a bar to be: "H1_low <= ema21" for the "OrderEntry(0)" to be called :)

Personally I don't understand this sentence.. esp the first half.
 
ydrol:
Personally I don't understand this sentence.. esp the first half.


Check out this screenshot: http://screencast.com/t/IRUgPPkw

That will explain it all very clearly :)
 
any ideas please?
 
I think I have it figured out - Just done it this way.
   // Check for Moving Averages Fanned up on H1, creating an UP bias.
   if(D1_Bias=="Daily is Up" && H4_Bias=="4 Hour is Up" && H1_Bias=="None")
      if(CurrentSmallFish1>CurrentSmallFish2)
         if(CurrentSmallFish2>CurrentSmallFish3)
            if(CurrentSmallFish3>CurrentSmallFish4)
               if(CurrentSmallFish4>CurrentSmallFish5)
                  if(CurrentSmallFish5>CurrentSmallFish6)
                     if(CurrentSmallFish6>CurrentBigFish1)
                        if(CurrentBigFish1>CurrentBigFish2)
                           if(CurrentBigFish2>CurrentBigFish3)
                              if(CurrentBigFish3>CurrentBigFish4)
                                 if(CurrentBigFish4>CurrentBigFish5)
                                    if(CurrentBigFish5>CurrentBigFish6)
                                       {
                                       triggerBarTime=Time[1];
                                       H1_Bias="H1 is Up";
                                       Comment("Bias is: "+H1_Bias+" since: "+TimeToStr(triggerBarTime,TIME_DATE|TIME_MINUTES));
                                       H4_Bias="4 Hour is Up";
                                       Comment("Bias is: "+H4_Bias+" since: "+TimeToStr(H4_Bar,TIME_DATE|TIME_MINUTES));
                                       D1_Bias="Daily is Up";
                                       Comment("Bias is: "+D1_Bias+" since: "+TimeToStr(D1_Bar,TIME_DATE|TIME_MINUTES));
                                       }
   
   
   
   ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////   

   H1_low  = iLow(NULL, PERIOD_H1, 1);
   H1_close = iClose(NULL, PERIOD_H1, 1);
   if(H1_Bias=="H1 is Up" && H4_Bias=="4 Hour is Up" && D1_Bias=="Daily is Up" && H1_close > CurrentBigFish6)
      {
       
        if(ema21 - H1_low  > -Point)
            {
            PullBack_Bar=Time[1]; // PullBack_Bar is a "datetime"
            }
            if(PullBack_Bar - triggerBarTime > Point / 2.) // If PullBack_Bar is greater in time than the triggerBarTime, then place the order.
                {
                H1_Buy_Touch = "H1 Buy Touch";
                OrderEntry(0); // Pending order Buy Stop function is called.
                }
      }
 
DomGilberto:
any ideas please?


Idea is only one - you should change your stiyle, normal man will not write such code...you should write more simple code...

Terribly !

 
Ok? Now's your chance to enlighten me then lol? If that is a terrible way I have done it, please could you point me in the right direction?
 
DomGilberto:
Ok? Now's your chance to enlighten me then lol? If that is a terrible way I have done it, please could you point me in the right direction?
Sorry, but I have no time for it. There are a lot of books to teach from - this is the very right direction.
 
Wow - ok. Thanks for using your time in telling me how you do not have any time though...

Does anyone else have any time to share? Or at least just enough time to tell me that you do not have any time... (lol)