PureBytes Links
Trading Reference Links
|
> We could try following the suggestion of our friend who tried to give
> a solution making in this way:
>
> {1st signal}
> if currentbar=10 then sell1 contract;
> {2nd signal}
> if currentbar=15 then begin
> if marketposition>=0 then buy1 contract at Close/2 stop else
> exitshort 1 contract total at Close/2 stop;
> end;
> {3rd signal}
> if currentbar=15 then begin
> if marketposition>=0 then buy1 contract at Close/2 stop else
> exitshort 1 contract total at Close/2 stop;
> end;
> ...no, nothing to do! now we are Flat!!
That's because you executed signals 2 and 3 on the SAME BAR. When
CurrentBar = 15, MarketPosition is still -1 from the short position.
And MarketPosition doesn't change until the CLOSE of the bar. So you
issued TWO EXITLONG signals and never issued a buy order.
Change signal 3 to "if currentbar=20" and you'll end up long one
contract on bar 20, just like you wanted.
The method I suggested DOES work to add/subtract contracts. It's a
bit clumsy but it works.
Gary
|