Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 2/13/2009(UTC) Posts: 2
|
Guys, please help to solve the following problem:
if today for example mov(close,10,S)>mov(close,15,S) then
barssince(mov(close,10,S)>mov(close,15,S)) will return 0 as distance in bars to last occurence of such event when it was true, but how can I get distance in bars to previous occurence of the event mov(close,10,S)>mov(close,15,S) before today?
Thanks
|
|
|
|
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 Foxer, Welcome to the forum. Have a read of the MS User Manual, then attempt all of the programming exercises in the free Equis Formula Primer (available for free download from the files section of the forum). These will give you the programming skills you need to be able to perform these programming tasks for yourself. Also, have a good peruse through the forum as it already contains many questions just like yours which have been answered; sometimes there are many different ways to achieve an objective and the knowledgable forum members have shown these so you can choose a method which best suits you. I don't quite understand what it is you're looking for, so this code might be not the exact answer to your problem, but I do hope it gives you some inspiration to try some different approaches. Code:
event:=Mov(CLOSE,10,S)>Mov(CLOSE,15,S);
counter:=BarsSince(event);
If(event,Ref(counter,-1)+1,counter)
Are you sure you're looking for the "greater than " event and not a "crossing" event? wabbit [:D]
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 2/13/2009(UTC) Posts: 2
|
Hi Wabbit,
Thank you for your help and suggestions, I will try suggested by you approach.
Concerning your question about "greater than " event or "crossing" event, it does not matter for my case, I have used greater than for example. The main question for me is a method to get distance in bars to previous occurence of the event which is true today.
Thanks & Best regards,
FoxerFX
|
|
|
|
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.