• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

bool statement

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

  • imalil
    started a topic bool statement

    bool statement

    I have a 3rd party indicator with locked code but gives us functions for us to make our own indicators and strategies.

    One such function looks like this: ThirdPartyInd.Test[barsAgo]. This paints the bar a certain color based on the value created in the 3rd party indicator. I do not have access to this value or code.

    What I want to do is put this function in an IF bool statement. Something like:

    if (CurrentBars[0] == ThirdPartyInd.Test[0]
    { DrawText(etc......)}

    This IF statement does not work, but I think you see what I'm trying to say.

    I'd appreciate any advice.
    Thank you.

  • NinjaTrader_CodyB
    replied
    Hello,
    Is the indicator provided by the third party protected? If it is not protected then we would be able to review the code and be able assist further.
    If it is not protected please attach the indicator to your response. If you would rather not post it on the forum you can send an email to platformsupport[AT]ninjatrader[DOT]com with the indicator attached.
    You can attach your indicator to your response by going to File > Utilities > Export NinjaScript > Export selected source files > select your Indicator > select the right arrow > Export. The file will be located under (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript.

    Leave a comment:


  • imalil
    replied
    Not yet, it gives me errors. If I can't access BarColorSeries, I need another way to access the values, which I know is possible. Work in progress. Any other thoughts, let me know.

    Thank you.

    Leave a comment:


  • NinjaTrader_CodyB
    replied
    Hello,
    If they only all the int values and bool series values they may not provide a way to access their BarColorSeries.
    Where you able to access ThirdPartyIndicator[0].BarColorSeries as Koganam had suggested?

    Leave a comment:


  • imalil
    replied
    The developer of my 3rd party indicators sent me this:

    "All values are public IntSeries or public BoolSeries. BoolSeries gives True or False
    values. Bullish signals generate values of +1; Bearish signals generate values of -1."

    He is not in the business of selling indicators so he will not spent a lot of time with me.

    Does this help your understanding of how I can access their values?

    Thank you.

    Leave a comment:


  • koganam
    replied
    Originally posted by imalil View Post
    I understand what you're saying, but I'm using a 3rd party indicator which determines the condition that makes the bar DodgerBlue. I merely want to recognize if the bar is DodgerBlue, then, if it is, run my print statement.

    Does this make sense?

    Thanks.
    Then you need to be accessing the BarColorSeries of that indicator, not of the containing class.
    Code:
    ThirdPartyInd.BarColorSeries[0]

    Leave a comment:


  • imalil
    replied
    I understand what you're saying, but I'm using a 3rd party indicator which determines the condition that makes the bar DodgerBlue. I merely want to recognize if the bar is DodgerBlue, then, if it is, run my print statement.

    Does this make sense?

    Thanks.

    Leave a comment:


  • NinjaTrader_CodyB
    replied
    Hello,
    Yes you could set the BarColorSeries in the OnBarUpdate() method.
    See below for an example of setting the BarColorSeries:

    Code:
    protected override void OnBarUpdate()
    {
        if(/* Condition for when you want to set the BarColorSeries */)
        {
             BarColorSeries[0] = Color.DodgerBlue;
        }
    
    }
    Please see the following link on BarColorSeries: http://ninjatrader.com/support/helpG...olorseries.htm

    Leave a comment:


  • imalil
    replied
    Originally posted by NinjaTrader_CodyB View Post
    Hello,
    This snippet does not seem to be setting the BarColorSeries.
    Where in your code are you setting the BarColorSeries?
    I look forward to your reply.
    I do not know how to answer your question as of right now.
    Could you please give me an example of setting the BarColorSeries? For example, the syntax and where in the code--OnBarUpdate, I assume--it goes.

    Thank you.

    Leave a comment:


  • NinjaTrader_CodyB
    replied
    Hello,
    This snippet does not seem to be setting the BarColorSeries.
    Where in your code are you setting the BarColorSeries?
    I look forward to your reply.

    Leave a comment:


  • imalil
    replied
    Here's a print statement:

    if (BarColorSeries[0] == Color.DodgerBlue && + imbalance >= 1)
    { DrawText("imbalance" + CurrentBar, AutoScale, (+ imbalance).ToString(), 0, Low[0], -(placementimballevel), Color.Pink, ChartControl.Font, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);}
    Print(BarColorSeries[0].ToString());
    Print(ToTime(Time[0]));

    Leave a comment:


  • NinjaTrader_CodyB
    replied
    Hello,
    Please provide the snippet of your code where you are setting the BarColorSeries so I may assist further.

    Leave a comment:


  • imalil
    replied
    I'm printing this:

    Print(BarColorSeries[0].ToString());
    Print(ToTime(Time[0]));
    The time is correct, but for the color I get [empty].

    I'm trying to find the error. If you have any ideas let me know.
    Thank you.

    Leave a comment:


  • NinjaTrader_CodyB
    replied
    Hello,
    To debug this I would recommend to print out the BarColorSeries to view what color it is set to when you are expecting it to be DodgerBlue in addition to the Time to verify these are working as expected.
    Code:
    Print(BarColorSeries[0] + Time[0]);

    Leave a comment:


  • imalil
    replied
    Thanks. I incorporated the BarColorSeries into my indicator and it's not recognizing it. For example, I'm doing this:

    if (BarColorSeries[0] == Color.DodgerBlue && + imbalance >= 1)
    { DrawText.....}

    My indicator results are printing as if this statement were not there. I have many IF statements before my DrawText commands. For those bars that are not DodgerBlue I've included:

    if (BarColorSeries[0] != Color.DodgerBlue && + imbalance >......
    It compiles fine and there are no conflicts in commands, it is just behaving as if the BarColorSeries command is not there.

    Do you have any Idea what I'm doing wrong?
    Thank you for the help.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by Mike661, Today, 07:22 AM
1 response
11 views
0 likes
Last Post NinjaTrader_PatrickG  
Started by memonolog, Today, 07:56 AM
0 responses
3 views
0 likes
Last Post memonolog  
Started by tdawson11, Today, 07:48 AM
0 responses
3 views
0 likes
Last Post tdawson11  
Started by pstrusi, Today, 07:39 AM
1 response
5 views
0 likes
Last Post NinjaTrader_Jim  
Started by vantojo, 06-19-2019, 04:06 PM
6 responses
34 views
0 likes
Last Post vantojo
by vantojo
 
Working...
X