Loop with variable shift candles

Patrick Michael Appel  

Hello,

Can you please help me to find a solution (which will be, I'm sure, easy for you : but not for me) to code a possibility with an input parameter, to choice on how much candles I will work back. A loop, something so ?

For example, I have this for an buy order :

   if(

   RSI2[0] > RSI_Filter_Limit

   && RSI2[0] < (100-RSI_Filter_Limit) 

   && RSI2[1] > RSI_Filter_Limit

   && RSI2[1] < (100-RSI_Filter_Limit) 

   && RSI2[2] > RSI_Filter_Limit 

   && RSI2[2] < (100-RSI_Filter_Limit) 

   && RSI2[3] > RSI_Filter_Limit 

   && RSI2[3] < (100-RSI_Filter_Limit) 

   && RSI2[4] > RSI_Filter_Limit

   && RSI2[4] < (100-RSI_Filter_Limit) 

   && RSI2[5] > RSI_Filter_Limit

   && RSI2[5] < (100-RSI_Filter_Limit))

So, I want to choice, with an input on how much candles I test this same condition back.

For example, the same condition RSI > Filter and RSI <100-Filer, but until shift 10 or more...

I hope my problem is well explained.

Thank you so much for your help :)

Alexey Petrov  

Quelque chose comme ça, si je te comprends bien

input int=candles;
....
  {
//---
for(int i=0;i<candles-1;i++)
  {
   if(RSI2[i] > RSI_Filter_Limit)
     {
      ....
     }
  }