Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Closing above a moving average ...

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

    Closing above a moving average ...

    Hello ... I'm not a programmer so I rely on the wizard to define my strategies.

    I am looking to define a condition that identifies when the median price crosses above the 50 SMA and stays above for 3 bars (or whatever amount that is defined by a user parameter). The key is that the 3 bars, in this example, must all remain above the 50 SMA. Can someone assist on how I can define this via the wizard. Thanks in advance!

    #2
    Hello,

    Thanks for the note.

    You can do this manually in the condition builder by checking for is the Close price of the current bar is > SMA and Close price of 1 bar ago is > SMA then finally close price of 2 bars ago what > SMA.

    You would need to program the strategy to hard code it how many bars to check against.

    To have a variable number of bars to check against this unfortunately would require unlocking the code and manual coding.

    Let me know if I can be of further assistance.

    Comment


      #3
      thank you Brett!

      Comment


        #4
        another question .. I want to make sure that a trade is not executed after 3:00PM or a time that is set by a variable ... is there a way I can program that as a condition in my strategy?

        Comment


          #5
          Hi pman777,

          You could create this in the condition builder. You would add a time filter to your entry conditions. For help please see the following link:

          Then expand section: How to create time comparisons
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            thanks ... that worked.

            Also, is there a way to set a condition that identifies whether a bar is 'green' or 'red'?

            Comment


              #7
              Hello,

              Glad to hear that worked.

              You can do this by setting your own condition to do this then in the Do The following section on the Conditionas and Actions page in the strategy wizard click Add. Expand out Drawing and then select Set Bar Color and optionally use Set candle outline color as well.

              -Brett

              Comment


                #8
                thanks Brett .. .can you direct me to documentation or an example that I can use to guide me through this in more detail?

                Comment


                  #9
                  Hello,

                  No documentation to point to in exact detail on this specific setting.

                  However there is general documentation on setting Do The Following conditions.



                  Let me know if I can be of further assistance.

                  Comment


                    #10
                    Not sure if I made my self clear on what I want to accomplish. For example, I want to know whether the 2 bars preceding the current bar that has crossed above the 50 PMA were green or not ... to do this, I need to be able to test whether certain bars, looking back, are green or red. Does this help? tx!

                    Comment


                      #11
                      Yes this is different.

                      To test this you need to test is Close[0] is greater then the Open[0]. This is a green bar or an up bar.

                      Use the reverse for a down bar.

                      -Brett

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by timmbbo, Today, 08:59 AM
                      1 response
                      2 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Started by KennyK, 05-29-2017, 02:02 AM
                      2 responses
                      1,279 views
                      0 likes
                      Last Post marcus2300  
                      Started by fernandobr, Today, 09:11 AM
                      0 responses
                      2 views
                      0 likes
                      Last Post fernandobr  
                      Started by itrader46, Today, 09:04 AM
                      1 response
                      6 views
                      0 likes
                      Last Post NinjaTrader_Clayton  
                      Started by bmartz, 03-12-2024, 06:12 AM
                      5 responses
                      33 views
                      0 likes
                      Last Post NinjaTrader_Zachary  
                      Working...
                      X