Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Assign Variable on first Tick

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

    Assign Variable on first Tick

    Hi,

    I have a strategy, where I want to assign the value or price of the first tick after the strategy is put on the chart to a variable.
    I want this to happen only once.
    How to I accomplish that.

    Regards
    Last edited by keepsimple; 10-17-2014, 06:01 AM.

    #2
    KeepSimple,

    You would want to use the Historical bool and another bool to detect when you are in live data and then get the first tick it will store that value and then set the bool to false.

    Example -

    if(!Historical && firstTick)
    {
    myVar = Close[0];
    firstTick = false;
    }
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Cal,

      this should work.

      Regards

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      57 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      143 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      161 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      97 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      276 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X