Need Ave Entry Price when Scaling in with Volume bars

Questions about MultiCharts and user contributed studies.
sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Need Ave Entry Price when Scaling in with Volume bars

Postby sptrader » 20 Jul 2016

I use a 20k volume chart (contract bars) on ES and I scale in my trades, in several levels, using chart trader. I'm trying to autotrade the exits but I can't get the average entry price to match my IB broker price..intrabarordergeneration is set to true.

I've tried :
value1 = AvgEntryPrice_at_Broker;

value1 = AvgEntryPrice_at_Broker_for_the_strategy;

value1 = avgEntryPrice;

also tried recalclastbarafter(3) with each and still can't get "Current" average entry price, even close to my Brokers price...

Any ideas ? is there a function that reads "avg entry price" directly from the broker ? (IB)
I need to read the EP intrabar since low volume days take a long time to close a 20k bar.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Need Ave Entry Price when Scaling in with Volume bars

Postby Henry MultiСharts » 21 Jul 2016

Hello sptrader,

AvgEntryPrice_at_Broker is returned by the broker, but IB includes commission in it. In MultiCharts this value is being rounded to the instrument's price scaling settings, that is why it can mismatch with IB TWS.

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: Need Ave Entry Price when Scaling in with Volume bars

Postby sptrader » 21 Jul 2016

Hello sptrader,

AvgEntryPrice_at_Broker is returned by the broker, but IB includes commission in it. In MultiCharts this value is being rounded to the instrument's price scaling settings, that is why it can mismatch with IB TWS.
**************************
Henry: So there's no way for MC to Match IB's average price on the IB trading screen ?
When I add more contracts using charttrader to scale in, "AvgEntryPrice_at_Broker", acts like it's not being updated..
If I status off, then back on, the "auto exit" code, the average price is correct.(updated).

my code for average entryprice is:

Code: Select all

if LastBarOnChart_s = true then begin
ep = Round2Fraction(AvgEntryPrice_at_Broker);// should give avg price rounded to nearest .25 for ES
RecalcLastBarAfter(3);// to allow for slow volume bars..
end;

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Need Ave Entry Price when Scaling in with Volume bars

Postby Henry MultiСharts » 21 Jul 2016

When I add more contracts using charttrader to scale in, "AvgEntryPrice_at_Broker", acts like it's not being updated..
If I status off, then back on, the "auto exit" code, the average price is correct.(updated).
That is expected. Your auto trading position values are not automatically synchronized with your manual trading actions. Please refer to the following topics:
viewtopic.php?f=1&t=10817
viewtopic.php?f=16&t=8499#p56745


Return to “MultiCharts”