Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Position Bools

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

    Strategy Position Bools

    I am currently looking for an example of how to create "long /short " trade bools similar to that in the picture below. I want to add this option to my current strategies for testing purposes


    Click image for larger version

Name:	Screenshot 2023-04-07 054133.png
Views:	124
Size:	3.7 KB
ID:	1245079
    Attached Files

    #2
    Hi Teebone21,

    I'm not sure what you're asking for but this might be it.

    Code:
    [NinjaScriptProperty]
    [Display(Name = "Trade Longs", Description = "Permit trading long positions", Order = 1, GroupName = "Parameters")]
    public bool IsTradeLongs { get; set; }
    
    ​[NinjaScriptProperty]
    [Display(Name = "Trade Shorts", Description = "Permit trading shorts positions", Order = 2, GroupName = "Parameters")]
    public bool IsTradeShorts { get; set; }

    Hope that helps!
    Matt

    Comment


      #3
      Originally posted by StealthM93 View Post
      Hi Teebone21,

      I'm not sure what you're asking for but this might be it.

      Code:
      [NinjaScriptProperty]
      [Display(Name = "Trade Longs", Description = "Permit trading long positions", Order = 1, GroupName = "Parameters")]
      public bool IsTradeLongs { get; set; }
      
      ​[NinjaScriptProperty]
      [Display(Name = "Trade Shorts", Description = "Permit trading shorts positions", Order = 2, GroupName = "Parameters")]
      public bool IsTradeShorts { get; set; }

      Hope that helps!
      Matt
      Thank you sir! I will update code and defaults to make this work

      Comment


        #4
        Hello Teebone21,

        Thanks for your post.

        It seems that you might be wanting to create user-defined bool input properties as mentioned by StealthM93 (Matt).

        The code that Matt shared would be used for creating those user-defined input properties. The IsTradeLongs and IsTradeShorts variables could then be used throughout the script.

        Creating User Defined Input Parameters: https://ninjatrader.com/support/help...d_input_pa.htm

        Please let me know if I may assist further.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Originally posted by NinjaTrader_BrandonH View Post
          Hello Teebone21,

          Thanks for your post.

          It seems that you might be wanting to create user-defined bool input properties as mentioned by StealthM93 (Matt).

          The code that Matt shared would be used for creating those user-defined input properties. The IsTradeLongs and IsTradeShorts variables could then be used throughout the script.

          Creating User Defined Input Parameters: https://ninjatrader.com/support/help...d_input_pa.htm

          Please let me know if I may assist further.
          Thanks i got it to work!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          52 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          130 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          70 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          44 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          49 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X