AFL Popup script help

wabuf

Well-Known Member
#1
Hi ,

i have written a strategy in afl but i dont know the code for popup message :confused: that will stay like 6 sec on screen and then goes away and this should be applicable to all the symbols .I want to use in intraday trading , its very difficult to scan each and every symbol during intraday .

your help would be greatly appreciated :thumb:
 

wabuf

Well-Known Member
#4
Ty for reply but is says the following error

syntax error , unexpected FUN ,is there semicolon missing at end of the syntax line

referring to this

PopupWindow("Buy : " + FullName(),"Alert", 5, 640*mtRandom(), 480*mtRandrm());

i have a semicolon already :confused:
 
#6

wabuf

Well-Known Member
#7
bro solved the semicolon problem ,another problem .

the afl started running , but now the popup does not show any data like price or share name , its simply a grey box with sell / buy written on it .

how i can a popup stay on screen on its respective symbol . i mean i dont want the popbox to appear of ABB on Tatamotors screen :p

referred to guide its more confusing thats why i decided to post on traderji after oct ,15 my last post :)
 

vijkris

Learner and Follower
#8
more info on popup window & control from Amibroker kb

August 30, 2008
Popup Window: Preventing pile-ups

By Dennis Brown

The popup window is a great tool in debugging and can help you to keep track of what your code is doing or it can be used to alert you to special situations in your normally running formula. A common problem is that if you call PopupWindow() from a loop or if one gets generated on every AFL pass, you can get hundreds or even thousands of pop-ups piling up on your screen. Tomasz posted a simple work-around on the AmiBroker Feedback Center that took care of the problem in some cases (Suggestion 1528):

The following is a more complete version of this solution that adds a popupID to keep track of each individual popup window and re-enable the popup after its specified timeout period, or if any of the displayed text changes:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23



function GetSecondNum()
{
Time = Now( 4 );
Seconds = int( Time % 100 );
Minutes = int( Time / 100 % 100 );
Hours = int( Time / 10000 % 100 );
SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
return SecondNum;
}

function PopupWindowEx( popupID, bodytext, captiontext, timeout, left, top )
{
displayText = bodytext + captiontext;
if ( ( StaticVarGetText( "prevPopup" + popupID ) != displayText) OR ( StaticVarGet( "prevPopupTime" + popupID ) < GetSecondNum() ) )
{
StaticVarSetText( "prevPopup" + popupID, displayText);
StaticVarSet( "prevPopupTime" + popupID, GetSecondNum() + timeout );
PopupWindow( bodytext, Captiontext + popupID, timeout, Left, top );
}
}

PopupWindowEx( "ID:1", "testing", "test alert ", 5, -1, -1 );
PopupWindowEx( "ID:2", "testing", "test alert ", 5, 0, 0 );
use the above code pls
 

vijkris

Learner and Follower
#9
Ohh... I have not seen the post date.
TJ site become so famous that it was just a one search on google...:p
yesterday st sir also said that TJ is very popular.
BTW, u missed the world war yesterday, i think..:D

BTW can u code complex things in afl. ?
u know many things..
 

wabuf

Well-Known Member
#10
sorry bro same problem, ran that code , problems is that only grey box with title appearing . Not able to fetch the Stocks name
 

Similar threads