logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
nishant  
#1 Posted : Thursday, November 21, 2013 12:34:24 AM(UTC)
nishant

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/9/2007(UTC)
Posts: 35

Thanks: 1 times
Hello,

Help required here, please. I created a very basic EA giving alert whenever Stochastic goes overbought/oversold to know actual mechanics. But i realized its giving pop up alert with every tick movement which is making me vexed. How do i restrict the alert to pop up only after the completion of 5min candle?

Code which i wrote in Expert Editor>Alerts:
Name: Buy
Condition: Stoch(14,3)<20

How to restrict pop ups? Someone please..

Best,

Nishant
haddison  
#2 Posted : Thursday, November 21, 2013 9:29:00 AM(UTC)
haddison

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/6/2010(UTC)
Posts: 113
Location: London

Try this:

Frac(Minute()/5)=0
nishant  
#3 Posted : Thursday, November 21, 2013 10:24:54 PM(UTC)
nishant

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/9/2007(UTC)
Posts: 35

Thanks: 1 times
Hi Haddison,

I tried incorporating, but the situation is remaining the same i suppose. I do not know much about coding, so perhaps am coding a wrong way... I will have to copy paste now.. So please let me know what i should put in "condition"..
MS Support  
#4 Posted : Friday, November 22, 2013 9:28:11 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Views messages in topic : 1,960

Thanks: 92 times
Was thanked: 155 time(s) in 150 post(s)
I believe the idea was to be able to figure out when you are on minute 5 out of 5 meaning the fractional portion of the bar would be 0 once you were on the 5th minute.

However, to my knowledge this would not work because MetaStock time-stamps the 5 minute bar only one time with the 5-minute time stamp and then the bar just updates live until a new 5-minute bar forms. In essence:

Frac(Minute()/5)=0 will always be true on a 5-minute chart and I don't think will do what you want it to do.

The only way I am aware of is to disable Recalculate Expert Live which is listed under Tools-->Options-->Realtime. When "Recalculate Expert Live" is unchecked, it waits until the price bar is completed before attempting to process any of the Expert formulas (such as Alerts). Keep in mind this not only affects Alerts but all the other formulas in the Expert Advisor, such as the Signals.
mstt  
#5 Posted : Saturday, November 23, 2013 3:08:30 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Nishant

I don't have a live feed, nor do I fully grasp all the issues related to your problem. Nevertheless I'd be happy to work with you via email to try and solve the problem. I suspect that a Multi-Frame Stochastic indicator set to 5-minute timeframes would form part of the solution, and a simple mechanism to prevent repeated signals also seems to be necessary. There may also be other issues, such as timing, that need to be included in the mix. Without a live feed it's not possible for me to check any "solution" I might suggest, so the process might take a while. A positive result could be reported back to the forum if there's any interest in same.

Roy
rlarsen@quik.co.nz

nishant  
#6 Posted : Monday, November 25, 2013 12:43:47 AM(UTC)
nishant

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/9/2007(UTC)
Posts: 35

Thanks: 1 times
@MS Support, your suggestion of unchecking Recalculating Expert Live has indeed worked! I was getting good amount of headache with alert popping up every now and then with every tick movement - gone now! Thank you!

But i realised a new problem given the kind of trading to be daytrade/scalp in nature. No doubt the alert is now coming after the completion of 5min candle, but with that no time is left to further analyse that particular situation. You have just very very few seconds to conceive your entry, exit, stops and most importantly money management issues. Given the situation, can there be a possiblity of alert popping up with the first tick that makes the indicator overbought/oversold and ignore all other signals? Say for instance, given 5 min chart, we witness Stochastic going overbought first at 11.53 am. With alert popping up first at that moment, we have good 2 mins to analyse things deeply and establish other parameters before we can place trades with greater conviction.

@Roy, thank you for extending help. I will mail you on account of the recent challenge mentioned above.

Anyone, if unclear on my question, please do let me know.
John S  
#7 Posted : Monday, November 25, 2013 11:26:48 AM(UTC)
John S

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/9/2012(UTC)
Posts: 169

So maybe a feature that "triggers once per interval, then disable alert" type functionality. So on a 5-min chart, allow the alert to pop-up once per 5 minutes and then reset again at the beginning of the next 5-min interval. Would that work for you?
mstt  
#8 Posted : Monday, November 25, 2013 2:13:40 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Nishant

I've prepared an indicator and exploration version of my "Multi-Frame ID Stoch EMA" indicator that I think will signal on tick, 1 or 5 minute charts each time the 5-minute Stoch(14,3) crosses below 20. This is achieved by running the indicator/expert formula in "dynamic" mode so that each new data point is regarded as the final bar of the current 5-minute period/frame.

