Simple Coding Help - No Promise.

Hello ,
Kindly Help me in getting result when , any one of these condition is True ..[ O==H or O==L , IN Cash and Futures ] , i have added cash scripts in watchlist0 and futures in watchlist1 , and cash+futures in watchlist3 ,

i searched net but didn't get any clue , As suggest by ,Mastermind i tried this , buy No result Kindly Guide me how t oobtail result

// condition ..
Bear0=O==H;
Bull0=O==L;


list1 = CategoryGetSymbols(categoryWatchlist, 1);// List contains futures scripts
printf( "Ticker\t Last Price\n" );
printf( "----------------------------\n" );
for(i = 0; (sym = StrExtract(list1, i)) != ""; i++)
{
SetForeign(sym) ;
Bear1=O==H;
Bull1=O==L;
RestorePriceArrays( );

}

bullish=(Bull0 AND Bull1) ;
bearish=(Bear0 AND Bear1);
Filter= bullish OR bearish; // Exploring on watchlist3 [ contains Cash and futures scripts]

AddColumn(IIf(bullish,C,Null),"Bullish",1.2); // when cash and futures both have same condition
AddColumn(IIf(bearish,C,Null),"Bullish",1.2);

Kindly Help
 

Romeo1998

Well-Known Member
Hello ,
Kindly Help me in getting result when , any one of these condition is True ..[ O==H or O==L , IN Cash and Futures ] , i have added cash scripts in watchlist0 and futures in watchlist1 , and cash+futures in watchlist3 ,

i searched net but didn't get any clue , As suggest by ,Mastermind i tried this , buy No result Kindly Guide me how t oobtail result

// condition ..
Bear0=O==H;
Bull0=O==L;


list1 = CategoryGetSymbols(categoryWatchlist, 1);// List contains futures scripts
printf( "Ticker\t Last Price\n" );
printf( "----------------------------\n" );
for(i = 0; (sym = StrExtract(list1, i)) != ""; i++)
{
SetForeign(sym) ;
Bear1=O==H;
Bull1=O==L;
RestorePriceArrays( );

}

bullish=(Bull0 AND Bull1) ;
bearish=(Bear0 AND Bear1);
Filter= bullish OR bearish; // Exploring on watchlist3 [ contains Cash and futures scripts]

AddColumn(IIf(bullish,C,Null),"Bullish",1.2); // when cash and futures both have same condition
AddColumn(IIf(bearish,C,Null),"Bullish",1.2);

Kindly Help
Sir @sharad17

this will work only if future symbol is named with _F1
for example
cash symbol = AXISBANK
then futures symbol must be AXISBANK_F1
add cash symbols in list0 watchlist and futures symbols in list1 watchlist...
in exploration select Filter and explore...
good luck :)


Code:
list0 = CategoryGetSymbols( categoryWatchlist, 0 ); // List contains cash scripts
list1 = CategoryGetSymbols( categoryWatchlist, 1 ); // List contains futures scripts


cash_bull=cash_bear=future_bull=future_bear=0;


for(i = 0; (sym1 = StrExtract(list0, i)) != ""; i++)
{
SetForeign(sym1) ;
cash_bull=O==L;
cash_bear=O==H;


for(j = 0; (sym2 = StrExtract(list1, j)) != ""; j++)
{
if(sym2 == sym1+"_F1")
{
SetForeign(sym2) ;
future_bull=O==L;
future_bear=O==H;
RestorePriceArrays( );
}
}
RestorePriceArrays( );
}


bullish=cash_bull AND future_bull ;
bearish=cash_bear AND future_bear;
Filter = ( InWatchList( 0 ) OR InWatchList( 1 ) ) AND ( bullish OR bearish ) AND StrFind(Name(),"_F1")==0 ;

AddColumn( IIf( bullish, C, Null ), "Bullish C (cash)", 1.2, 27 );
AddColumn( IIf( bullish, o, Null ), "O (cash)", 1.2, 27 );
AddColumn( IIf( bullish, l, Null ), "L (cash)", 1.2, 27 );
AddColumn( IIf( bullish, Foreign(Name()+"_F1","C"), Null ), "Bullish C (future)", 1.2, 27 );
AddColumn( IIf( bullish, Foreign(Name()+"_F1","O"), Null ), "O (future)", 1.2, 27 );
AddColumn( IIf( bullish, Foreign(Name()+"_F1","L"), Null ), "L (future)", 1.2, 27 );

