Need correction in filter code

#1
I get the current close price and volume

Filter = 1;
AddColumn(C,"Close");
AddColumn(V,"Volume");

If i want to get the last day close price and volume then what to do ...
 

casoni

Well-Known Member
#2
I get the current close price and volume

Filter = 1;
AddColumn(C,"Close");
AddColumn(V,"Volume");

If i want to get the last day close price and volume then what to do ...
AddColumn(ref(C,-1),"Close");
AddColumn(ref(V,-1),"Volume");
 

casoni

Well-Known Member
#4
Try this
explore any day from current [0] to past [400 ]bars
change parameters and check , bt default this will explore current and past day [ close & ref(c,-1) ]


p=Param("Nback",0,0,200,1);
pp=Param("Fback",1,1,400,1);
Filter=C>10 ;
SetOption("NoDefaultColumns", True);
AddTextColumn(Name(), "Ticker", 1, textColor=colorWhite,bkgndColor=colorGrey40,100);
AddTextColumn( FullName(), "Full Name", 1, textColor=colorBlack,bkgndColor=colorLime,20);
AddTextColumn( SectorID(1), "Sector", 1, textColor=colorLightYellow,bkgndColor=colorGrey50,20);
AddTextColumn( IndustryID(1), "Industry", 1, textColor=colorWhite,bkgndColor=colorGrey40,20);

AddColumn(Ref(DateTime(),-pp),"Date:",formatDateTime,textColor=colorBlack,bkgndColor=colorTan,150);
AddColumn(Ref(C,-pp),"C - ("+pp+") bars ",1.2, textColor=colorBlack,bkgndColor=colorTan,60) ;


AddColumn(Ref(DateTime(),-p),"Date:",formatDateTime,textColor=colorBlack,bkgndColor=colorPaleGreen,150);
AddColumn(Ref(C,-p),"C - ("+p+") bars ,",1.2, textcolor=IIf( Ref(C,-p) > Ref(C,-pp),colorDarkGreen,colorRed),bkgndColor=colorPaleGreen,60) ;
 

Similar threads