Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi pica[censored]> Although it's possible to carry an event forward and trigger a Buy one or more bars later (using a future event to confirm a current event), in my experience with the EST it's much easier (less potential problems) to code using a current event (trigger) one or more bars after a previous event (setup). In other words operating in the present and taking into account what's happened in the past. You cannot predict what's going to happen in the furture so why try and code that way? It can be done, of course, but the "what ifs" tend to complicate it, as I suspect you've already discovered.
Here's what I would start with. These buy orders take into account yesterday's CLOSE and ATR and buy close to but probably not at actually achievable prices. My code is not intended to be the solution, just some ideas on how to proceed.
{Buy Order (binary signals)} Event:=Ref(Cross(10,RSI(C,2)),-1); Target:=Ref(C-ATR(10),-1); If(Event,If(LOW<=Target AND OPEN>=Target,1, If(Min(LOW,OPEN)<=Target,1,0)),0);
{Buy Stop (price signals)} Event:=Ref(Cross(10,RSI(C,2)),-1); Target:=Ref(C-ATR(10),-1); If(Event,If(LOW<=Target AND OPEN>=Target,Target, If(Min(LOW,OPEN)<=Target,OPEN,0)),0);
Roy
|