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