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