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 AaronKoRn, Yesterday, 09:49 PM
    0 responses
    11 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    10 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    11 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,980 views
    3 likes
    Last Post jhudas88  
    Started by rbeckmann05, Yesterday, 06:48 PM
    0 responses
    9 views
    0 likes
    Last Post rbeckmann05  
    Working...
    X