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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      79 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X