Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
close great than or less than average position price (-)
Collapse
X
-
close great than or less than average position price (-)
i'm dialing in an exit for my trade. and i have check if position long and a bool and a close greater than or equal to average position price -18 ticks as conditions. does that make sense to have greater than to a negative number..because i'm talking about having a greater negative number? or, is it less than with a negative number..because we're talking about close being lower than the -18?Tags: None
-
Hello SteveReiza,
Thanks for your post.
The "average position price -18 ticks" would refer to the average position price offset by -18 ticks. This would be the price 18 ticks below the average position price.
If you want to create a condition that checks if the close price is greater than the price 18 ticks below the average entry price then that would be correct.
If you want to create a condition that checks if the close price is less than the price 18 ticks below the average position price, then you should use Less for the comparison instead of Greater.
I suggest adding a print to your script (outside the condition) that prints out the average position price offset by -18 ticks to see exactly what that value is evaluating to when running the script.
Below is a link to a forum post that demonstrates how to use prints to understand behavior.
Let us know if we may assist further.
<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
-
thanks for the reply. my confusion is if its the same for long and short positions. if its average position price -18 ticks. the -18 is higher then the long trade with a -18 if its a short trade. in that case, if i want to say if the close is a higher price than where the -18 is then i would use greater than? or, because its more negative and its more less than 0 i use less than?Last edited by SteveReiza; 02-25-2024, 10:25 PM.
Comment
-
Hello SteveReiza,
Thanks for your notes.
The average position price offset by -18 ticks would mean the price 18 ticks below the average entry price. This would be the same price regardless of if you entered a long or short position.
For example, say the average position price is 100 and the TickSize of the instrument is .25. The average position price offset by -18 ticks would be 95.5 (.25 * 18 = 4.5 and 100 - 4.5 is 95.5).
If you were in a long trade, this would mean the market moved against you by 18 ticks. If you were in a short trade, this would mean the market moved 18 ticks in your favor.
To detect if the market moved more than 18 ticks in your favor when in a long position, you could check if the Close price is greater than Average Position Price + 18 ticks.
To detect if the market moved more than 18 ticks in your favor when in a short position, you could check if the Close price is less than Average Position Price - 18 ticks.
Please let us know if we may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
43 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
124 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
65 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment