Page 1 of 1

"Buy next bar at market"

Posted: Mar 21 2018
by iceman
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

Re: "Buy next bar at market"

Posted: Mar 21 2018
by TJ
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.

Re: "Buy next bar at market"

Posted: Mar 22 2018
by iceman
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.

Re: "Buy next bar at market"

Posted: Mar 22 2018
by TJ
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?

Re: "Buy next bar at market"

Posted: Mar 22 2018
by iceman
Sim

Re: "Buy next bar at market"

Posted: Mar 22 2018
by TJ
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.

Re: "Buy next bar at market"

Posted: Mar 22 2018
by iceman
Not running thru my brokerage account, just letting strategy run in real time using RT data from Esignal

Re: "Buy next bar at market"

Posted: Mar 22 2018
by TJ
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.

Re: "Buy next bar at market"

Posted: Mar 22 2018
by iceman
Yes, I have IOG enabled

Re: "Buy next bar at market"

Posted: Mar 22 2018
by TJ
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.

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

Posted: Mar 22 2018
by iceman
Ok thanks TJ for your help