Page 1 of 1

is marketposition "global?"

Posted: Fri Apr 02, 2021 11:28 pm
by sbank
I have a question on the QScript variable marketposition.

If I have two charts up for the same security. For example, 1 hour ES, and Daily ES. If I am long 1 contract in the daily, what does marketposition return in the separate 1hour chart?

Does it return 1? or 0?

I just exited all my positions before the long weekend, or I would just try this. :) Of course I thought of this question in the afternoon when the CME was down. :)

Re: is marketposition "global?"

Posted: Wed Apr 07, 2021 5:57 pm
by earik
Hi sbank,

It's not global. It's a system testing variable, and works within the chart it's on. From the perspective of of marketposition, you can be long on one chart and short on the other, even if it's the same symbol. That's because it's a backtesting thing. (However, if you move out to the broker-level functions, like ib_marketposition(), that one will be global, since it reflects your actual trading account.)

Hope that helps.

Earik