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
on execution or on order updates check if stop has been changed
Collapse
X
-
on execution or on order updates check if stop has been changed
trying to create an alert as a strategy that when the stop is moved in a direction that is not towards a favorable pnl but instead extends the risk. can the onexecution or onorderupdates either one be used to note when the stop is moved
Tags: None
-
Hello set2win,
Thanks for your post.
The Alert() method would be used to trigger an alert in a NinjaScript.
Alert(): https://ninjatrader.com/support/help.../nt8/alert.htm
Position.GetUnrealizedProfitLoss() could be used to get the unrealized PnL for the strategy position. You could consider checking if you are in a long or short market position using Position.MarketPosition and saving Position.GetUnrealizedProfitLoss() to a custom Series<double> variable named something like 'unrealizedPnL'.
Then, you could check if the previous unrealizedPnL variable value (unrealizedPnL[1]) is greater than or less than the current unrealized PnL variable value (unrealizedPnL[0]) and call your Alert() method in that condition.
This will allow you to see if the current Unrealized PnL value of the position is above or below the previous Unrealized PnL value.
Position.MarketPosition: https://ninjatrader.com/support/help...etposition.htm
Position.GetUnrealizedProfitLoss(): https://ninjatrader.com/support/help...profitloss.htmBrandon H.NinjaTrader Customer Service
-
Hi, don't think you understood. Trying to create a label and audio alert, i know how to do those. if stop is first placed on a Long below the fill at 15 ticks, price moves down
then i move the stop to 25 ticks away, i want to monitor the stopprice, each time it is movesd so that i clearly see the amount of risk in dollars
Comment
-
Hello set2win,
Thanks for your notes.
OnOrderUpdate() could be used to track order objects and get the stopPrice information of an order when the price changes. This event-driven method is called when an order managed by a strategy changes state. An order will change state when a change in order quantity, price or state (working to filled) occurs.
See the help guide documentation below for more information and sample code.
OnOrderUpdate(): https://ninjatrader.com/support/help...=onorderupdate
Here is a reference sample you could view demonstrating the use of OnOrderUpdate(): https://ninjatrader.com/support/help...and_onexec.htmBrandon H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ETFVoyageur, 05-18-2024, 12:45 AM
|
7 responses
41 views
0 likes
|
Last Post Today, 11:03 AM | ||
Started by woodyfox, 02-28-2019, 08:36 PM
|
26 responses
1,203 views
0 likes
|
Last Post Today, 10:57 AM | ||
Started by tkaboris, Yesterday, 07:53 PM
|
6 responses
20 views
0 likes
|
Last Post Today, 10:56 AM | ||
Started by FAQtrader, 04-25-2024, 12:00 PM
|
18 responses
294 views
0 likes
|
Last Post Today, 10:53 AM | ||
Started by ETFVoyageur, Yesterday, 12:26 PM
|
5 responses
22 views
0 likes
|
Last Post Today, 10:52 AM |
Comment