Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Position.String()

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

    Position.String()

    Always use historical && realtime to check to enter or not within onbarupdate()
    Position.MarketPosition == MarketPosition.Flat

    BUT gotta be a string somewhere I can use with that?
    like:
    Position.MarketPosition.sEntry1L == MarketPosition.Long

    I am asking too much?

    Jon

    ps: So I get this far
    Position.MarketPosition.ToString("sENTRY5L") == MarketPosition.Flat

    and get a compile error, but to me it looks similar to the examples in the help files .. error is '==' cannot be applied to operands of type 'string' and 'NT.Cbi.MarketPosition'
    Last edited by Trader.Jon; 03-22-2011, 10:47 PM.

    #2
    Hi Jon, this will be the overall strategy position - it looks like you try to work with the current partial position your specific entry signal would have? For this you would work with the IOrder objects offering a finer control - http://www.ninjatrader.com/support/h...nt7/iorder.htm

    Comment


      #3
      Bertrand,

      Thanks, but still confused and trying ... IF I want to check to see if a SPECIFIC entry is till working (from a group of entrys made at the same time as an example) to qualify if I will make an additional entry in the strategy

      Code:
       
      [FONT=Arial][COLOR=#0000ff][FONT=Arial][COLOR=#0000ff]protected[/COLOR][/FONT][/COLOR][/FONT][FONT=Arial][COLOR=#0000ff][FONT=Arial][COLOR=#0000ff]override[/COLOR][/FONT][/COLOR][/FONT][FONT=Arial][COLOR=#0000ff][FONT=Arial][COLOR=#0000ff]void[/COLOR][/FONT][/COLOR][/FONT][FONT=Arial] OnPositionUpdate(IPosition position)[/FONT]
      [FONT=Arial]{ [/FONT]
      [FONT=Arial][COLOR=#0000ff][FONT=Arial][COLOR=#0000ff]if[/COLOR][/FONT][/COLOR][/FONT][FONT=Arial] (position.MarketPosition.ToString([/FONT][FONT=Arial][COLOR=#800000][FONT=Arial][COLOR=#800000]"sENTRY5L"[/COLOR][/FONT][/COLOR][/FONT][FONT=Arial]) == MarketPosition.Long)[/FONT]
      [FONT=Arial]{[/FONT]
      [FONT=Arial][COLOR=#008000][FONT=Arial][COLOR=#008000]// reset bool variable[/COLOR][/FONT]
      [/COLOR][/FONT][FONT=Arial]iVerifyFilled5L= [/FONT][FONT=Arial][COLOR=#0000ff][FONT=Arial][COLOR=#0000ff]true[/COLOR][/FONT][/COLOR][/FONT][FONT=Arial];[/FONT]
      [FONT=Arial]}[/FONT]
      [FONT=Arial][COLOR=#008000][FONT=Arial][COLOR=#008000]//[/COLOR][/FONT]
      [/COLOR][/FONT][FONT=Arial][COLOR=#0000ff][FONT=Arial][COLOR=#0000ff]if[/COLOR][/FONT][/COLOR][/FONT][FONT=Arial] (position.MarketPosition.ToString([/FONT][FONT=Arial][COLOR=#800000][FONT=Arial][COLOR=#800000]"sENTRY5L"[/COLOR][/FONT][/COLOR][/FONT][FONT=Arial]) == MarketPosition.Flat)[/FONT]
      [FONT=Arial]{[/FONT]
      [FONT=Arial][COLOR=#008000][FONT=Arial][COLOR=#008000]// reset bool variable[/COLOR][/FONT]
      [/COLOR][/FONT][FONT=Arial]iVerifyFilled5L= [/FONT][FONT=Arial][COLOR=#0000ff][FONT=Arial][COLOR=#0000ff]false[/COLOR][/FONT][/COLOR][/FONT][FONT=Arial];[/FONT]
      [FONT=Arial]}[/FONT]
      [FONT=Arial]}[/FONT]
      and should I use a simple bool or a boolseries to hold that qualifying information (I am guessing just a simple bool and then turn it off) as in above 'guess', And I now still have same error
      error is '==' cannot be applied to operands of type 'string' and 'NT.Cbi.MarketPosition'

      Thanks,
      Jon
      Last edited by Trader.Jon; 03-23-2011, 07:32 AM.

      Comment


        #4
        Hi Jon, the above guess will unfortunately not work for this purpose, ToString just converts the returned value to a string, it does not allow you to specific to check a market position for a specific entry signal, the position property is just the overall strategy position. Yes, you could also use a bool flag to check which entry signal has triggered or should be available for retriggering.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        637 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        366 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        107 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        569 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        571 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X