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 NullPointStrategies, Today, 05:17 AM
    0 responses
    52 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    48 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X