• 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

Net change difference between a pair

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

    Net change difference between a pair

    I looked at net change indicator and tried to code the indicator plotting the difference between the net change of 2 instruments on intraday basis. But the indicator is not plotting any line.
    eg , If I need to plot the difference between 6E and 6B percent change in intraday basis.


    If anybody can point out the error here?


    #region Variables

    private string hedgeInstrument = @"";
    private int hedgeInstrumentPeriod = 3;

    #endregion


    protected override void Initialize()
    {
    Add(new Plot(Color.FromKnownColor(KnownColor.PaleTurquoise ), PlotStyle.Line, "NetChangePair"));
    Overlay = false;

    if (hedgeInstrument!= "")
    {
    Add(hedgeInstrument,PeriodType.Minute,hedgeInstrum entPeriod);
    }
    }

    protected override void OnBarUpdate()
    {
    if(BarsInProgress==0)
    {

    double nt1 = ((Closes[0][0]-CurrentDayOHL(BarsArray[0]).CurrentOpen[0])/CurrentDayOHL(BarsArray[0]).CurrentOpen[0])*100;
    double nt2 = ((Closes[1][0]-CurrentDayOHL(BarsArray[1]).CurrentOpen[0])/CurrentDayOHL(BarsArray[1]).CurrentOpen[0])*100;
    double difference = nt1-nt2;

    NetChangePair.Set(difference);
    }
    }
    Attached Files

    #2
    Hello woodies,

    Thank you for your note.

    I applied your indicator and set the user input for the symbol to ES ##-## and see plots.

    Are you seeing errors in the log tab? What instrument are you attempting to pass for the input?

    I look forward to your reply.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_AlanP View Post
      Hello woodies,

      Thank you for your note.

      I applied your indicator and set the user input for the symbol to ES ##-## and see plots.

      Are you seeing errors in the log tab? What instrument are you attempting to pass for the input?

      I look forward to your reply.



      Thanks....I checked it again against some pairs, ES/NQ,ES/YM,6E/6B and now it os showing the difference between the percent change of any futures pair since current day's open correctly. It didnt work previously.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by supermht, Today, 10:13 PM
      0 responses
      0 views
      0 likes
      Last Post supermht  
      Started by supermht, Today, 07:59 PM
      0 responses
      2 views
      0 likes
      Last Post supermht  
      Started by mohdhm, Today, 05:13 PM
      1 response
      12 views
      0 likes
      Last Post nkhoi
      by nkhoi
       
      Started by 3lliot, Today, 05:55 PM
      0 responses
      2 views
      0 likes
      Last Post 3lliot
      by 3lliot
       
      Started by Fargo, Today, 04:57 PM
      0 responses
      11 views
      0 likes
      Last Post Fargo
      by Fargo
       
      Working...
      X