Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Instrument FullName

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

    Instrument FullName

    hello,

    I would like to calculate the median price for an instrument, only once, when a strategy is initialized.

    I have the code for calculating the price based on the 1 minute chart;

    PHP Code:
    double med1 = GetMedian (Close, 60*24*365); 
    
    How do I calculate this only once, so that the median price does not change as the strategy runs ?
    Last edited by Faspomy; 11-01-2008, 12:07 PM.

    #2
    I just added the code above to;

    protected override void Initialize()
    {


    will it work properly ?

    Comment


      #3
      in OnBarUpdate() something like:

      if (med1 != 0) GetMedian()....
      RayNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by SalmaTrader, 07-07-2026, 10:26 PM
      0 responses
      46 views
      0 likes
      Last Post SalmaTrader  
      Started by CarlTrading, 07-05-2026, 01:16 PM
      0 responses
      22 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 06-17-2026, 10:32 AM
      0 responses
      14 views
      0 likes
      Last Post CaptainJack  
      Started by kinfxhk, 06-17-2026, 04:15 AM
      0 responses
      21 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 06-17-2026, 04:06 AM
      0 responses
      23 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X