[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: CL_Programming stops in EL



PureBytes Links

Trading Reference Links

Bill,

You can write an exit statement in EL that will take effect on the same bar
as the entry statement. You would need to code this so that the exit
statement is issued on the bar before entry and ONLY works on the bar of
entry, and code another exit statement to take care of the exits after the
bar of entry.

Suppose you are using daily bars and you want to program a "canned" money
management stop of $1,000 that would take place on the day of entry do this:

If marketposition = 0 and Condition1 {entry condition} then begin
    Buy Open;
    Exitlong Open Tomorrow - 1000/bigpointvalue stop;
End;

{For the days after the day of entry}
If marketposition = 1 then exitlong entryprice - 1000/bigpointvalue stop;

Note: As Sam Tennis pointed out, TS has no awareness that the entry has
occurred until after the day of entry, so you cannot use "entryprice" on the
day of entry. Also, the exit statement that takes care of the day-of-entry
exit must not be allowed to work after the day of entry, hence it must be
embedded in the [begin ... end] statement with the entry condition as shown.
As Bill Brower pointed out, the "open tomorrow" statement may not work in
some circumstances, such as when you have multiple data streams in the entry
condition, and you might need to install a "nextopen"-type DLL. However,
this code should give a general concept of how day-of-entry exits can be
done.

Hope this is helpful.

Regards,
Terence Tan



> -----Original Message-----
> This is the crux of the biscuit: How do I write an exit statement
> in EL that will take effect on the same bar
> as the entry statement? or maybe the question should be CAN I...?
>
> Any help is appreciated.
>
> Regards,
> Bill Vedder
>