NexusFi: Find Your Edge


Home Menu

 





Tradestation Unable to Reference Account Purchasing Power


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,153 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
samuel3889
New York, NY
 
Posts: 5 since Mar 2023
Thanks Given: 3
Thanks Received: 0

Hello,

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

 
Code
print(GetRTPurchasingPower(GetAccountID))


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
Trump Media to sell instant access to market-moving soci …
Traders Hideout
Datafeed for Atas
Platforms and Indicators
My Rant with AMP Futures
Trading Reviews and Vendors
No book, only a stair: journaling fills where price move …
Cryptocurrency
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Mes vs MNQ
6 thanks
NexusFi site changelog and issues/problem reporting
5 thanks
BERN ALGOS algo trading journal
3 thanks
Johnnys Journal
2 thanks
TopStep Trader disappointment
2 thanks
  #2 (permalink)
grip
stockton california
 
Posts: 2 since Oct 2015
Thanks Given: 0
Thanks Received: 1


samuel3889 View Post
Hello,

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

 
Code
print(GetRTPurchasingPower(GetAccountID))


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.


 
Code

// First Code
value1 = GetRtPurchasingPower(GetAccountID);
Print(Value1);

// Second version

if LastBarOnChart Then
begin
    value1 = GetRtPurchasingPower(GetAccountID);
    Print(Value1);
end;


Reply With Quote
Thanked by:
  #3 (permalink)
samuel3889
New York, NY
 
Posts: 5 since Mar 2023
Thanks Given: 3
Thanks Received: 0


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.
 
Code
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.


Reply With Quote




Last Updated on May 7, 2023


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts