Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exposing a Variable for use in a strategy

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

    Exposing a Variable for use in a strategy

    I am working on a strategy which will go long if certain conditions are met and an avg line, which changes color depending on its slope, is the right color. To make the "color" available to a strategy I have created a variable which is set to a number depending on the color of the plot. I've embedded along with the plot statement but I don't know how to make it accessible to a strategy. Here's a sample of the code:

    Code:
    if (Rising(SMA(Period)))
         {
         // Connects the rising plot segment with the other plots
         RisingPlot.Set(1, SMA(Period)[1]);
         LColText = 1;
         }
    I'm pretty sure I need to somehow add a statement in the "Properties" section
    or perhaps do that as well as create a dataseries but the things I've tried don't work. If there is a code sample somewhere that outlines this I would be grateful to see it.
    Thanks
    DaveN

    #2
    You would need to expose this dataseries in the indicator to access it in the strategy then - http://www.ninjatrader-support2.com/...ead.php?t=4991

    Comment


      #3
      Exposing a Variable for use in a strategy

      Bertrand,
      Thanks for your help and guidance to the sample code. It works though I am still having trouble making the text variable visible outside the indicator so that it can be used in a strategy.
      Thanks
      DaveN

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmoran13, Yesterday, 01:02 PM
      0 responses
      30 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      22 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      160 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      95 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      148 views
      2 likes
      Last Post CaptainJack  
      Working...
      X