Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

difference between two times

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

    difference between two times

    I don't think I know how to do the forum query the correct way, I've been trying to search the forums for this particular chunk of code, i'm sure its been written before...but I can't seem to find anything on it.

    I need to add a strategy to my system which does the following, here's my psuedo code:

    value1 = get close price of xx:39 pm

    value2 = get closing price of xx:42 pm

    result1 = value2 - value1

    if result1 >= 50
    go long on close

    if result <= -50
    go short on close

    else if
    do nothing

    =========
    If someone can point me in the right direction, or show me an elegant solution, i'd really appreciate it.

    Chris
    Last edited by trojancd; 10-04-2008, 05:00 PM.

    #2
    You can use the method GetBar() to get the # of bars ago for a specific time.

    Link - http://www.ninjatrader-support.com/H...V6/GetBar.html

    pseudo code:

    result = Close[GetBar()] - Close[GetBar()];
    RayNinjaTrader Customer Service

    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