is marketposition "global?"

Have a QScript to share, or need help with programming? Post your comment here.
Post Reply
sbank
Posts: 174
Joined: Tue Jul 21, 2015 9:35 pm
Contact:

is marketposition "global?"

Post by sbank » Fri Apr 02, 2021 11:28 pm

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. :)

User avatar
earik
Site Admin
Posts: 474
Joined: Mon Dec 01, 2014 12:41 pm
Contact:

Re: is marketposition "global?"

Post by earik » Wed Apr 07, 2021 5:57 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests