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 NullPointStrategies, Today, 05:17 AM
      0 responses
      53 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X