Search code examples
mql4

How do i restrict arrow showing from a particular date to anothe date?


if(rsiOne_Previous[i]<30 && rsiOne[i]>=30 && Period()==PERIOD_H1)

i used above code to tell the arrow to show only on one-hour chart. it is working fine. Now i will like to get a code to tell it to only show for last two month to present time. Explanation: we are in February, so what i want is that the arrow should only show from November, 2019 to February, 2020. i don't want to the arrow to show from October 2019 to backward date. is there any code to do the following. Thanks in advance.


Solution

  • Compute the date, there are different options to do that. Simplest is possibly to cut last 60 days (if precision is not necessary here). datetime endLoopTime=iTime(_Symbol,PERIOD_D1,0)-60*PeriodSeconds(PERIOD_D1); then do not process or do not draw arrows (do not fill the buffer, in other words) with sth like if(time[i]>=endLoopTime) Buffer[i]=close[i]; where Buffer is the buffer used to draw the indicator arrows.