Rank: Newbie
Groups: Registered, Registered Users Joined: 4/2/2009(UTC) Posts: 6
|
Recently I've been struggling to write an Explorer using a price oscillator based on the difference between the 13 EMA and a 20 SMA that will give me a signal when there is a down day (red bar) after 3 consecutive up days (green bars). Here is the formula for the Price Oscillator (PO):
If(Fml("po long")>Ref(Fml("po long"),-1),Fml("po long"),0); If(Fml("po long")<Ref(Fml("po long"),-1),Fml("po long"),0)
with the formula for "po long" as:
Mov(C,13,E)-Mov(C,20,S)
So far I've had no success with different attempts at writing an Explorer, the most recent of which is this: Col A = Fml( "PO") < Ref(Fml( "PO"),-1) Col B = Ref(Fml( "PO"),-1) > Ref(Fml( "PO"),-2) Col C = Ref(Fml( "PO"),-2) > Ref(Fml( "PO"),-3) Col D = Ref(Fml( "PO"),-3) > Ref(Fml("PO"),-4)
If anyone has any ideas on how to make this work or any resources that might show me the light I would greatly appreciate it. Thank you for your time.
|
|
|
|
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)
|
What's the filter condition? All you have done is load up each column with information but haven't told Explorer what to do with it! If you don't actually need the data in the columns, then just write the whole expression in the filter; something like: Code:
{filter}
po:=mov(c,13,e)-mov(c,20,s); {you mixed moving average types here!?}
cond1:=po<Ref(po,-1);
cond2:=Ref(po,-1)>Ref(po,-2);
cond3:=Ref(po,-2)>Ref(po,-3);
cond4:=Ref(po,-3)>Ref(po,-4);
cond1 and cond2 and cond3 and cond4;
which can also be rewritten (depending on your inequality expressions) something like: Code:
{filter}
po:=mov(c,13,e)-mov(c,20,s);
test:=po>ref(po,-1);
test=0 and sum(test,4)=3;
wabbit [:D]
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 4/2/2009(UTC) Posts: 6
|
Sorry I don't know why I didn't post the filter condition too. I had it set to colA=1 and colB=1 and colC=1 and colD=1 but it hadn't been working. I just tried your solution and it worked wonderfully, thank you. I didn't know you could write everything in the filter but I will start trying that now. As for the different MAs it was accidental I just missed it. Thanks again for your help.
|
|
|
|
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.