[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Timer Help Needed



PureBytes Links

Trading Reference Links

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


------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/