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

Notification

Icon
Error

Options
Go to last post Go to first unread
Gregor  
#1 Posted : Thursday, October 9, 2008 10:41:56 AM(UTC)
Gregor

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 6/12/2007(UTC)
Posts: 32

How do you merge two formulas into one???

I have a channel system that has two set-up signals, titled B1 and B2, which at present have their own separate formulas. I wish to combine these into a single formula creating a single composite signal. Below are the two formulas:

{B1 with entry signal}

{Channel}

x:=7;

y:=1.05;

z:=0.95;

UB:= Mov(C,x,S)*y;

EMA:= Mov(C,x,E);

LB:= Mov(C,x,S)*z;

{Acceptable high break above UB with rising UB}

B1:= H>UB AND H<=UB+(0.75*Abs(EMA-UB)) AND ValueWhen(1, H>UB, UB>Ref(UB,-1) );

{Entry - Price Piont}

sig:=L<=ValueWhen(1,B1, EMA-(0.2*(EMA-LB)));

{Entry-Price Piont projection}

trade:= If(b1, 0, If(sig,1, PREV));

Cross(trade=1,0.5);

{B2 with entry signal}

{Channel}

x:=7;

y:=1.05;

z:=0.95;

UB:= Mov(C,x,S)*y;

EMA:= Mov(C,x,E);

LB:= Mov(C,x,S)*z;

{Acceptable high break above UB with rising UB}

B2:= UB>H AND L>EMA;

{Price Piont}

sig:=L<=ValueWhen(1,B2, EMA-(0.2*(EMA-LB)));

{Price Piont projection}

trade:= If(b1, 0, If(sig,1, PREV));

Cross(trade=1,0.5);

I’ve been told to find a solution three questions must be answered

Q1. Which set-up condition occurs first?

A1. B1setup.

Q2. How soon after the second signal has to be the first?

A2. Could be as early as the very next price bar.

Q3 Is there any event or signal that would stop the second signal?

A3 There are 4 events that would stop signal

a) If second bar was an entry signal

b) If second bar was another B1 then this would become the new set-up signal

c) If second bar was a B2 then this would become the new set-up signal

d) If there is no B2 or B1 signal along with no entry signal

Equally it should be noted that if

a) The third bar is a B1 this would become the new set-up signal

b) The third bar was an entry signal

c) The third bar is a B2 this would become the new set-up signal

d) If there is no B2 or B1 signal along with no entry signal.

Yours truly

Gregor[:)]
oztrader  
#2 Posted : Thursday, October 9, 2008 9:23:34 PM(UTC)
oztrader

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 7/12/2007(UTC)
Posts: 134
Location: Perth Western Australia

Hi Gregor,

You can combine these signals quite simply by using the code
Code:
B1 OR B2;
but you will need to deal with an issue with B2 first.

In an effort to reduce the amount of code it is worth remembering that this example code "UB>Ref(UB,-1)" will give a value of 1 if this statement is correct (and 0 if incorrect).

Based on the example above the code for B1, including the price signal, can be written as:-
Code:
B1:=H>UB AND H<=UB+(0.75*Abs(EMA-UB)) AND
UB>Ref(UB,-1) AND L<=EMA-(0.2*(EMA-LB));


B2 can be coded along similar lines as B1 however, in its current format, B2 will never issue a signal.
The entry conditions as I have interpreted them for B2 are listed as follows:-
1) The UpperBand must be greater than the High,
2) The Low must be greater than the Exponential Moving Average (EMA) and
3) The Low must be less than or equal to an amount eqivalent to deducting 20% of the difference between the EMA and the LowerBand from the EMA,
thus resulting in a conflict between 2 & 3 and I have no idea which condition you would want to alter.

Cheers,
oz
Gregor  
#3 Posted : Monday, October 13, 2008 7:51:22 AM(UTC)
Gregor

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 6/12/2007(UTC)
Posts: 32

Oz

Thank you for replying to my posting.

{Solution}

I am not sure I have this right? The solution places the coding for entry signal into the coding for B1 and then into B2, so as to be able to use the OR statement to create the composite signal. This would mean that B1 and B2 Set-ups would then become the trigger to create an entry signal. That is to say that B1 or B2’s low would have to break below the EMA by 20% of the difference of the EMA and the Upper band.

{The system}

B1 and B2 set-ups are used to calculate the entry point [through what I call the “price point” and “price projection”]. It is the low of any future price bar other than B1 or B2 [as these set-ups would only recalculate an new entry point] breaking this point would create an entry signal. This I believe removes the conflict of B2 not being able to create an entry signal, as it’s only being use as a set-up not a trigger.

It maybe best to ask the question on how to create composite as; how to create a new variable statement combing the two set-ups B1 and B2 that meets the system rules. This would mean I would be able to drop the new variable into both “price point” and “price projection” line in the formula.

Is it possible to create a new variable statement that combines B1 and B2 with the system rules?

Yours Turly

Gregor[:)]

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.