And another thing, is there a way to code such that a sound is played or there is a sound alert when certain conditions are met? Please let me know. Thanks.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Plotting values in a custom strategy
Collapse
X
-
Plotting values in a custom strategy
Hi. I was wondering whether there is a way of plotting some simple values such as my own trailing stops and profit targets which I have within my custom strategy to the chart? What code do I need to introduce into my strategy to achieve this end?
And another thing, is there a way to code such that a sound is played or there is a sound alert when certain conditions are met? Please let me know. Thanks. -
Hi mbesha,
Thanks for your post.
You can always draw a line on your chart to mark where orders are.
For example:
if (order.Name == "Trail stop" && order.OrderState != OrderState.Cancelled && order.OrderState != OrderState.Filled)
{
DrawLine("trailstop", true, 10, order.StopPrice, 0, order.StopPrice, Color.Red, DashStyle.Solid, 3);
}
This would draw a line whenever there is an OnOrderUpdate event for a trail stop.
Below is a link to the help guide on DrawLine().
http://www.ninjatrader.com/support/h...7/drawline.htm
You can also use a plot but this would be something that stretches across the chart.
Below is a link to a reference sample that demonstrates plotting from a strategy which is not covered in the help guide (as this is not recommended).
http://www.ninjatrader.com/support/f...ead.php?t=6651
To trigger an Alert, call Alert().
For example:
if (CrossAbove(Close, SMA(19), 1))
{
Alert("myAlert", Priority.Medium, "custom alert message", @"Alert1.wav", 1, Color.White, Color.Black);
}
Below is a link to the help guide on Alert().
http://www.ninjatrader.com/support/h.../nt7/alert.htmChelsea B.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by StockTrader88, 03-06-2021, 08:58 AM
|
45 responses
3,992 views
3 likes
|
Last Post Today, 09:51 AM | ||
Started by TAJTrades, Today, 09:46 AM
|
0 responses
7 views
0 likes
|
Last Post
by TAJTrades
Today, 09:46 AM
|
||
Started by rhyminkevin, Yesterday, 04:58 PM
|
5 responses
62 views
0 likes
|
Last Post
by dp8282
Today, 09:36 AM
|
||
Started by realblubb, Today, 09:28 AM
|
0 responses
8 views
0 likes
|
Last Post
by realblubb
Today, 09:28 AM
|
||
Started by AaronKoRn, Yesterday, 09:49 PM
|
1 response
19 views
0 likes
|
Last Post
by Rikazkhan007
Today, 09:24 AM
|
Comment