Dear Tomasz Janeczko and Group Members,
I am trading in National stock
Exchange of India.I am using a timer
in my af whose code is given
below.
At 3.21 pm it tells me once to "book my position".
The problem is
- if i change my end time to any earlier time like say
12.30 pm ,the afl
starts saying "book your position" but it does not
stop saying "book your
position", till i shut down my amibroker.
Timer
Code:
-----------------------
SetChartOptions( Mode = 1,
Flags = 1, gridFlags = 0, ymin = 0, ymax =
0
);
//********************************************************************
****************************************************
_SECTION_BEGIN(
"SESSION TIMING" );
TimeFrame = Param( "Chart Timeframe (min)", 8, 1,
60, 1 ) * 60;
TimeFrameSet( TimeFrame );
TN =
TimeNum();
ParamStartTime = ParamTime( "Session Start", "09:54:00"
);
ParamEndTime = ParamTime( "Session End", "15:21:00"
);
InSessionTime = TN >= ParamStartTime AND TN <=
ParamEndTime;
StartOfSession = InSessionTime > Ref( InSessionTime,
-1 );
EndOfSession = InSessionTime < Ref( InSessionTime, -1
);
InsessionTime = InSessionTime OR
EndOfSession;
_SECTION_END();
//********************************************************************
****************************************************
RequestTimedRefresh(
1 );
ParamDateNumber = ParamDate( "Date", Now( 1 ), 0 );
RTTimeNumber =
Now( 4 );
RTDateNumber = Now( 3 );
InSessionDate = RTDateNumber ==
ParamDateNumber;
PreSessionTime = RTTimeNumber <
ParamStartTime;
PostSessionTime = RTTimeNumber >
ParamEndTime;
InSessionTime = NOT ( PreSessionTime OR PostSessionTime
);
PrevInSession = StaticVarGet( "InSession" );
InSession =
InSessionDate AND InSessionTime;
StartSessionTrigger = LastValue(
InSession ) > PrevInSession;
EndSessionTrigger = LastValue(
InSession ) < PrevInSession;
StaticVarSet( "InSession", InSession
);
//********************************************************************
****************************************************
if
( EndSessionTrigger )
{
Say( "Book your Position Book your Position Book
your Position
Book your Position" );
Plot( 1, "Book", colorWhite ,
styleArea | styleOwnScale, 0, 1
);
}
//********************************************************************
****************************************************
Kindly
help me in rectifying the problem.
Regards
Bobby
Kular