• 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

Using indicator in a strategy

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

    Using indicator in a strategy

    Hi

    I have a bespoke indicator that, in theory, produces a signal that I can then utilise within a strategy.

    In my indicator I have the following code to create the signal:
    ************************************
    //produces an external signal we can use
    private double _percentageMove = 0; //member variable

    This then gets a values assigned to it :
    _percentageMove = b2t; // value to be sent to external strategy

    Where b2t equals a double value eg 23.9, 1.235 etc

    I have a Property created :
    public double PercentageMove
    {
    get { Update();
    return _percentageMove; }
    }

    *************************************************
    and in the strategy I have some very simple code to print the value out

    double bp = Elliot3rdWaveV1005(20,5,10000,20,0,0,0,0).Percenta geMove;
    if(bp > 0)
    Print("BP = " + bp + " | | " + Time[0]);
    else
    Print(" BP = " + bp + " | | " + Time[0]);

    However the only value I get is zero.

    It is as though the indicator is not running and therefore the value never changes, but I can see the indicator behaving as it should.

    Any help or thoughts to what I am missing is appreciated as always...

    #2
    Hello,

    Thank you for the post.

    From this example I can see that you are setting the private variable rather than the public property, could you try changing the following:

    Code:
    _percentageMove = b2t;
    to

    Code:
    PercentageMove = b2t;

    Also, this may depend if you are calling the indicator its self from OnBarUpdate or not. Are you currently only calling this public property or do you have any other usages?

    You could try adding a dummy call like the following to ensure the hosted indicator gets called historically:

    Code:
    double myDummy = MyIndicatorName()[0];
    double percent = MyIndicatorName().PercentageMove;
    this would ensure OnBarUpdate is called to assign the value.

    We have a comment about this in kind of an odd spot in the helpguide as it relates to adding Indicators from Strategies as well: http://ninjatrader.com/support/helpG...ightsub=hosted

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by PeterGolz, 01-17-2020, 10:42 AM
    11 responses
    71 views
    0 likes
    Last Post reubenlasky  
    Started by utilizator, Today, 11:36 AM
    0 responses
    4 views
    0 likes
    Last Post utilizator  
    Started by EnveousColnago, Today, 07:24 AM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by tornadoatc, Today, 10:31 AM
    0 responses
    3 views
    0 likes
    Last Post tornadoatc  
    Started by EnveousColnago, Yesterday, 05:43 PM
    5 responses
    30 views
    0 likes
    Last Post EnveousColnago  
    Working...
    X