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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X