Exploration Help

I want to extract the records where Closing Price at 18 PM is greater than closing price at 17 PM on intraday chart

Cl = ValueWhen(TimeNum()==170000,C);

C2 = ValueWhen(TimeNum()==180000,C);

A = iif( (Cl2 > C1 ) , 1, 0);

Filter = ( A ==1 );

But it is not giving the desired result. I am keeping filter at 1 minute chart. Kindly help to fix this code.

You have a few problems:

  • You're not using the same variable names throughout. For example you assign CI (the second character is the letter "i"), but then use C1 (the second character is the digit "one") when assigning the variable A. Similarly C2 and CI2 are not the same variable.
  • The assignment of the variable A is completely unnecessary
  • On bars between 5pm and 6pm, your code will compare the current day's 5pm price to the previous day's 6pm price

Try starting with something like this untested snippet:

C1 = ValueWhen(TimeNum()==170000,C);
C2 = ValueWhen(TimeNum()==180000,C);
Filter = C2 > C1 AND
AddColumn(C1, "5pm Close");
AddColumn(C2, "6pm Close");
1 Like

Thanks a lot .I will use this in my code.