• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plotting values in a custom strategy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    #2
    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.htm
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by brunoviveiros, Today, 04:26 AM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by dkbyond, Yesterday, 03:52 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by Erhard, Today, 04:24 AM
    2 responses
    17 views
    0 likes
    Last Post Erhard
    by Erhard
     
    Started by rontronimous, Yesterday, 05:55 PM
    2 responses
    20 views
    0 likes
    Last Post rontronimous  
    Started by StevenNelson, 11-19-2019, 05:39 AM
    4 responses
    22 views
    0 likes
    Last Post NinjaTrader_PatrickG  
    Working...
    X