[Bug Report] BUY & SELL ORDER

Questions about MultiCharts and user contributed studies.
ppan
Posts: 106
Joined: 31 Jan 2007
Has thanked: 2 times

[Bug Report] BUY & SELL ORDER

Postby ppan » 28 Apr 2009

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;
----------------------------------------------------------------------------

SUPER
Posts: 622
Joined: 03 Mar 2007
Has thanked: 99 times
Been thanked: 80 times

Postby SUPER » 29 Apr 2009

SELL ("S1") 1 CONTRACT TOTAL NEXT BAR AT MARKET;

your code says sell 1 contract and that could be your problem.

try

IF MARKETPOSITION <> 0 THEN BEGIN
SELL ("S1") NEXT BAR AT MARKET;
END;

ppan
Posts: 106
Joined: 31 Jan 2007
Has thanked: 2 times

Postby ppan » 29 Apr 2009

Hi SUPER,

I want to sell 1 contract every minute after buy 50 contracts until no more position.

I don't know if the code is right.

SUPER
Posts: 622
Joined: 03 Mar 2007
Has thanked: 99 times
Been thanked: 80 times

Postby SUPER » 29 Apr 2009

ppan,

Marina posted a code for you some time back on following link, I think it will do what you are looking for.

http://forum.tssupport.com/viewtopic.ph ... highlight=

Regards
Super

User avatar
TJ
Posts: 6551
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 966 times
Been thanked: 1892 times

Postby TJ » 29 Apr 2009

Hi SUPER,

I want to sell 1 contract every minute after buy 50 contracts until no more position.

I don't know if the code is right.



if you don't know if the code is right...
then please do not use the heading [BUG REPORT]

ppan
Posts: 106
Joined: 31 Jan 2007
Has thanked: 2 times

Postby ppan » 29 Apr 2009

Sorry, I got a mistake.

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Re: [Bug Report] BUY & SELL ORDER

Postby Marina Pashkova » 30 Apr 2009

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;
----------------------------------------------------------------------------


Hi ppan,

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.


Return to “MultiCharts”