A question about multi-exits  [SOLVED]

Questions about MultiCharts and user contributed studies.
BigCollins
Posts: 1
Joined: 08 Aug 2013
Has thanked: 2 times

A question about multi-exits

Postby BigCollins » 08 Aug 2013

Hello every body, i have a problem about multi-exits.
I want to open 6 contracts at one time, and close it separately one by one at Lowest(L,1) of each subsequent bars, my code is:

Code: Select all

[intrabarordergeneration = false]
if marketposition <> 1 then
buy 6 contracts next bar at Highest(H,20) stop;
if marketposition = 1 then
sell 1 contracts next bar at Lowest(L,1) stop;
I expect one open-buy signal with 6 contracts and 6 close-sell signal with 1 contracts each, but it doesn't work, i got one open-buy signal with 6 contracts and one close-sell signal with only 1 contracts. why?
can any one help me? thank you very much!

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: A question about multi-exits

Postby Andrew MultiCharts » 08 Aug 2013

Hello BigCollins,

You should either have separate lines to exit in the body of your script or use SameExitFromOneEntryOnce attribute in the signal.

User avatar
piranhaxp
Posts: 241
Joined: 18 Oct 2005
Has thanked: 4 times
Been thanked: 30 times

Re: A question about multi-exits  [SOLVED]

Postby piranhaxp » 08 Aug 2013

First question : Is ....

Code: Select all

lowest( low, 1 )
not equal to

Code: Select all

low[1]
?

Second question : Please can you check this ......

Code: Select all

input: lp(1) ; // low's from past ... for opt only

var: cc(0) ; // amount of contracts in position = currentcontracts
var: mp(0) ; // equals marketposition
var: bb(0) ; // conversion of lp into var .. bb = bars back

cc = currentcontracts ;
mp = marketposition ;
bb = lp ;


if mp = 1 then
begin
if cc = 6 then
begin
sell 1 contracts next bar at lowest( low, 1 ) stop;
// may you try low[1] instead of lowest( low, 1 )
end;
if cc = 5 then
begin
sell 1 contracts next bar at lowest( low, 1 ) stop;
end;

... and so on
... Should look like this if correct implemented.

Image

Regards.

Mike


Return to “MultiCharts”