Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Property always return false

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

    Property always return false

    Good morning,

    I add a property to my strategy but it always return false even if I write "return true"

    Code:
    [FONT=Courier New][SIZE=2]
    [SIZE=2][FONT=Courier New][Browsable([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])] [/SIZE][/FONT]
    [SIZE=2][FONT=Courier New][XmlIgnore()][/FONT][/SIZE]
    [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]bool[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] IsRising[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
    [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]    get[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] { [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]return [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]; }[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
    [/SIZE][/FONT]
    Any idea why?

    Regards,
    Steven
    Last edited by SMuhr; 08-27-2010, 05:09 AM.

    #2
    You have hardcoded it with this snippet, try for example something like this -

    Code:
     
    [Description("My Bool")]
    [GridCategory("Parameters")]
    publicbool MySwitch
    {
    get { return mySwitch; }
    set { mySwitch = value; }
    }
    In your variables:

    Code:
    private bool mySwitch = true;
    This will then start with a true default if the indicator is loaded.

    Comment


      #3
      In fact, it should no be a parameter.
      Just a property form the strategy class.

      I hardcoded it to true to see if the property isRising return true.
      But it does not

      Comment


        #4
        How would you eactly access it then to determine it's false?

        Comment


          #5
          In my code it is like this :

          Code:
          private bool isRising = false;
           
          //Some code set isRising to true & sometimes to false
           
          [FONT=Courier New][Browsable([SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][SIZE=2])] [/SIZE]
          [SIZE=2][XmlIgnore()][/SIZE]
          [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]bool[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][SIZE=2] IsRising[/SIZE]
          [SIZE=2]{[/SIZE]
          [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]    get[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2] { [/SIZE][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return [/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]isRising[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/FONT][SIZE=2][FONT=Courier New][SIZE=2]; }[/SIZE]
          [SIZE=2]}[/SIZE]
          [/FONT][/SIZE]
          But it always return false.
          Si I hardoced the return value of IsRising to true but it still return false

          thx
          Last edited by SMuhr; 08-27-2010, 06:48 AM.

          Comment


            #6
            SMuhr, in your last example you set isRising to false and then the public property IsRising to this value, so for sure it returns false then - are you sure the code attempting to change it is triggering at all?

            Comment


              #7
              the value isRising is set to True during the call of the method OnBarUpdated().
              Evenf if I hardcoded the property IsRising to return true and acces it trougth the getter, I get False. (I have check with Visual Studio and breakpoint)

              Comment


                #8
                Ok, thanks for testing in VS - can you please attach the script(s) you used so I can look into here?

                Comment


                  #9
                  Unfortunatly I cannot.
                  I wil find a work arround thanks Bertrabd

                  Comment


                    #10
                    Ok - if you look for historical data for this, you would need to expose a BoolSeries like shown here - http://www.ninjatrader.com/support/f...ead.php?t=4991

                    Hopefullly this helps you getting in the right direction.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    578 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    334 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    101 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    553 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    551 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X