Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how price breaking up of curve top of moving average

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

    how price breaking up of curve top of moving average

    Hi freaind ,


    how i make strategy as high of proce touch or break up the top of old moving average curve ??


    see example in picture attachecd
    Attached Files

    #2
    I will give you an idea of how I would do it:

    [OnBarUpdate]
    1) create new variable:
    double downTurn = 0;

    2) set downTurn value:
    if (SMA(period)[0] < SMA(period)[1] && SMA(period)[1] > SMA(period)[2]) // where SMA = your time of moving average, be it SMA, EMA, HMA, etc. period = your SMA period
    {
    downTurn = SMA(period)[1]
    }

    3) check whether current closed bar is higher than downTurn and enter into a position:
    if (Close [0] > downTurn && downTurn != 0)
    {
    EnterLong();
    downTurn = 0; // Reset after entry
    }
    Last edited by UltraNIX; 04-17-2022, 12:46 PM.

    Comment


      #3
      Actually , i tried to make it but i am not very good in building . and i think that defecult .

      if you have pics about it send me please .

      any way thank you for your cooperation

      Comment


        #4
        You have to have basic understanding of NinjaScript in order to achieve this. But, as this code is very simple, you may be able to make it in Strategy Builder.

        I am sure NinjaTrader Support Team would link you to video playlists of Strategy Builder, so you could learn it yourself.

        Comment


          #5
          Hello sarmaalnaser,

          Thanks for your post.

          I'm including some educational information on using the Strategy Builder below. You will want to be familiar with setting up conditions using indicators.

          I would suggest to maybe use MAX to get the highest SMA values over the last X number of bars to get the high of the curve.

          Our Strategy Builder 301 video and our Conditions and Actions examples help to show you how to set up logic. It always helps to start small and test each change as you are getting used to using the tool.

          Strategy Builder educational information

          The Strategy Builder can be used to create simple NinjaScript strategies. This is a powerful tool and the best way to get introduced to it would be to follow along our Strategy Builder 301 tutorial which shows you how the tool can be used and shows how to create a simple strategy that can be tested.

          I recommend starting here, and then to start making simple strategies just to test out one or two conditions so you can be sure that you have the conditions set up appropriately. It is important to start small and to test as you go to ensure that the logic is working before you scale up and add more complexity to the strategy.

          We also have various Conditions and Actions examples in our Help Guide. I would suggest reviewing these after you view the Strategy Builder 301 course so you can see how other tasks can be accomplished.

          Strategy Builder 301 (publicly available resource) — https://www.youtube.com/watch?v=_KQF2Sv27oE
          Conditions examples —https://ninjatrader.com/support/help...on_builder.htm
          Actions examples — https://ninjatrader.com/support/help...us/actions.htm
          JimNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by reynoldsn, 02-11-2025, 09:37 AM
          7 responses
          26 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by PH_GMT, Yesterday, 12:40 PM
          5 responses
          27 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by Mindset, 02-05-2025, 08:05 AM
          8 responses
          57 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by renosdim01, Today, 05:46 AM
          0 responses
          6 views
          0 likes
          Last Post renosdim01  
          Started by giulyko00, Today, 05:30 AM
          0 responses
          6 views
          0 likes
          Last Post giulyko00  
          Working...
          X