NexusFi: Find Your Edge


Home Menu

 





Tradestation Unable to Reference Account Purchasing Power


Discussion in EasyLanguage Programming

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




 
Search this Thread

Tradestation Unable to Reference Account Purchasing Power

  #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?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts