Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 4/30/2005(UTC) Posts: 112
|
Hi all,
I want to plot the following figures at 10:00 onwards, based on the first 15-min (trade starts from 9:45 here) high plus A value and first 15-min low minus B. However, I don't want to show previous day's figures on the first 15-min trading.
----------\\\\------
Time1:=Hour()=9 AND Minute()=45;
Time2:=Hour()=10 AND Minute()=00;
HH:=ValueWhen(1,Time2,HighestSince(1,Time1,H));
LL:=ValueWhen(1,Time2,LowestSince(1,Time1,L));
HH1:=HH+10;
LL1:=LL-10;
HH1;LL1
-----------\\\\------
When I plot the above, the lines also show the previous day HH1 and LL1 during the first 15 min trading, I want to eliminate them...
Is there any time specific function (I can't find in Formula Primer)? say in the following logic, but there seems no such function :oops:
If(Time>=10:00, HH1,0);
If (Time>=10:00, LL1,0)
Perhaps, there is another way to do that... Any recommendations??
Cheers!!
Gary
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
Gary, the problem here is that if there is no data at exactly 9:45am and/or 10:00am, your formula will go looking for the previous days' values at those two times.
Try this MS code:
[code:1:48b2d93109]{ http://www.metastocktools.com }
{ Time inputs }
Hour1:=Input("1st time Hour",0,23,9);
Min1:=Input("1st time Minutes",0,59,45);
Hour2:=Input("2nd time Hour",0,23,10);
Min2:=Input("2nd time Minute",0,59,0);
{Another way of coding start of trading session
on intraday charts:}
{NuDay:=DayOfMonth()<>Ref(DayOfMonth(),-1);}
{ Time triggers }
Time1:=Hour()>Hour1
OR Hour()=Hour1 AND Minute()>=Min1;
Time2:=Hour()>Hour2
OR Hour()=Hour2 AND Minute()>=Min2;
{ Gary's stuff }
HH:=ValueWhen(1,Time2,HighestSince(1,Time1,H));
LL:=ValueWhen(1,Time2,LowestSince(1,Time1,L));
HH1:=HH+10;
LL1:=LL-10;
{ Plot in own window }
HH1;LL1[/code:1:48b2d93109]
jose '-)
http://www.metastocktools.com
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 4/30/2005(UTC) Posts: 112
|
Thanks Jose,
... it doesn't work, don't know why....
Gary :oops:
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
Oopsey, forgot the time signals. :oops:
Try this code:
[code:1:858c5147d7]
{ http://www.metastocktools.com }
{ Time inputs }
Hour1:=Input("1st time Hour",0,23,9);
Min1:=Input("1st time Minutes",0,59,45);
Hour2:=Input("2nd time Hour",0,23,10);
Min2:=Input("2nd time Minute",0,59,0);
{Another way of coding start of trading session
on intraday charts:}
{NuDay:=DayOfMonth()<>Ref(DayOfMonth(),-1);}
{ Time triggers }
Time1:=Hour()>Hour1
OR Hour()=Hour1 AND Minute()>=Min1;
Time1:=Time1 AND Alert(Time1=0,2);
Time2:=Hour()>Hour2
OR Hour()=Hour2 AND Minute()>=Min2;
Time2:=Time2 AND Alert(Time2=0,2);
{ Gary's stuff }
HH:=ValueWhen(1,Time2,HighestSince(1,Time1,H));
LL:=ValueWhen(1,Time2,LowestSince(1,Time1,L));
HH1:=HH+10;
LL1:=LL-10;
{ Plot in own window }
HH1;LL1[/code:1:858c5147d7]
jose '-)
http://www.metastocktools.com
.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 4/30/2005(UTC) Posts: 112
|
Jose,
I have tried your code which couldn't even draw a line on the chart.... not sure what's wrong...
Just to clarify if I haven't done it well at the beginning. my original code draws the two lines that I want, but would like to eliminate the previous lines during the first 15 min of trading before a new set of lines could be drawn.
cheers!
Gary
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 4/30/2005(UTC) Posts: 112
|
Jose,
I have another thought, making the indicator applicable to security / commodity with different opening time.. using your
NuDay:=DayOfMonth()<>Ref(DayOfMonth(),-1);
and then add 15 mins...... I think that is much better... you have a very good input!!
but I need to figure out how to count 15 min.... as I am not familar with MS code....
:lol: Gary
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
Gary, try first experimenting with the time signals - the rest becomes easier then.
[code:1:dd61407015]{ http://www.metastocktools.com }
{ Time inputs }
Hour1:=Input("time - Hour",0,23,10);
Min1:=Input("time - Minutes",0,59,0);
{ Start of trading session on intraday charts:}
NuDay:=DayOfMonth()<>Ref(DayOfMonth(),-1);
{ Time trigger }
Time1:=Hour()>Hour1
OR Hour()=Hour1 AND Minute()>=Min1;
Time1:=Time1 AND Alert(Time1=0,2);
{ Plot time signals in own window }
NuDay;-Time1;[/code:1:dd61407015]
jose '-)
http://www.metastocktools.com
.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 4/30/2005(UTC) Posts: 112
|
Hi Jose and others,
Thanks for your input. I can draw the lines that I want. Actually, it is the part of the ACD Methodology, developed by Mark Fisher. You can see more info in the following website.
http://www.investopedia..../technical/04/032404.asp
http://www.themysterybox...amg/ensign/ACDmethod.htm
Originally Posted by: A value",2,30,13)
Well, I now want to plot the buy and sell signal on the chart:-
Buy signal if price stay above Aup for 7.5 mins (I am not sure how to code this, perhaps based on 1 min chart, buy signal if close of consecutive 1 min bar >7)
Similary, sell signal if close of consecutive 1 min bar>7.....
Can you help me to code this?
Many thanks!
Gary
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 4/30/2005(UTC) Posts: 112
|
Hi Jose / others,
Do you have time to look at the previous post that require time condition to make an entry.
Also, I have found it difficult to write anything about time. Say, if I have defined the LE (long) condition on the Latch Function to be applied on intraday chart. how can I write the LX (Long exit) if it is simply square on closing on 17:00.
I just want to test the idea to write a system tester to test if the idea is profitable or not....
Cheers!
Gary
|
|
|
|
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.