Hi,
Hope these lines can help you.
Nota Bene : if you compare, the previous date can never be equal to last
date...
Best regards
|// date display
LastDataDate = EndValue( DateTime() );
FirstDataDate = BeginValue( DateTime() );
antebar = EndValue( Ref( DateTime(), -1 ) );
_TRACE( Name() + " FirstDataDate: " + WriteVal( FirstDataDate ,
*formatDateTime* ) + " LastDataDate: " + WriteVal( LastDataDate,
*formatDateTime* ) );
_TRACE( "AnteBarVal = " + antebar + " AnteBarTime : " + WriteVal(
AnteBar , *formatDateTime* ) );
booltest = IIf(LastDataDate == antebar ,1,0);
Plot(booltest ,"booltest ",*colorWhite*,*styleLine*+*styleOwnScale*);|
Just in case, you want to detect a new day :
|// newday bar
segments = IIf( Interval() < *inDaily*, Day(), Month() );
segments = segments != Ref( segments , -1 );
Plot( segments, "", *colorDarkBlue*, *styleHistogram* | *styleOwnScale*
| *styleDashed* | *styleNoLabel* );|
Le 26/08/2010 10:32, isalert a écrit :
hi,all
i wanna get current bar's date and previous bar's date and compare
with each other,if current bar's date equals previous bar's date
,return 1,else return 0.
i write this code,but compilation error,
date()=ref(datenum(),-1)
so how to achieve my goal?