Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

How to get price level for limit order

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

    How to get price level for limit order

    I have an indicator that plots a level on the chart. I would like to know how I can pull the price level for use as an entry by limit order.

    So for example if price crosses below the 8 SMA, I want the price of the high of the bar that crossed below the 8 SMA so that I may enter by long limit order.

    Thanks.

    #2
    Hello brucelevy,

    Thanks for your post.

    With the example of price crossing below an 8 period EMA and wanting to place an order at the high of the bar where the price crossed you would need to use either a stop or stoplimit as you would be wanting to go long above the current price. Here is an example:

    if (CrossBelow(Close, EMA(8), 1)
    {
    EnterLongStop (1, High[0]);
    }
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      OK great, how can I go about storing that price level for later use?

      Comment


        #4
        Hello brucelevy,

        Thanks for your reply.

        To store that value for later use, you would need to declare a double variable in the region variables and then in the code some thing like:

        if (CrossBelow(Close, EMA(8), 1)
        {
        EnterLongStop (1, High[0]);
        mySavedHigh = High[0]; // save value for later use.
        }
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by The_Sec, Yesterday, 03:53 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by mmenigma, Yesterday, 03:25 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by kujista, Today, 05:44 AM
        0 responses
        7 views
        0 likes
        Last Post kujista
        by kujista
         
        Started by ZenCortexCLICK, Today, 04:58 AM
        0 responses
        9 views
        0 likes
        Last Post ZenCortexCLICK  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        172 responses
        2,281 views
        0 likes
        Last Post sidlercom80  
        Working...
        X