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

Re: [amibroker] Timer Help Needed



PureBytes Links

Trading Reference Links

you need static variable to avoid this.
 
if you want this to trigger only once you could use:
 
rgds, Ed
 
 
myvar= StaticVarGet( "BB" +  Now(4) );
 
if ( EndSessionTrigger AND myvar)
{
Say( "Book your Position Book your Position Book your Position Book your Position" );
Plot( 1, "Book", colorWhite , styleArea | styleOwnScale, 0, 1 );
 
StaticVarSet( "BB" + Now(4), 1);
}
 
 
----- Original Message -----
Sent: Saturday, August 23, 2008 4:16 AM
Subject: [amibroker] Timer Help Needed

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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___