Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bools and NinjaTrader Internal Logic

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

    Bools and NinjaTrader Internal Logic

    In programing I like to create bools to consolidate code, but I am concerned about doing this with NinjaTrader Internal Logic. I do not want to compromise the integrity of my strategy. Can you please tell me if the following code would have adverse reactions to a strategy.
    Thanks
    Code:
    [FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000]
    [COLOR=black][COLOR=blue]private bool[/COLOR] Long {get { return Position.MarketPosition == MarketPosition.Long; } }[/COLOR]
    [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][COLOR=black][/COLOR]

    or
    Code:
    [FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000]
    [COLOR=black][COLOR=blue]private bool[/COLOR] Long1 {get { return Position1 == MarketPosition.Long; } }[/COLOR]
    [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]

    #2
    Hello kenb2004,
    NinjaTrader is basically C# and will use any standard C# logics/features.

    You can simply write a function. A sample code will be like

    Code:
    private bool Long()
    {
     return Position.MarketPosition == MarketPosition.Long;
    }
    JoydeepNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    14 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    119 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    172 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    88 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    131 views
    0 likes
    Last Post cmoran13  
    Working...
    X