Finding combined MA of 2 different symbols in a watchlist

HI guys ,

I have 2 sets of symbols (calls and Puts in a watch list (calls with "CE" in their ticker name and put "PE" in their symbol) ex: BANKNIFTY07NOV1930500CE.NFO , BANKNIFTY07NOV1930500PE.NFO

I would like to get calls and puts trading close to each other in a price range about 10 and to calucalte MA oF those 2 symbols combined price
Ex:

 BANKNIFTY07NOV1930500CE.NFO  = 10
 BANKNIFTY07NOV1930000PE.NFO  = 9.5

This is my attempt .. From watchlist i filtered them like below

for (i = 0; (ticker = StrExtract(ticker_list, i)) != ""; i++) {
	SetForeign(ticker);
	     
     
	 isCall = StrFind ( ticker , "CE" );
     isPut =  StrFind ( ticker , "PE" ); 
   
    if ( isCall )  
    { 
        
      PriceCE 	= C;//  Price of  CE symbol   
           
      
    }
  
    if ( isPut ) 
    
     { 
       
	    PricePE 	= C;//   price  PE 
		
      }
	RestorePriceArrays();
}

now how do i get prices trading around 10 and combine them to plot AM of those 2 symbols ... Appreciate any one help..

Could any one direct me to any article or pointer to solve above one ? Appreciate your time .

How many symbols are there in the Watchlist that you are looping? Because looping the entire Watchlist again and again on every refresh is inefficient.

What are the conditions when you've more than "2 symbols" from the same watchlist trading near 10?

Define "about" specifically please!

1 Like
   How many symbols are there in the Watchlist that you are looping?

100 symbols

    What are the conditions when you've more than "2 symbols" from the same 
     watchlist trading near 10?

In my case usually price difference is 5 to 7 points between strikes....So duplication at a given is least probability .

Thanks for trying to help me

Computers cannot not assume probabilities unless defined by humans. Think again, what exactly you wish to procure.

i am aware of that one. Those things can be filtered out by adding certain conditions once i get basic template for the logic intended to achieve is efficient enough .

If there is any way to achieve without loops please feel free to point to me so that i can have a look and try