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

R: Coding problem



PureBytes Links

Trading Reference Links

Tks for your answer.
I try to better explain.

Below is an example of code:

input:starttime(0915)
=lets guess to have for each day a trigger level and to sell above it=


if time>startime then begin
sell at trigger limit;
end;

=if I exit this position with the built in functions Trailing stop or Money
Management stop and the price then is above or will reach the trigger level
the systems generate a new short position.
But I need only 1 order for each day to be short and only 1 if I want to go
long=

-----Messaggio originale-----
Da: Mike Eggleston [mailto:mikee@xxxxxxxxxxxxxx]
Inviato: martedì 4 giugno 2002 15.11
A: Scorpio Massimiliano
Cc: 'omega-list@xxxxxxxxxx'
Oggetto: Re: Coding problem


On Tue, 04 Jun 2002, Scorpio Massimiliano wrote:

> Hello,
> I'm using 60 minutes chart  and I'm trying to make a system where there is
a
> Limit order to Sell (Buy) on a prefixed level above (below) the high(low)
of
> yesterday.
> 
> The order should take place starting from the second bar.
> 
> The problem is that if the position is exited using trailing stop ot money
> management stop and the condition is still active the system generate a
new
> order.
> 
> My target is to have only one signal for each order (If I'm long I only
want
> to have a sell order or the opposite).
> 
> Any suggestion to manage this trouble.
> 
> I'm thinking about some variable to use.

Could you do something like this?

vars: intrade(false), inlong(false);

if (intrade = true or CurrentEntries > 0) and inlong = true and
some-exit-condition-is-true then begin
	sell this bar on close;
	intrade = false;
end;
if (intrade = true or CurrentEntries > 0) and inlong = false and
some-exit-condition-is-true then begin
	buytocover this bar on close;
	intrade = false;
end;

if (intrade = false or CurrentEntries = 0) and some-condition-is-true then
begin
	buy this bar on close;
	intrade = true;
	inlong = true;
end;
if (intrade = false or CurrentEntries = 0) and some-condition-is-true then
begin
	sellshort this bar on close;
	intrade = true;
	inlong = false;
end;


"Nota di riservatezza: Il presente messaggio, corredato dei relativi
allegati contiene informazioni da considerarsi strettamente riservate, ed è
destinato esclusivamente al destinatario sopra indicato, il quale è l'unico
autorizzato ad usarlo, copiarlo e, sotto la propria responsabilità,
diffonderlo. Chiunque ricevesse questo messaggio per errore o comunque lo
leggesse senza esserne legittimato è avvertito che trattenerlo, copiarlo,
divulgarlo, distribuirlo a persone diverse dal destinatario è severamente
proibito, ed è pregato di rinviarlo immediatamente al mittente distruggendo
l'originale"

"Confidentiality Notice: This message, together with its annexes, contains
information to be deemed strictly confidential and is destined only to the
addressee (s) identified above who only may use, copy and, under his/their
responsibility , further disseminate it. If anyone received this message by
mistake or reads it without entitlement is forewarned that keeping, copying,
disseminating or distributing this message to persons other than the
addressee (s) is strictly forbidden and is asked to transmit it immediately
to the sender and to erase the original message received."