PureBytes Links
Trading Reference Links
|
Hi Jose,
I appreciate your reply.
The difference between the MA cross-over used in your example and the RWI is that the RWI signals the start of the trade with a one bar "spike" through 1. The indicator might stay above 1 for several bars or might return to below one immediately, but the signal will still be valid (unlike with a MA where the signal reverses when C crosses the MA). The reverse RWI signal (say the SHORT signal) takes place when a slightly different indicator spikes through 1. This might even happen while the "Long" indicator is still above 1. This would still indicate a reversal. I want the system to then take the opposite position, even though both signals are above one. The Alert function is difficult to use in this case.
Regards
Carl
----- Original Message -----
From: Jose Silva
To: equismetastock@xxxxxxxxxxxxxxx
Sent: Saturday, November 11, 2006 10:56 AM
Subject: [EquisMetaStock Group] Re: AST long bias problem
Carl, take a look at the indicator code below, and in particular note
how option #2 deals with same-bar trades.
MetaStock -> Tools -> Indicator Builder -> New ->
-> copy & paste complete formulae between "---8<---" lines.
====================
System trade signals
====================
---8<---------------------------
{ System trade signals v3.2
©Copyright 2005-2006 Jose Silva
For personal use only.
http://www.metastocktools.com
Note on simultaneous entry/exit on same bar:
#[1] Ignore:
entry/exit signals cancel each other;
#[2] Preference (given to):
new entry if currently Short,
new exit if currently Long.}
{ Signals reference example }
entry:=C>Mov(C,21,E);
exit:=C<Mov(C,10,E);
{ User inputs }
plot:=Input("Signals: [1]Clean, [2]All, [3]Trade binary",1,3,1);
choose:=Input("Simultaneous entry/exit: [1]Ignore,
[2]Preference",1,2,2);
delay:=Input("Entry and Exit delay",0,5,0);
{ Initialize signals }
init:=Cum(IsDefined(entry+exit))=1;
{ #1 - Ignore entry/exit on same bar }
bin1:=ValueWhen(1,entry-exit<>0 OR init,entry);
long:=bin1*(Alert(bin1=0,2)
OR entry*Cum(entry)=1);
short:=(bin1=0)*(Alert(bin1,2)
OR exit*Cum(exit)=1);
signals1:=long-short;
{ #2 - Preference to first entry/exit }
long:=entry*(Alert(entry=0,2)
OR entry*Cum(entry)=1);
short:=exit*(Alert(exit=0,2)
OR exit*Cum(exit)=1);
bin2:=ValueWhen(1,long-short<>0 OR init,long);
long:=bin2*(Alert(bin2=0,2)
OR entry*Cum(entry)=1);
short:=(bin2=0)*(Alert(bin2,2)
OR exit*Cum(exit)=1);
signals2:=long-short;
{ Select #1 or #2 }
binary:=If(choose=1,bin1,bin2);
signals:=If(choose=1,signals1,signals2);
{ Plot in own window }
Ref(If(plot=2,entry,0),-delay);
Ref(If(plot=1,signals,
If(plot=2,-exit,binary)),-delay)
---8<---------------------------
jose '-)
http://www.metastocktools.com
--- In equismetastock@xxxxxxxxxxxxxxx, "Carl van Heerden" <cj.vh@xxx>
wrote:
>
> Hi Jose,
>
> Here is the basic code
>
> To go long:
> RWIL(opt1,opt2)>1
>
> AND RWIH(opt3,opt4)>1
>
> To go Short:
> RWIH(opt1,opt2)>1
>
> AND RWIL(opt3,opt4)>1
>
> Straight forward, until it happens that both triggers are on the
> same bar. Then the Order Bias is forced either Long or Short
> according to your choice in EST. As I wrote before, the trades need
> to alternate.
>
> Regards
>
> Carl
>
>
>
>
> ----- Original Message -----
> From: Jose Silva
> To: equismetastock@xxxxxxxxxxxxxxx
> Sent: Friday, November 10, 2006 7:51 PM
> Subject: [EquisMetaStock Group] Re: AST long bias problem
>
>
> Carl, post your code here and we'll take a look at your problem.
>
>
> jose '-)
> http://www.metastocktools.com
>
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, "CJ van Heerden" <cj.vh@>
> wrote:
>
>
> Hi everyone,
>
> I need some help please.
>
> I have an indicator I want to test, but cannot get the code right.
>
> There is a Long signal. When it spikes through 1, I enter long.
> There is a Short signal. When it spikes through 1, I go short.
>
> So far so good. This is a stop and reverse system (the trailing
> stops will come later).
>
> Sometimes the two signals happen together. When that happens,
> I must reverse the position -i.e. if I am long, I must go short and
> vice versa. This is where I see my backside.
>
> This problem occurs because Advanced System Tester forces one to
> choose a long or short bias in such a case. It is not good enough.
> MS7.2 tested fine as it alternated automatically.
>
> I would appreciate some pointers. I basically need to let the
> system know whether I am currently long or short and let it make
> the correct decision to buy or sell when the two signals occur
> together.
>
> I am sure that someone in the group will have an elegant solution
> worked out. I would appreciate some help.
>
>
> Regards,
>
> Carl
__________ NOD32 1862 (20061110) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/equismetastock/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:equismetastock-digest@xxxxxxxxxxxxxxx
mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|