Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

bool statement

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

  • imalil
    replied
    Originally posted by NinjaTrader_CodyB View Post
    Hello,
    Yes you could do this by checking the BarColorSeries property. For example:
    Code:
    if(BarColorSeries == Color.Pink)
    {
        //DO Something
    }
    For more information on BarColorSeries please see the following link: http://ninjatrader.com/support/helpG...olorseries.htm
    Thank you, on the right track, but getting error code CS0019. "== cannot be applied....ninja.data.colorseries' and 'system.drawing.color

    Leave a comment:


  • NinjaTrader_CodyB
    replied
    Hello,
    Yes you could do this by checking the BarColorSeries property. For example:
    Code:
    if(BarColorSeries == Color.Pink)
    {
        //DO Something
    }
    For more information on BarColorSeries please see the following link: http://ninjatrader.com/support/helpG...olorseries.htm

    Leave a comment:


  • imalil
    replied
    Originally posted by NinjaTrader_CodyB View Post
    Hello,
    Referencing parts of an indicator really depend on how the indicator is set up. There is not a general protocol for this though. It depends on if the indicator has the plots exposed,if the indicator has multiple plots, and how the overload methods are set up for this. I highly recommend that you contact the third party vendor on how you can call this indicator and its overload methods in NinjaTrader. If you would like to learn more on calling indicators in general I'd recommend to take a look at the indicator methods section of the help guide: http://ninjatrader.com/support/helpG...indicators.htm
    Okay, thanks. Tell me if this is possible: (the function paints the bar a specific color for a specific reason; the bars will never be painted this color unless this reason is true.) Can I, therefore, say 'if the current bar is Pink, then DrawText.....'? Is this possible?

    Thank you.

    Leave a comment:


  • koganam
    replied
    Originally posted by imalil View Post
    Please don't misunderstand, I'm not asking for an explanation on ThirdPartyIndicator.Test, which is impossible for you to do, I'm asking for an explanation about its type. As Koganam says: "if you can manage to reference it, it is most likely to be a Plot, rather than an IntSeries". I'm asking for a way to research referencing a plot from a 3rd party ind. I know other inds supply such functions, so there must be, generally speaking, a recognized protocol or way to incorporate them in an ind. I simply want to educate myself on how this is done.

    Thank you.
    Your question translates to: "How do I reference the properties or methods of an object?

    Ultimately, to reference anything from an object, that object needs to expose that entity for public access. There are more restrictive access methods, between private and public, that may be used, but public is the level most often used. You will have to read the literature on OOP principles.

    Here is one reference: https://www.google.com/search?q=c%23...utf-8&oe=utf-8

    Leave a comment:


  • NinjaTrader_CodyB
    replied
    Hello,
    Referencing parts of an indicator really depend on how the indicator is set up. There is not a general protocol for this though. It depends on if the indicator has the plots exposed,if the indicator has multiple plots, and how the overload methods are set up for this. I highly recommend that you contact the third party vendor on how you can call this indicator and its overload methods in NinjaTrader. If you would like to learn more on calling indicators in general I'd recommend to take a look at the indicator methods section of the help guide: http://ninjatrader.com/support/helpG...indicators.htm

    Leave a comment:


  • imalil
    replied
    Originally posted by NinjaTrader_CodyB View Post
    Hello,
    I do not have a link on information on ThirdPartyIndicator.Test as this is a custom method from the third party product. Koganam may be able to elaborate on how he deduced it is double. It is likely that it is a double as most indicator methods return a variable. To get the best information on this you will need to contact the vendor though so they can elaborate on their custom method.
    Please don't misunderstand, I'm not asking for an explanation on ThirdPartyIndicator.Test, which is impossible for you to do, I'm asking for an explanation about its type. As Koganam says: "if you can manage to reference it, it is most likely to be a Plot, rather than an IntSeries". I'm asking for a way to research referencing a plot from a 3rd party ind. I know other inds supply such functions, so there must be, generally speaking, a recognized protocol or way to incorporate them in an ind. I simply want to educate myself on how this is done.

    Thank you.

    Leave a comment:


  • koganam
    replied
    Originally posted by imalil View Post
    Can you link me something that explains what something like ThirdParty.Test[0] is? What tells you this is a double? I don't know enough about it to ask a clear question.

    Thanks.
    I deduce that ThirdParty.Test[0] is most likely a double because the variable is indexed, implying that it belongs to some kind of "collection/NT series". Very few developers expose an IntSeries rather than a Plot. All Plots would be made of doubles by definition. This was reinforced by the questions that you are asking. Basically, given the level of ability exposed by your questions, if you can manage to reference it, it is most likely to be a Plot, rather than an IntSeries, which takes a better understanding, to be able to access.

    Why I know that it is probably a logic error is simply from what CurrentBars[0] portends arithmetically. It is a monotonically increasing value with no real upper limit. Hence, we deduce that it is unlikely that any Plot will manage to reach the upper values of CurrentBars[0], at which time, your filter will always return false. A filter that will get pinned probably is a logic error, as, as soon as it gets pinned, it ceases to be a filter.

    Leave a comment:


  • NinjaTrader_CodyB
    replied
    Hello,
    I do not have a link on information on ThirdPartyIndicator.Test as this is a custom method from the third party product. Koganam may be able to elaborate on how he deduced it is double. It is likely that it is a double as most indicator methods return a variable. To get the best information on this you will need to contact the vendor though so they can elaborate on their custom method.

    Leave a comment:


  • imalil
    replied
    Originally posted by NinjaTrader_CodyB View Post
    Hello,
    As Koganam has outlined CurrentBars[0] == ThirdParty.Test[0] is indeed a logic error.
    Can you clarify what you are trying to call with CurrentBars[0] as it is likely you need to call something else here.

    &&+ is not an operator. Can you clarify what you are trying to call here as well?

    I look forward to your reply.
    Can you link me something that explains what something like ThirdParty.Test[0] is? What tells you this is a double? I don't know enough about it to ask a clear question.

    Thanks.

    Leave a comment:


  • NinjaTrader_CodyB
    replied
    Hello,
    As Koganam has outlined CurrentBars[0] == ThirdParty.Test[0] is indeed a logic error.
    Can you clarify what you are trying to call with CurrentBars[0] as it is likely you need to call something else here.

    &&+ is not an operator. Can you clarify what you are trying to call here as well?

    I look forward to your reply.

    Leave a comment:


  • koganam
    replied
    if (CurrentBars[0] == ThirdPartyInd.Test[0] && + imbalance > Buyimbal)
    What is in red is almost certainly a logic error that will never be true. CurrentBars[0] is an int; ThirdPartyInd.Test[0] is a double.
    What is in blue simply is a syntax error. What are you even trying to say there?

    Leave a comment:


  • imalil
    replied
    There's no doubt it's a syntax or logic problem on my part. The error I get on the IF statement line is CS0119. This is the first time I've tried to use a function from another ind. in my ind.

    if (CurrentBars[0] == ThirdPartyInd.Test[0] && + imbalance > Buyimbal)
    { DrawText("imbalance" + CurrentBar, AutoScale, (+ imbalance).ToString(), 0, Low[0], -47,
    Color.Pink, ChartControl.Font, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
    DrawText("AvgTradeSize" + CurrentBar, AutoScale, (String.Format("{0:0.0}", avgtradesize)), 0, Low[0], -64,
    Color.DodgerBlue, ChartControl.Font, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);}
    Thanks for the help.

    Leave a comment:


  • NinjaTrader_CodyB
    replied
    Hello,
    As Koganam says it would be very useful if we can see what code you are writing exactly so that we can assist further as this is most likely an issue with the syntax.
    I do just want to clarify that CurrentBar returns the number of the bar from the first bar being 0 and and each subsequent bar from left to right is incremented by 1.
    If you are wanting you get the Volume you would need to use the Volume method. For example if you wanted to check if the Volume of the current bar is greater than 100 you would do the following:

    Code:
     if(VOL()[0] > 100)
    {
        //Do Something
    }
    For more information on CurrentBar property please see the following link: http://ninjatrader.com/support/helpG...currentbar.htm

    For more information on the Volume method please see the following link: http://ninjatrader.com/support/helpG...oscillator.htm

    Leave a comment:


  • koganam
    replied
    Originally posted by imalil View Post
    I can't print because I keep getting compile errors: CS0119, "not valid in given context". Then when I try to make a variable I get CS1002, 0270, 1519. I'm clearly missing a crucial step.

    I'll try to be clearer by giving you a conceptual example since I can't see the code: the 3rd party ind will look at volume. Let's say it gets 100 for the current bar. The ThirdPartyInd.Test[0] function says 'if current bar volume > 50, then paint the bar pink.'

    So what I'm trying to do: if the current bar == ThirdPartyInd.Test[0], (meaning "if the current bar has volume > 50"), then my ind will print its results via drawtext.

    I realize my logic is way off on this, but I do know many people use these functions to add to their own inds and strategies. That is what I'm trying to do.

    Thanks for the help.
    To help resolve those kind of errors we have to see the actual lines that you are writing. You can, of course, hide the real name and call to the third-party indicator, but we do have to see the actual syntax of your lines.

    Leave a comment:


  • imalil
    replied
    I can't print because I keep getting compile errors: CS0119, "not valid in given context". Then when I try to make a variable I get CS1002, 0270, 1519. I'm clearly missing a crucial step.

    I'll try to be clearer by giving you a conceptual example since I can't see the code: the 3rd party ind will look at volume. Let's say it gets 100 for the current bar. The ThirdPartyInd.Test[0] function says 'if current bar volume > 50, then paint the bar pink.'

    So what I'm trying to do: if the current bar == ThirdPartyInd.Test[0], (meaning "if the current bar has volume > 50"), then my ind will print its results via drawtext.

    I realize my logic is way off on this, but I do know many people use these functions to add to their own inds and strategies. That is what I'm trying to do.

    Thanks for the help.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by f.saeidi, Today, 12:14 PM
1 response
3 views
0 likes
Last Post NinjaTrader_Gaby  
Started by aprilfool, 12-03-2022, 03:01 PM
2 responses
326 views
0 likes
Last Post BottomShark77  
Started by AnnBarnes, Today, 12:17 PM
1 response
2 views
0 likes
Last Post NinjaTrader_Zachary  
Started by Lopat, 03-05-2023, 01:19 PM
4 responses
168 views
0 likes
Last Post Sam2515
by Sam2515
 
Started by giulyko00, Today, 12:03 PM
1 response
4 views
0 likes
Last Post NinjaTrader_BrandonH  
Working...
X