Try the following code in a 1 minute chart. Turn on the Position Limits:
Signal -> Properties -> Select the "Allow up to 100 entry orders" and Select the "regardless of the entry that generated the order".
The S1 will exit 1 contract only. Is it a bug?:
----------------------------------------------------------------------------
SETEXITONCLOSE;
IF DATE <> DATE[1] THEN BEGIN
BUY ("B50") 50 CONTRACTS NEXT BAR AT MARKET;
END;
IF MARKETPOSITION <> 0 THEN BEGIN
SELL ("S1") 1 CONTRACT TOTAL NEXT BAR AT MARKET;
END;
----------------------------------------------------------------------------
[Bug Report] BUY & SELL ORDER
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Re: [Bug Report] BUY & SELL ORDER
Hi ppan,Try the following code in a 1 minute chart. Turn on the Position Limits:
Signal -> Properties -> Select the "Allow up to 100 entry orders" and Select the "regardless of the entry that generated the order".
The S1 will exit 1 contract only. Is it a bug?:
----------------------------------------------------------------------------
SETEXITONCLOSE;
IF DATE <> DATE[1] THEN BEGIN
BUY ("B50") 50 CONTRACTS NEXT BAR AT MARKET;
END;
IF MARKETPOSITION <> 0 THEN BEGIN
SELL ("S1") 1 CONTRACT TOTAL NEXT BAR AT MARKET;
END;
----------------------------------------------------------------------------
This is not a bug. Judging by your description that code works exactly the way it should.
Super is right. To achieve what you are describing you would need to write a code containing multiple exits. The code posted above, on the other hand, should and will generate one order to sell one contract.
P.S. You also mentioned that you enabled pyramiding. Please note that this setting only works for entries and will have no effet on exits.