I want to code for an indicator that shows how much time has passed since I put a trade. If 5 minutes or more have passed and the unrealized P&L is less than 5 ticks, I want an alert to be posted. The code seems to be okay but for a programming error which seems to have something to do with my use of "PositionAccount". I have checked the NT8 help guide on it and it seems I am using it correctly but for some reason I keep getting the programming error. Could you please have a look at my simple indicator which I have attached for your reference and could you enlighten me on how to use "PositionAccount" appropriately? I have tried my best with the scanty information provided in the help guide to no avail. Thanks.
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Problem with PositionAccount
Collapse
X
-
Problem with PositionAccount
Hi
I want to code for an indicator that shows how much time has passed since I put a trade. If 5 minutes or more have passed and the unrealized P&L is less than 5 ticks, I want an alert to be posted. The code seems to be okay but for a programming error which seems to have something to do with my use of "PositionAccount". I have checked the NT8 help guide on it and it seems I am using it correctly but for some reason I keep getting the programming error. Could you please have a look at my simple indicator which I have attached for your reference and could you enlighten me on how to use "PositionAccount" appropriately? I have tried my best with the scanty information provided in the help guide to no avail. Thanks. -
Hello mbesha,
There is not an object in NinjaTrader called PositionAccount. Is this an object or class that you have created? Was this created in a different file? (I'm not seeing that a class or variable named PositionAccount was declared in this strategy)
Are you trying to check the position of the strategy?
if (Position.MarketPosition == MarketPosition.Long)
{
// execute code
}
Below is a link to the help guide on Position.MarketPosition.
http://ninjatrader.com/support/helpG...etposition.htm
Also, below is a link to the section of the forums for NinjaTrader 8 related items.
http://ninjatrader.com/support/forum...splay.php?f=59Chelsea B.NinjaTrader Customer Service
-
Comment
-
Hello mbesha,
I am not able to see this screenshot.
Was this attached as an attachment to your post? (and not as a picture)
Can you provide a link to the page of the help guide you are referring to?
Where you able to find the code you need from the link in the help guide that I have provided you in post #2.
Did you make sure you used a capital P on Position as shown in the help guide link I have provided you?Chelsea B.NinjaTrader Customer Service
Comment
-
Yes, I did attach it as an attachment.
Here is the link : http://ninjatrader.com/support/helpG...ionaccount.htm
I did use a capital P.
Comment
-
Hi mbesha,
Thank you for the link. (This was actually new to me)
I've made a quick test script to test using the PositionAccount object and found that this compiles without issue.
I took a second look at your strategy and found that this is not a strategy, this is an indicator.
The Position and PositionAccount are not available to indicators. This script will need to be re-created as a strategy and not as an indicator.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by manueldecastro, Yesterday, 10:26 AM
|
4 responses
17 views
0 likes
|
Last Post Today, 02:56 AM | ||
Started by TraderIqbal, 10-20-2023, 10:12 AM
|
2 responses
119 views
0 likes
|
Last Post
by Funnywo
Today, 02:03 AM
|
||
Started by Creamers, 04-27-2024, 05:32 AM
|
12 responses
72 views
0 likes
|
Last Post
by Creamers
Today, 01:50 AM
|
||
Started by fredericlebre, Today, 01:19 AM
|
0 responses
8 views
0 likes
|
Last Post Today, 01:19 AM | ||
Started by TraderJA, Today, 12:06 AM
|
0 responses
11 views
0 likes
|
Last Post
by TraderJA
Today, 12:06 AM
|
Comment