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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
43 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
20 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
30 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
48 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
38 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment