Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using price data at certain indicator time

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

    Using price data at certain indicator time

    If you have a simple strategy say a MA crossovers, how do you snapshot a value at a certain time when an signal happens?

    For example, if I'm using 2 Moving Averages of 50, and 200 for fast and slow respectively, and I want to get long via a limit order when the ask crosses above the 50 BUT at that time, I want to snapshot where the slow moving average is because that's my stop loss. Which methods in code would accomplish this? or how would I do this via the strategy builder?

    Thank those in advance who helps with this question!

    #2
    Hello Boonfly8,

    Thanks for your post and welcome to the NinjaTrader forums!

    In the strategy builder, you can create a (double) variable that you could store the value of the slow moving average at the time that your conditions permit placing the order. In the action section where you place the entry order, you can "set" a user variable (in this case you would set it to the value of the current bar of the 200 period moving average).

    Please see:
    "Understanding the Inputs and Variables screen" in: https://ninjatrader.com/support/help...er_screens.htm

    "How to use user inputs & variables" in: https://ninjatrader.com/support/help...on_builder.htm

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    90 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    137 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    120 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X