How to cross check actual values my EA is assessing?

 

Hi folks,

How can I double check the values my EA is assessing. Because when I do it manually my EA seems to be missing signals, so I'm trying to see what it is comparing, so that I can adjust my code accordingly.

1) I am asking it to tell  me when RSI crosses and closes above 50 on the 4H chart (eg 2pm-6pm 4H candle crosses RSI 50 level)

2) and also to check the last 1H candle making up the 4H candle is above 50 (eg the 5pm-6pm candle).

Many thanks for any info/guidance offered.

Simon

 

If the EA is checking only on the close of the H4 bar, then print the values that the EA is using. There will not be that many prints.

Make sure that you are checking the value for the closed bar, not the newly opened bar as when you look at the chart later, the values will not be the same.

 
Keith Watford:

If the EA is checking only on the close of the H4 bar, then print the values that the EA is using. There will not be that many prints.

Make sure that you are checking the value for the closed bar, not the newly opened bar as when you look at the chart later, the values will not be the same.

Hi Keith,

It is actually giving me the close of the 1H 2pm candle. When the 4H 2pm candle closes (2pm to 6pm). 
When in fact i want the 1H 5pm close (5pm to 6pm candle).

I read that possibly the iBarShift function might help???

Simon
 
Simyc135: When the 4H 2pm candle closes (2pm to 6pm). When in fact i want the 1H 5pm close (5pm to 6pm candle).

I read that possibly the iBarShift function might help???

  1. You read that possibly X might help? If you read it you should know.
  2. If the H4 just closed, then the previous candle is shift one. If the H4 just closed, the H1 candle (5pm) also just closed. It is also shift one. Get the RSI for both time frames. What's the problem?
  3. Show us your code, otherwise we can only guess.
  4. Don't double post!  You already had this thread open.
              General rules and best pratices of the Forum. - General - MQL5 programming forum
 
Simyc135:

Your posts in the other topic have been deleted.

 
William Roeder:
  1. You read that possibly X might help? If you read it you should know.
  2. If the H4 just closed, then the previous candle is shift one. If the H4 just closed, the H1 candle (5pm) also just closed. It is also shift one. Get the RSI for both time frames. What's the problem?
  3. Show us your code, otherwise we can only guess.
  4. Don't double post!  You already had this thread open.
              General rules and best pratices of the Forum. - General - MQL5 programming forum
Hi William,

Still getting my bearings with the forum its rules not to mention programming. 
This is the code
//--- main loop

   for(int i = limit-1; i >= 0; i--)

     {

      if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation   

      //Indicator Buffer 1

      if(iRSI(NULL, PERIOD_H4, 14, PRICE_CLOSE, i) > 50

      && iRSI(NULL, PERIOD_H4, 14, PRICE_CLOSE, i+1) < 50 //Relative Strength Index crosses above fixed value

      && iRSI(NULL, PERIOD_H1, 14, PRICE_CLOSE, i) > 50 //Relative Strength Index > fixed value

      )

        {

         Buffer1[i] = iLow(NULL, PERIOD_H4, i) - 200 * Point(); //Set indicator value at Candlestick Low - fixed value

         if(i == 1 && Time[1] != time_alert) myAlert("indicator", "Buy"); //Alert on next bar open

         time_alert = Time[1];

        }

      else

        {

         Buffer1[i] = 0;

        }

      //Indicator Buffer 2

      if(iRSI(NULL, PERIOD_H4, 14, PRICE_CLOSE, i) < 50

      && iRSI(NULL, PERIOD_H4, 14, PRICE_CLOSE, i+1) > 50 //Relative Strength Index crosses below fixed value

      && iRSI(NULL, PERIOD_H1, 14, PRICE_CLOSE, i) < 50 //Relative Strength Index < fixed value

      )

        {

         Buffer2[i] = iHigh(NULL, PERIOD_H4, i) + 200 * Point(); //Set indicator value at Candlestick High + fixed value

         if(i == 1 && Time[1] != time_alert) myAlert("indicator", "Sell"); //Alert on next bar open

         time_alert = Time[1];

        }

      else

        {

         Buffer2[i] = 0;

        }

     }

The problem as described above  is actually giving me the close of the 1H 2pm candle. When the 4H 2pm candle closes (2pm to 6pm). 

When in fact i want the 1H 5pm close (5pm to 6pm candle)

Having read about iBarShift i think it might help, by using it to help get the iRSI value on the 1H chart, though as a newbie I'm not that sure of how to apply it, hence my asking about it. 

So I'm off to sit and try to incorporate it into the code above to see if it helps.

Simon

 
Simyc135: Still getting my bearings with the forum its rules not to mention programming.
  1. Don't double post! You already had this thread open.
              General rules and best pratices of the Forum. - General - MQL5 programming forum

  2. Please edit your post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  3.  for(int i = limit-1; i >= 0; i--){
    
          if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation   
    
          //Indicator Buffer 1
    
          if(iRSI(NULL, PERIOD_H4, 14, PRICE_CLOSE, i) > 50
    Delete that garbage line and Do your lookbacks correctly.
  4. You are mixing apples and oranges. Code breaks in not on the H4 chart. If you want a MTF indicator, you must reprocess all source bar zero values to get the stair step effect, (one source bar, multiple chart bars.)
              How to do your lookbacks correctly № 9 through #14.

  5. On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors before accessing prices.
              Download history in MQL4 EA - Forex Calendar - MQL4 and MetaTrader 4 - MQL4 programming forum - Page 3 № 26
 
William Roeder:
  1. Don't double post! You already had this thread open.
              General rules and best pratices of the Forum. - General - MQL5 programming forum

  2. Please edit your post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  3. Delete that garbage line and Do your lookbacks correctly.
  4. You are mixing apples and oranges. Code breaks in not on the H4 chart. If you want a MTF indicator, you must reprocess all source bar zero values to get the stair step effect, (one source bar, multiple chart bars.)
              How to do your lookbacks correctly № 9 through #14.

  5. On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors before accessing prices.
              Download history in MQL4 EA - Forex Calendar - MQL4 and MetaTrader 4 - MQL4 programming forum - Page 3 № 26

HI William,

Many Many thanks, it would seem I have lots more homework to do, and I do really appreciate your guidance cheers.


Simon

 
Simyc135:

Your other topic has been deleted.

Reason: