Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Tradestation Unable to Reference Account Purchasing Power
I'm trying to reference my Tradestation futures account's real-time purchasing power in my strategy, but the following line of code prints out "0.00" in the Print Log. I can't figure out why this is happening for the life of me. Is this maybe what the line returns when markets are closed over the weekend?
Thank you,
Samuel
Can you help answer these questions from other members on NexusFi?
Try to capture into a variable first and then reference the variable. I ran below and both work worked fine.
The first version will load into the print log 0.00 until it finally loads the last bar. If you only want it to concentrate on the last bar then try the second code.
// First Code
value1 = GetRtPurchasingPower(GetAccountID);
Print(Value1);
// Second version
if LastBarOnChart Then
begin
value1 = GetRtPurchasingPower(GetAccountID);
Print(Value1);
end;
Interesting... I ran your code in an indicator and it worked well. It just does not work in my main strategy and I've figured out the problem.
The problem: RT Purchasing Power returns the actual value on the last bar of the chart it is applied to on indicators and strategies (probably other types of codes too). The code does not run on the last bar of the chart when you have "open next bar" in the strategy. Because my strategy places a buy order using the code fragment below, it doesn't update the RT Purchasing Power on the close of the most recent bar.
buy ("S1 RT") minlist(vContractsRT, iMaxContractsRT) contracts next bar at open of next bar limit;
Possible Solution: Since the strategy calculates only on the first tick of the next bar, I will ignore what the print log says unless it prints on the open of a new bar.