"Buy next bar at market"  [SOLVED]

Questions about MultiCharts and user contributed studies.
iceman
Posts: 39
Joined: 23 Oct 2009
Has thanked: 16 times

"Buy next bar at market"

Postby iceman » 21 Mar 2018

A common coding in a LE script, after conditions are met is often something like "Buy ( "MA2CrossLE" ) next bar at market"

So in a liquid market like CL, that should mean getting filled around 1 tick above the bar opening value. But I find this is almost never the case when running the in sim mode in real time. Any suggestions on how to resolve this? Do I need to specify Buy at "OPENING" of next bar at market

Thanks

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: "Buy next bar at market"

Postby TJ » 21 Mar 2018

A common coding in a LE script, after conditions are met is often something like "Buy ( "MA2CrossLE" ) next bar at market"

So in a liquid market like CL, that should mean getting filled around 1 tick above the bar opening value. But I find this is almost never the case when running the in sim mode in real time. Any suggestions on how to resolve this? Do I need to specify Buy at "OPENING" of next bar at market

Thanks

In futures trading, getting filled with 1 tick is considered normal; you can only buy on offer and sell on bid.

"next bar at market" is the same as "next bar at open"; you will get the same fill.

iceman
Posts: 39
Joined: 23 Oct 2009
Has thanked: 16 times

Re: "Buy next bar at market"

Postby iceman » 22 Mar 2018

Yes, I understand that, however often I get fills near the low of bar and lower than the opening, that would not happen if a buy at market order went in right at the opening of the next bar.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: "Buy next bar at market"

Postby TJ » 22 Mar 2018

Yes, I understand that, however often I get fills near the low of bar and lower than the opening, that would not happen if a buy at market order went in right at the opening of the next bar.

Are you talking about SIM or BACKTEST?

iceman
Posts: 39
Joined: 23 Oct 2009
Has thanked: 16 times

Re: "Buy next bar at market"

Postby iceman » 22 Mar 2018

Sim

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: "Buy next bar at market"

Postby TJ » 22 Mar 2018

Sim

Paper trading account?
Which broker?

InteractiveBrokers have the best paper trading account, because they use real live data feed that is exactly the same as your money account.

iceman
Posts: 39
Joined: 23 Oct 2009
Has thanked: 16 times

Re: "Buy next bar at market"

Postby iceman » 22 Mar 2018

Not running thru my brokerage account, just letting strategy run in real time using RT data from Esignal

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: "Buy next bar at market"

Postby TJ » 22 Mar 2018

Not running thru my brokerage account, just letting strategy run in real time using RT data from Esignal

Are you using IOG?

Seems like a coding error.

Please post your codes if you need further help.

iceman
Posts: 39
Joined: 23 Oct 2009
Has thanked: 16 times

Re: "Buy next bar at market"

Postby iceman » 22 Mar 2018

Yes, I have IOG enabled

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: "Buy next bar at market"

Postby TJ » 22 Mar 2018

Yes, I have IOG enabled

With IOG enabled, your logic will be evaluated every tick (instead of at EOB),
and your order will be sent IMMEDIATELY when the condition is met, it will not wait until the next bar.

Please go to Wiki to study the operation of IOG.

iceman
Posts: 39
Joined: 23 Oct 2009
Has thanked: 16 times

Re: "Buy next bar at market"  [SOLVED]

Postby iceman » 22 Mar 2018

Ok thanks TJ for your help


Return to “MultiCharts”