AddColumn( IIf( bearish, C, Null ), "Bearish C (cash)", 1.2, 4 );
AddColumn( IIf( bearish, o, Null ), "O (cash)", 1.2, 4 );
AddColumn( IIf( bearish, h, Null ), "H (cash)", 1.2, 4 );
AddColumn( IIf( bearish, Foreign(Name()+"_F1","C"), Null ), "Bearish C (future)", 1.2, 4 );
AddColumn( IIf( bearish, Foreign(Name()+"_F1","O"), Null ), "O (future)", 1.2, 4 );
AddColumn( IIf( bearish, Foreign(Name()+"_F1","H"), Null ), "H (future)", 1.2, 4 );
 
Last edited:
Sir @sharad17

this will work only if future symbol is named with _F1
for example
cash symbol = AXISBANK
then futures symbol must be AXISBANK_F1
add cash symbols in list0 watchlist and futures symbols in list1 watchlist...
in exploration select Filter and explore...
good luck :)


Code:
list0 = CategoryGetSymbols( categoryWatchlist, 0 ); // List contains cash scripts
list1 = CategoryGetSymbols( categoryWatchlist, 1 ); // List contains futures scripts


cash_bull=cash_bear=future_bull=future_bear=0;


for(i = 0; (sym1 = StrExtract(list0, i)) != ""; i++)
{
SetForeign(sym1) ;
cash_bull=O==L;
cash_bear=O==H;


for(j = 0; (sym2 = StrExtract(list1, j)) != ""; j++)
{
if(sym2 == sym1+"_F1")
{
SetForeign(sym2) ;
future_bull=O==L;
future_bear=O==H;
RestorePriceArrays( );
}
}
RestorePriceArrays( );
}


bullish=cash_bull AND future_bull ;
bearish=cash_bear AND future_bear;
Filter = ( InWatchList( 0 ) OR InWatchList( 1 ) ) AND ( bullish OR bearish ) AND StrFind(Name(),"_F1")==0 ;

AddColumn( IIf( bullish, C, Null ), "Bullish C (cash)", 1.2, 27 );
AddColumn( IIf( bullish, o, Null ), "O (cash)", 1.2, 27 );
AddColumn( IIf( bullish, l, Null ), "L (cash)", 1.2, 27 );
AddColumn( IIf( bullish, Foreign(Name()+"_F1","C"), Null ), "Bullish C (future)", 1.2, 27 );
AddColumn( IIf( bullish, Foreign(Name()+"_F1","O"), Null ), "O (future)", 1.2, 27 );
AddColumn( IIf( bullish, Foreign(Name()+"_F1","L"), Null ), "L (future)", 1.2, 27 );

AddColumn( IIf( bearish, C, Null ), "Bearish C (cash)", 1.2, 4 );
AddColumn( IIf( bearish, o, Null ), "O (cash)", 1.2, 4 );
AddColumn( IIf( bearish, h, Null ), "H (cash)", 1.2, 4 );
AddColumn( IIf( bearish, Foreign(Name()+"_F1","C"), Null ), "Bearish C (future)", 1.2, 4 );
AddColumn( IIf( bearish, Foreign(Name()+"_F1","O"), Null ), "O (future)", 1.2, 4 );
AddColumn( IIf( bearish, Foreign(Name()+"_F1","H"), Null ), "H (future)", 1.2, 4 );
Thank you so much ...
Really Obliged ..
Many Many Thanks ...
 
Sir @Romeo1998
Sorry to bother you again , on 24April Eod , DLF,HINDPETRO,TATAPOWER these scripts [ cash and futures ] had O==H , i am not getting this Result in exploration , i explored this on Filter = watchlist0 / watchlist1 / watchlist2 ... watchlist0=cash , watchlist1=futures , watchlist2= cash and futures , What i am missing . kindly guide
Thank you
 
Sir @Romeo1998 ,

went through above link , but i didn't understand , so made New Database [ EOD ] , downloaded 15 days Equity/Futures data via NsedataDownloader ... one by one added Cash stocks in WL0 , Futures in wl1 and combined in WL2 ..... But No result ... pls check image .. [ * i have changed _F1 to -I ]
Capture.PNG
 

Similar threads