how to have only 1 entry per bar

Questions about MultiCharts and user contributed studies.
User avatar
siscop
Posts: 197
Joined: 09 Jan 2011
Has thanked: 34 times
Been thanked: 29 times

how to have only 1 entry per bar

Postby siscop » 11 Sep 2015

When I am using a daychart, limit entry, setprofittarget and stoploss. How do I prevent a second reentry of a position when the TP or a SL is hit (within a big move)?
The first idea was to use in the settings intrabarordergeneration with the option only 1 entry per bar but then every tick the limit order was generated and deleted – so not really a API friendly way.

Erik Pepping
Posts: 74
Joined: 25 Aug 2007
Been thanked: 6 times

Re: how to have only 1 entry per bar

Postby Erik Pepping » 18 Sep 2015

There is an option in the properties for automated trading : Enter only once per bar.

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Re: how to have only 1 entry per bar

Postby tony » 18 Sep 2015

If your limit orders (for entry either long or short) are being cancelled because conditions for those orders are constantly changing you need to hold values so that when the limit is sent it does not cancel.

If you do use the setting as pointed out to only allow one entry per bar, you may still need some back up logic. I was using that with an ES and ZB scalping system (two different systems) and there were times where I would flip from a short position (exit the position) to a long entry in literally the same tick, and I was still able to get two entries per bar. It was a few millisecond time difference and for whatever reason the broker did not write back to MC quick enough.

deltastrike
Posts: 15
Joined: 11 Nov 2014
Has thanked: 5 times

Re: how to have only 1 entry per bar

Postby deltastrike » 03 Nov 2015

If your limit orders (for entry either long or short) are being cancelled because conditions for those orders are constantly changing you need to hold values so that when the limit is sent it does not cancel.

If you do use the setting as pointed out to only allow one entry per bar, you may still need some back up logic. I was using that with an ES and ZB scalping system (two different systems) and there were times where I would flip from a short position (exit the position) to a long entry in literally the same tick, and I was still able to get two entries per bar. It was a few millisecond time difference and for whatever reason the broker did not write back to MC quick enough.
I'm dealing with this problem too... I was thinking about implementing some logic also since the "One Entry per bar" setting doesn't seem to work very well. Here's the pseudo code I was planning on implementing:

Code: Select all

//Buying condition true
If condition1 and BC = False then begin
buy next bar at limit;
end;

//Selling condition true
If condition2 and BC = False then begin
sellshort next bar at limit;
end;


If MP<>0 then begin
BC = True;
end;

//If entry signal true at prior bar, but false for current bar, BC = True, and MP = 0 (position already closed out)
If condition1[1] and condition2[1] and !condition1 and !condition2 and BC = True and MP = 0 then begin
BC = False;
end;


Return to “MultiCharts”