Hello Pebs, What seemed to have worked for me is to change the intraday bar settings to use the time stamp for end of bar to represent it. That took care of multiple signals that keep coming until the next bar starts. Try it; it might solve your problem because you now dont need static variables (which stay in memory until you close your AB session; read from another post..).
Setting to change: Tools -> Preferences -> Intraday, then set the timestamp display to START or END time of interval. Regards -gariki --- In [email protected], Pebs Nel <lurama...@...> wrote: > > Hi , yes thanks i just saw that reply and i have just tried it. It does seem > to work for me with a little adjustment. > > Lasttweet = Nz(StaticVarGet("Lasttweet")); > if ((LastValue(Lasttweet) != LastValue(pebstime)) AND > (LastValue(xxxtotal)!=LastValue(Ref(xxxtotal,-1)))){ > ... > ... > > Lasttweet = LastValue(pebstime); > } > > so i use the bars timestamp to make sure it doesnt happen again that bar. > > But when the indicator has just triggered on the last bar, it works. If i > then remove it and add it back it doesnt trigger again, so the staticvar > stays in memory like that it seems? i'm still not sure how to solve. > > As far as the alerts are concerned i have never used the email one, but i > have never had a problem with sound or with executing an external program, it > always just runs once, if i can think of anything will let you know. > > The same function i have above has an audio alert and it looks like this : > > AlertIf(LastValue(xxxtotal)>LastValue(Ref(xxxtotal,-1)),"SOUND > C:\\Windows\\Media\\sp_pt_buy_level2.wav","Audio alert", 9); > > and it always just triggers once per bar. > > > > > ________________________________ > From: gariki <chetan_gar...@...> > To: [email protected] > Sent: Thu, January 7, 2010 12:38:16 AM > Subject: [amibroker] Re: Limiting action to only once per bar > > > > > this seems to be a similar problem to what i am seeing (albeit with alert > function itself triggering alerts multiple times). Aron suggested i use > something like.. > > sent = Nz(StaticVarGet( "Sent")); > if ( NOT sent) > { > AlertIf( Buy, "EMAIL", "+1 ES- Go long on System-1 5min", 1, 15); > StaticVarSet( "Sent", 1); > } > > Not sure if it works since i need to test it when i get back home. > > You refer to you using alertif function for something else; so is it not > creating multiple alerts for you? what is the format in which you are using > it? > > --- In amibro...@yahoogrou ps.com, "wolfie125" <lurama125@ ..> wrote: > > > > Hi, I have an indicator that basically plots the number of contracts i need > > to be long or short. When the number changes for a new bar, i want to run a > > piece of code, let's say a messagebox, or a little external program, but > > what is happening is once the new bar comes and the number of contracts > > changes this code keeps on executing 100's of times till the next bar > > arrives. I have tried setting a boolean variable but no success. I > > specifically dont want to use the alert function as i am already using it > > for something else on that bar. > > > > can someone help pls, the basic logic currently is something like this : > > > > if ((Lasttweet == False) AND LastValue(xxxtotal) !=LastValue( Ref(xxxtotal, > > -1)))){ > > > > txtmsg = WriteIf(xxxtotal> Ref(xxxtotal, -1),"Just Bought "+ (xxxtotal-Ref( > > xxxtotal, -1)) + " contracts at " + ppp,"Just Sold "+ (Ref(xxxtotal, > > -1)-xxxtotal) + " contracts at " + ppp); > > PopupWindow( txtmsg,NumToStr( LastValue( pebstime) )+" ",100,-1,-1) ; > > > > Lasttweet = true; > > > > } > > >
