Pi code needed

I am a Newbie …Could you please share the code for the following logic …

I have two candles say candle1 and candle2 …My aim is find our inside out candle with following characteristics for my selected scripts

For Eg : Candle1 price range is high-low is 10-2 . Candle2 price range is 7-5 . Rsi should be less than 20 and greater than 0 and stoc should be in oversold region . CCI should be less than 0

NaMasTe TraDeR,

REF(HIGH,1) - REF(LOW,1) >= 8 AND 
HIGH - LOW = <= 2 AND 
RSI(CLOSE,14) < 20 AND 
SOPK(9, 3, 9, SIMPLE) < 20 AND 
CCI(12, SIMPLE) < 0 

Check and Confirm

I couldnt able to test your code , since market hours is closed and scanner works on live market hours …So couple of small queries here for just confirmation …
Could you please little bit explain for the following your statement …
1.As per your first line REF(HIGH,1) - REF(LOW,1) >= 8 , Why 8 or what is the importance of 8 here ?
2.Is it REF(High,1) or REF(Low,1) means candle1 as my per query ?
3.As per your second statement , Is it High and low means Candle2 as per my query or recent completed candle ?
4.As per your second statement HIGH - LOW = <= 2 , what is the importance of ‘2’ here ?
5.So as per your code , it will consider previous last completed candle as candle1 and just completed candle as candle2 only and it will not consider ‘candle3’ which is processing or not yet completed with the current selected timeframe …Please confirm …Hope i am not confused you .Or for example
For a one hour timeframe which i selected ,
between 10.15Am-11.15AM i have a completed candle which i will call as candle1 ,
between 11.15-12.15 i have a another completed candle which i will call as candle2 ,
now time is 12.25 , and now i am running your code , so there is a candle which is NOT YET COMPLETED and i dont need this candle for any result processing …
So based on cande1 with this example , i need whether candle2 fits inside the candle1 scripts only …Hope i am clear to you now .

yes , if your requirement is with day candles then you can not use scanner, the REF(HIGH,1) defines the high of previous candle, the >=8 defines , just greather or equals , as you mentioned 10-2 example, if you want to write on current candle you can define “HIGH”, insterd of REF(HIGH,1)

Hi , As per your first two lines of code given below i have some recommendations to you
"REF(HIGH,1) - REF(LOW,1) >= 8 AND HIGH - LOW = <= 2 AND "
It will be great if you can share the code in generic or without hardcoding the values , so that it can be useful for others too . I given the example to understand you more clearly .

Stock Selection as follows

  1. Top performing index at 9.40 am

( pickup stock with top gainer 1, top loser 1 )

  1. Worst performing index at 9.40 am

( pickup stock with top gainer 1, top loser 1 )

  1. OPEN = HIGH Top One stock at 9.40 am

  2. OPEN = LOW Top One stock at 9.40 am

  3. Top Gainer One stock at 9.40 am

  4. Top Loser One stock at 9.40 am

i want PI code for the scanner

@portfolioplus911 hey is it possible to write a code with supertend in pi ?? if so could you please give an example ?

@abhra it is not possible