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

Re: Coding problem



PureBytes Links

Trading Reference Links

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;