Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to translate this line of pseudocode to C#

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

    How to translate this line of pseudocode to C#

    Hello ninjatrader community,

    I would like to know how I can translate this into c#:

    if (GetCurrentAsk(1) is greater than open[0] by 1 point)
    EnterLong();


    #2
    Hello Don22Trader1,

    Thank you for your post.

    For an instrument with a tick size of .25, the following would compare the current ask of the primary data series to the Open price + 1 point (4 ticks):


    Code:
    if (GetCurrentAsk(0) >= (Open[0] + (4 * TickSize)) )
    {
    EnterLong();
    }
    If you're using multiple series in the script, GetCurrentAsk(1) would return the current ask price of the first added data series in the script. You'd want to use Opens[0][0] to compare that to the primary series' bar open price or Opens[1][0] to compare to the secondary series bar open price.

    Please let us know if we may be of further assistance to you.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X