It should be possible to configure the expert so that only one cross below 20, or each of more than one, will trigger a signal. Dynamic mode allows you to monitor the indicator state or value of the currently evolving 5-minute timeframe. Static mode will only signal a cross below 20 once the 5-minute frame/period has been completed and the first tick of a new frame is available.

Proprietary elements of my formulas are not shown here but I will get all code to you once I have your email address. With cooperation on both sides I'm sure we can make this thing work.

Roy

{Multi-Frame ID Stoch EMA Expert}

{User settings}
Pd:=14; {%K Periods}
N:=3; {%K Slowing Periods}
U:=1; {%D EMA Periods}
J:=5; {Periodicity in Minutes}
Q:=1; {Mode, 0=Static 1=Dynamic 2=Delayed}
{Timing signals}
.....
{End-of-frame prices}
.....
{Stochastic and %K slowing}
.....
{%D EMA smoothing}
.....
{Results, %K, %D, Crossover}
{K;}
{D;}
Cross(20,K);


{Multi-Frame ID Stoch EMA Indicator}
.....
{User settings}
Pd:=Input("Multi-Frame ID Stoch EMA, %K Periods",1,99,14);
N:=Input("%K Slowing, Periods" ,1,99,3);
U:=Input("%D EMA, Periods",1,99,1);
J:=Input("Periodicity in Minutes, 1-1440",1,1440,5);
Q:=Input("Mode, 0=Static 1=Dynamic 2=Delayed",0,2,1);

{Timing signals}
.....
{End-of-frame prices}
.....
{Stochastic and %K slowing}
.....
{%D EMA smoothing}
.....
{Results, %K, %D, Crossover}
K;
D;
{Cross(20,K);}
nishant  
#9 Posted : Thursday, November 28, 2013 4:58:07 AM(UTC)
nishant

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/9/2007(UTC)
Posts: 35

Thanks: 1 times
Hi John,

For past two days I was trying to comprehend under live scenario if your suggestion on coding is likely to suffice or not. Initially i thought it should be perfect and will certainly not result in repeated triggers. But am afraid there is again a situation now.

I'm trading several instruments. So keeping track on each of them was extremely difficult. Classifying myself largely as a Swing trader, i thought of screening primarily the stocks through Stochastic alerts.

I'm keeping 20 stock charts apart from other instruments, most liquid ones, open in Metastock so that alert can be triggered successfully. Lets name few stocks as "A", "B", "C", "D", "E", etc. Given what you have suggested, once alert is triggered then it will reset and will not come for next 5 mins. Now say, "A" goes overbought at 11.52AM and alert gets issued. What if "B" goes overbought at 11.54AM? Will alert be issued for "B" as 5 mins from first alert at 11.52AM has not been passed yet.

Can still be made workable? I do not know much about coding though, but think its not possible except for only 1 chart on screen as you have already indicated earlier.


@roy: dropped you an email.
Justin  
#10 Posted : Friday, November 29, 2013 10:35:37 PM(UTC)
Justin

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 9/13/2004(UTC)
Posts: 673
Location: Salt Lake City, UT

Currently the Expert Advisor works chart by chart, so I think John's suggestion would be on a per chart basis, hence your problem should not be an issue in the case of A and B firing off within 2 minutes of each other. I believe John was suggesting each chart will fire off the first trigger then stop until the next 5-min bar. But if you had 30 charts open and they all triggers within 30 seconds of each other, you would get 30 pop-ups within 30 seconds, then nothing on any of the charts for 4 min 30 sec.

Of course, having a non-modal Alert Manager (i.e. like the Data Window) window that showed a reference to each opened chart with an Expert attached that showed the date/time of the last triggered alerts (possibly other / historical alert info as well) could be pretty handy :)
nishant  
#11 Posted : Tuesday, December 3, 2013 10:28:33 PM(UTC)
nishant

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/9/2007(UTC)
Posts: 35

Thanks: 1 times
I didnt realise neither was aware that EA works chart by chart.
@John, given the response from Justin holds true, will you please make the EA progress and work on that basis?
John S  
#12 Posted : Wednesday, December 4, 2013 11:45:06 AM(UTC)
John S

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/9/2012(UTC)
Posts: 169

Detaching alerts from charts is something we want to do eventually. It would be an "Alert Manager" of sorts. This would be a natural extension of adding an automatically generated trade ticket (based on alerts) for brokerages as well.
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.