PureBytes Links
Trading Reference Links
|
Thanks Glen and Roy!
Nice work - just what I was looking for.
Jeff
Roy Larsen wrote:
>Jeff
>
>By adding an initialisation variable to Glens' solution you should be able to
> pick up the first long
>(or short) trade also. This would look like
>
>LongEntry:= {your long entry parameters};
>ShortEntry:= {your short entry parameters};
>Init:=Cum(LongEntry<>2 and ShortEntry<>2)=1;
>LongEntry AND BarsSince(Ref(LongEntry OR Init, -1)) >=
> BarsSince(Ref(ShortEntry OR Init, -1))
>
>The following variables lifted from the Trade Binary I posted several weeks ago
> show how an Init
>variable can be used with entry and exit signals to create a useful "flag"
> showing whether in a long
>trade, short trade, or out. This Trade variable has a value of +2 for a long
> trade, -1 for a short
>trade, +1 for both, and 0 for neither. Very useful once you get to grips with
> it.
>
>Init:=Cum(EnterLong<>2 AND CloseLong<>2 AND
> EnterShort<>2 AND CloseShort<>2 )=1;
>Trade:=Ref(If(BarsSince(EnterLong OR Init)>=BarsSince(CloseLong OR Init),0,2) +
> If(BarsSince(EnterShort OR Init)>=BarsSince(CloseShort OR Init),0,-1),-0);
>
>Roy
>
>
>> You can use
>>
>> LongEntry:= {your long entry parameters};
>> ShortEntry:= {your short entry parameters};
>> LongEntry AND BarsSince(Ref(LongEntry, -1)) >=
>> BarsSince(Ref(ShortEntry, -1))
>>
>> although it will not plot the very first long entry in the
>> data series.
>>
>> Hope this helps.
>>
>>
>>
>> ----- Original Message -----
>> From: "Jeff Haferman" <Jeff_Haferman@xxxxxxxxx>
>> To: <metastock@xxxxxxxxxxxxx>
>> Sent: Friday, July 27, 2001 9:15 AM
>> Subject: Expert Advisor "buy/sell signal" question
>>
>> > In the expert advisor, when I am generating a buy/sell
>> > signal, how do I tell Metastock to generate
>> > the signal only if the preceding signal was in the
>> > opposite direction?
>> >
>> > eg I only want a buy arrow if the previous arrow was a
>> > sell... I don't want to see several buy arrows in
>> > succession.
>> >
>> > Thx,
>> > Jeff
>>
>>
>>
>
|