gariki,
I use similar code as posted below. I have it interwaven in autotrade code so
extracted it from there. Did not test if it works. You can replace your Alertif
lines with this code.
regards, Ed
myBuyVar = Nz(StaticVarGet("buyVar");
mySellVar = Nz(StaticVarGet("sellVar");
myShortVar = Nz(StaticVarGet("shortVar");
myCoverVar = Nz(StaticVarGet("coverVar");
if (myBuyVar == 0 AND (LastValue(Buy) AND !LastValue(Cover) AND
!LastValue(Short) AND !LastValue(Sell)) )
{
StaticVarSet( "myBuyVar",1);
StaticVarSet( "mySellVar",0);
StaticVarSet( "myShortVar",0);
StaticVarSet( "myCoverVar",0);
Say( "Buy" );
}
else if (mySellVar == 0 AND (!LastValue(Buy) AND !LastValue(Cover) AND
!LastValue(Short) AND LastValue(Sell)) )
{
StaticVarSet( "myBuyVar",0);
StaticVarSet( "mySellVar",1);
StaticVarSet( "myShortVar",0);
StaticVarSet( "myCoverVar",0);
Say( "Sell" );
}
else if (myShortVar == 0 AND (!LastValue(Buy) AND !LastValue(Cover) AND
LastValue(Short) AND !LastValue(Sell)) )
{
StaticVarSet( "myBuyVar",0);
StaticVarSet( "mySellVar",0);
StaticVarSet( "myShortVar",1);
StaticVarSet( "myCoverVar",0);
Say( "Short" );
}
else if (myCoverVar == 0 AND (!LastValue(Buy) AND LastValue(Cover) AND
!LastValue(Short) AND !LastValue(Sell)) )
{
StaticVarSet( "myBuyVar",0);
StaticVarSet( "mySellVar",0);
StaticVarSet( "myShortVar",0);
StaticVarSet( "myCoverVar",1);
Say( "Cover" );
}
From: gariki
Sent: Wednesday, July 21, 2010 2:27 AM
To: [email protected]
Subject: [amibroker] Re: sick of watching the screen..
Thanks all for the replies.. it would save me a lot of time if i can figure
this out..
TJ: i will defnitely send a mail to support; i have actually sent it once
(Ticket number: 72641) and from the response i got i thought that the way i am
using it i cannot do any better.
"Actually - AlertIf is mostly planned for use in the AUTOMATIC ANALYSIS window
- you can run SCAN with "run every" feature enabled. That way will make it
independent from chart focus, scrolling etc."
Herman: i am surprised that you think this is not an issue because i thought
when you posted this thread, you are running into exactly the same problem as i
have; maybe not.. hmm..
http://finance.groups.yahoo.com/group/amibroker/message/148221
Anyways; here is almost exactly what i have for most of my systems (ofcourse
rules are simplified); and the way i am using them now is i plot the graphs and
that shows the buy/sell arrows; all i wish is when it is creating these arrows,
it also shouts out loud so that i dont have to sit at the screen but do
something more useful like.. reading a book or yoga :) and dont care until i
hear out a loud sound about my entry.. the problem i run into is it only works
intermittently (when the cursor is on the bar before which the signal is
coming); somtimes the alerts sound; sometimes they dont..
//Testing alerts
BuySignal = Cross(EMA(C,10),EMA(C,20));
SellSignal = BarsSince(BuySignal) == 10;
ShortSignal = Cross(EMA(C,20),EMA(C,10));
CoverSignal = BarsSince(ShortSignal) == 10;
Buy = ExRem(BuySignal,SellSignal);
Sell = ExRem(SellSignal, BuySignal);
Short = ExRem(ShortSignal, CoverSignal);
Cover = ExRem(CoverSignal, ShortSignal);
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
Plot(Close, "Price", colorBlack, styleCandle);
PlotShapes( shape, IIf( Buy, colorGreen, colorRed), 0, IIf(Buy, Low, High) );
PlotShapes( Short*shapeHollowDownArrow + Cover*shapeHollowUpArrow, IIf(Short,
colorRed, colorGreen));
GraphXSpace = 5;
AlertIf( Buy, "SOUND C:\\Program Files\\Amibroker\\BuyBuyBuy.wav", "Audio
alert ");
AlertIf( Sell, "SOUND C:\\Program Files\\Amibroker\\SellSellSell.wav", "Audio
alert");
AlertIf( Short, "SOUND C:\\Program Files\\Amibroker\\SellSellSell.wav",
"Audio alert");
AlertIf( Cover, "SOUND C:\\Program Files\\Amibroker\\BuyBuyBuy.wav", "Audio
alert ");
RoundLotSize = 1;
PositionSize = MarginDeposit = 1;
Any help is appreciated; currently if i place this above code onto a graph pane
and set the time frame to 1min; i can easily get signals and i have verified
that the alerts are not going ON when the signal is generated.
thanks!
-gariki
--- In [email protected], "Bruce" <bru...@...> wrote:
>
> FWIW, I ran into some issues with AlertIf long ago and just coded around
> them. My primary use was in Explorations, so I just coded my own lookback
> since the build-in lookback parameter seemed problematic in my testing. I
> encourage you to pursue sending the info to support, because I think that
> there may be some idiosyncrasies of AlertIf that have not been fully
> explained.
>
> --- In [email protected], Tomasz Janeczko groups@ wrote:
> >
> > Hello,
> >
> > AlertIf does NOT require clicking to activate. You have got something wrong
> > with your formula.
> > Send the formula to support if you need help.
> >
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> >
> > On 2010-07-20 16:26, gariki wrote:
> > > Hello All,
> > >
> > > i am currently trading 4 systems on 5min time period and am just getting
> > > sick/tired of watching the screen for signals. I have alertif's coded
> > > into the systems but because of the problems with that function (it wont
> > > activate unless the last bar is clicked etc) it doesnt work.
> > >
> > > Ideally i would go auto-trade but i do not want to automate the part of
> > > putting trades on. I just want a good reliable mechanism to play sound
> > > alerts when i get signals.. is there any other alternative?
> > >
> > > TJ, plese consider fixing alertif functionality for this use case; for
> > > users that dont want to automate quite this is the next best thing and
> > > will be very handy (or maybe there is an alternative; that would solve my
> > > problem; would love to hear that..)
> > >
> > >
> > > thanks
> > > -gariki
> > >
> > >
> > >
> > > ------------------------------------
> > >
> > > **** IMPORTANT PLEASE READ ****
> > > This group is for the discussion between users only.
> > > This is *NOT* technical support channel.
> > >
> > > TO GET TECHNICAL SUPPORT send an e-mail directly to
> > > SUPPORT {at} amibroker.com
> > >
> > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> > > http://www.amibroker.com/feedback/
> > > (submissions sent via other channels won't be considered)
> > >
> > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > > http://www.amibroker.com/devlog/
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> >
>