Help With Metastock Formula

#1
HI,
I am trying to build an exploration with 2 conditions. Both have their own buy and sell signals. I want the exploration to run through stocks and select those on which one (or both) of the condition gives a buy and the other condition must have given a buy in the same stock some time back so that the price from then till now does not exceed 10%.
Consider the 2 conditions:
1) PS Fractal 2

F1:=ValueWhen(1,H<Ref(H,-2) AND Ref(H,-1)<Ref(H,-2) AND Ref(H,-3)<Ref(H,-2) AND Ref(H,-4)<Ref(H,-2),Ref(H,-2));
F2:=ValueWhen(2,L>Ref(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2),Ref(L,-2));

a:=Cross(H,F1);
b:=Cross(F2,L);

state:=If(BarsSince(a)<BarsSince(b),1,0);
state=1 AND Ref(state,-1)=0

2)PS Linear reg crossover

Cross(LinearReg(C,21),Mov(C,21,S))

Now if Fractal 2 gives a buy signal Today (I USE EOD DATA), and Linear Regg has given a buy signal sometime back and the price increase since then (Linear regg) is not over by 10% as of today. Then the exploration must pass the stock. and Likewise for vice versa i.e. If the stock gets a linear regression buy signal today and price increase from the buy signal of fractal 2 is less than 10%.
On the reports window, the exploration should have 2 columns. One for "fractal 2" and other for "linear regression". If Buy is triggered by fractal2, then for the corresponding stock in the fractal column there must be a 1, and in the column of linear reg there must be a 0.
In case on that day, both the Fractal 2 and Linear regression give buy signals, then both must have a 1 on their columns.
Elimination condition for the exploration:-
1) If any one or both the condition give a sell signal today or a few days before and has not been covered up with a exit sell signal or a buy signal
Sell signal for linear regression:-
Cross(Mov(C,21,S),LinearReg(C,21))
2) If one of them triggers a buy signal and the price increase (close price) from the day the other condition gave a buy signal > 10%

Atleast one buy signal must be generated today - either by fractal2 or linear reg.

I tried doing the coding for this by reading the formula book of metastock but since I am new to it, I am always getting some or the other error and usually arrive at a dead end.
If anyone could be kind enough to make a MS exploration for the above, I would appreciate it.
It would save me atleast an hours daily if I had an exploration like this.
I intend to add few more conditions once I get the hang of the code...

P.S.
Is it possible to reference a different exploration? If possible, the above could also be extended to the results of the few explorations I bought for which the author doesnt give me the formula for the BUY, Exit Buy, Sell and Exit sell.

Also, If you know some thread, forum, book or any resource on the web which teaches MS programming, kindly tell me.
Thank you.
 
#2
I am using the Window Vista Home Prem.-32 bit operating system. Almost all the custom built programme involving the technical indicators have been laid out in Excell Worksheet (a changed version of Excell worksheet in Professional XP O.S.) with the help of formulas collected over various websites. I have tried the Metastock in Excell worksheet. But certain commands/Programme Language is not compatible with Window Vista environment.

Please let me know you have developed the programme in which operating system ? Do you follow the Window microsolft Access OS or FoxPro ?
 

Similar threads