Hi Rob,
Thanks for the detailed reply. I must be doing something wrong as I can't get the code to work properly. If my buy formula is C>Mov(C,8,E) and my exit formula is C<Mov(C,21,E) would you show me exactly where these would go in your code. Thanks again for your help.
--- In
equismetastock@ yahoogroups. com, Rob Tinley <gazumped2@x ..> wrote:
>
> You will need to include your full entry code for "trade" to be effective.
> Â
> Below is a detailed example showing the buytrigger as only 1 component of the buyformula. The same is also applicable to the exit.
> Â
> {Expert Adviser - Highlight bars when in Trade}
> buytrigger:=
> Sum(C>Ref(C, -1),3)=3;
> buyformula:=
>
Ref(buytrigger, -1)Â AND OPEN>Ref(C,- 1);
> exittrigger: =
> Sum(C<Ref(C, -1),2)=2;
> exitformula: =
> Ref(exittrigger, -1) AND OPEN<Ref(C,- 1);
> set:= buyformula;
> reset:= exitformula;
> init:=Cum(set+ reset>-1) =1;
> trade:=BarsSince( init OR set)<BarsSince( init OR reset);
> trade
> Â
> Â
> {Expert Adviser - BuyTrigger Symbol}Â {Also use this code for Explorations}
> {Will only show buytriggers when not in a trade}
> buytrigger:=
> Sum(C>Ref(C, -1),3)=3;
> buyformula:=
> Ref(buytrigger, -1)Â AND OPEN>Ref(C,- 1);
> exittrigger: =
> Sum(C<Ref(C, -1),2)=2;
> exitformula: =
> Ref(exittrigger, -1) AND OPEN<Ref(C,- 1);
> set:= buyformula;
> reset:= exitformula;
> init:=Cum(set+ reset>-1) =1;
> trade:=BarsSince( init OR set)<BarsSince( init
OR reset);
> trade<1 AND buytrigger
> Â
> Â
> {Expert Adviser - ExitTrigger Symbol}
> {Will only show exittriggers when in a trade}
> buytrigger:=
> Sum(C>Ref(C, -1),3)=3;
> buyformula:=
> Ref(buytrigger, -1)Â AND OPEN>Ref(C,- 1);
> exittrigger: =
> Sum(C<Ref(C, -1),2)=2;
> exitformula: =
> Ref(exittrigger, -1) AND OPEN<Ref(C,- 1);
> set:= buyformula;
> reset:= exitformula;
> init:=Cum(set+ reset>-1) =1;
> trade:=BarsSince( init OR set)<BarsSince( init OR reset);
> trade AND exittrigger
> Â
> Â
> For BuyTrigger Explorations use the code for the EA - BuyTrigger Symbol
>
> --- On Fri, 12/3/10, skypilot_jw <jweidner@xx .> wrote:
>
>
> From: skypilot_jw <jweidner@xx .>
> Subject: [EquisMetaStock Group] Latch Code
Question
> To:
equismetastock@ yahoogroups. com> Received: Friday, 12 March, 2010, 5:21 PM
>
>
> Â
>
>
>
> I use MS 9.0 EOD and have set up an expert with the usual buy and sell latch parameters of:
>
> set:= buy formula;
> reset:= exit formula;
> init:=Cum(set+ reset>-1) =1;
> trade:=BarsSince( init OR set)<BarsSince( init OR reset);
> trade
> AND Alert(trade= 0,2)
>
> I also use the same code in the explorer to find securities which have triggered.
>
> My question is this.
> When my expert triggers a buy signal, I place a buy order for the next day based on the high of the triggered signal. If the market price the next day does not exceed
the high, then my buy order is not executed. However, the code has latched the security and will not reset until the latch code triggers the exit formula (Close below 21 EMA for example). After the market close when I run another exploration, the same security will not appear on the explorer report because it is stll latched (has met the entry formula but hasn't triggered the exit formula). Is there a way to code it so that when a security triggers a buy, and the following day's high is lower than the previous day's high, the latch exits and will re-latch when the buy formula is met again.
>
> Thanks for your help with this.
>