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

Notification

Icon
Error

Options
Go to last post Go to first unread
norwayturtle  
#1 Posted : Thursday, May 15, 2008 9:39:46 AM(UTC)
norwayturtle

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/4/2008(UTC)
Posts: 10

Hi! I am coding a system now. I need to find the highest price with the opening and test the current close against it. I use 30 min chart. How can i do it. I have this code: Ref(CLOSE,0) > Ref(HIGH,-1) Please help:)
wabbit  
#2 Posted : Thursday, May 15, 2008 6:48:09 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Hi NorwayTurtle,

Welcome to the Forum.

I don't fully understand what you are looking to achieve, but hopefully, "On an intraday chart, compare the latest CLOSE price with the highest HIGH price since the first bar that trading day" comes close?


Code:

{identify the start of the trading day}
newDay:=dayofmonth()<>Ref(dayofmonth(),-1) or cum(1)=2; 

{find the highest high so far this trading day}
highestHigh:=highestsince(1,newDay,H); 

{compare the latest close with the highest high}
{look for a higher close}
C > Ref(highestHigh,-1);



Hope this helps.

wabbit [:D]

norwayturtle  
#3 Posted : Friday, May 16, 2008 4:35:11 AM(UTC)
norwayturtle

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/4/2008(UTC)
Posts: 10

Thats very nice, Wabbit! Thanks! Do you know how I can only get the first signal from the Expert adviser on this code? Now I getting many signals,hehe.
wabbit  
#4 Posted : Friday, May 16, 2008 5:21:21 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
There are plenty of instances where you can find examples on how to achieve a counter... this is just one...

Code:

{identify the start of the trading day}
newDay:=dayofmonth()<>Ref(dayofmonth(),-1) or cum(1)=2;

{find the highest high so far this trading day}
highestHigh:=highestsince(1,newDay,H);

{compare the latest close with the highest high}
{look for a higher close}
x:=C > Ref(highestHigh,-1);

{count and reset}
count:=cum(x);
reset:=newDay;
counter:=count - valuewhen(1,reset,count);

{signal/alert}
counter=1 and Alert(counter=0,2);



Hope this helps.

wabbit [:D]

norwayturtle  
#5 Posted : Friday, May 16, 2008 8:50:34 AM(UTC)
norwayturtle

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/4/2008(UTC)
Posts: 10

Great, Wabbit! I wanna kiss you, but I think your a boy, so I'll pass:)hehe I am pretty good in trading, but not in coding. Thanks again:) Best regards Norwayturtle
norwayturtle  
#6 Posted : Friday, May 30, 2008 12:27:24 AM(UTC)
norwayturtle

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/4/2008(UTC)
Posts: 10

I am getting the signal for buy and sell everytime the price changes in realtime. How can I code it, so the signal every 30 min says buy only one time when the conditions is met??
wabbit  
#7 Posted : Saturday, May 31, 2008 12:21:28 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
With respect to real time data feeds into MS and the generation of multiple alets on the last bar when new ticks arrive, the simplest solution is to disable live-bars and only generate signals once the entire bar has been completed; another involves setting a trap so that all signals are computed on the second last bar, but the alert is displayed on the very last bar (so it will only ever display once)...

These solutions often don't match the requirement of the RT traders, especially over longer time frames such as 30 minutes or longer. There is a method using external functions which allows RT ticks to be received and alert conditions and indicators etc computed. It counts the times the condition is true on each tick for the last bar, then returns the counter to MS with the number of times the condition has been met and you can set the alert function to trigger as you like. This solution cannot be implemented in MSFL and requires the use of external functions.


wabbit [:D]

norwayturtle  
#8 Posted : Tuesday, June 24, 2008 12:40:54 PM(UTC)
norwayturtle

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/4/2008(UTC)
Posts: 10

Hi again! Now I need to program the same code to check for the 30 min close over the highest first bar with x ticks. For example: C > highest with 2 tick How can I program it?
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.