Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Saving the values of a Bar that does a specific actions

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

    Saving the values of a Bar that does a specific actions

    Hello, I hope my message finds you well.

    I am currently learning to write some code in Ninjascript. I would like to ask you if it is possible and if it is how, to save a bar that for example crosses the low of the previous day.
    After having saved that bar, I would like to recall at a later stage in the strategy the High of this particular bar, so that if current Close is greater than High of saved bar I can go long.

    Thank you very much as always for your help
    David






    #2
    Hello David,

    private int crossBar;

    if (CrossBelow(Close, PriorDayOHLC().PriorLow[0], 1))
    crossBar = CurrentBar;

    if (Close[0] > High[CurrentBar - crossBar])
    {
    EnterLong();
    }
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,

      thank you very much for your reply.
      I will try it.
      Thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      88 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      134 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      67 views
      0 likes
      Last Post PaulMohn  
      Working...
      X